mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
Audit on home, lint in probe
This commit is contained in:
420
accounts/package-lock.json
generated
420
accounts/package-lock.json
generated
@@ -1635,11 +1635,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
|
||||
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
|
||||
},
|
||||
"abab": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz",
|
||||
"integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4="
|
||||
},
|
||||
"abbrev": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||
@@ -1654,24 +1649,11 @@
|
||||
"negotiator": "0.6.2"
|
||||
}
|
||||
},
|
||||
"acorn": {
|
||||
"version": "4.0.13",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz",
|
||||
"integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c="
|
||||
},
|
||||
"acorn-dynamic-import": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz",
|
||||
"integrity": "sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw=="
|
||||
},
|
||||
"acorn-globals": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-3.1.0.tgz",
|
||||
"integrity": "sha1-/YJw9x+7SZawBPqIDuXUZXOnMb8=",
|
||||
"requires": {
|
||||
"acorn": "^4.0.4"
|
||||
}
|
||||
},
|
||||
"acorn-jsx": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.1.tgz",
|
||||
@@ -1687,11 +1669,6 @@
|
||||
"resolved": "https://registry.npmjs.org/address/-/address-1.0.3.tgz",
|
||||
"integrity": "sha512-z55ocwKBRLryBs394Sm3ushTtBeg6VAeuku7utSoSnsJKvKcnXFIyC6vh27n3rXyxSgkJBBCAvyOn7gSUcTYjg=="
|
||||
},
|
||||
"after": {
|
||||
"version": "0.8.2",
|
||||
"resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz",
|
||||
"integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8="
|
||||
},
|
||||
"agent-base": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz",
|
||||
@@ -1899,11 +1876,6 @@
|
||||
"es-abstract": "^1.13.0"
|
||||
}
|
||||
},
|
||||
"arraybuffer.slice": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz",
|
||||
"integrity": "sha1-8zshWfBTKj8xB6JywMz70a0peco="
|
||||
},
|
||||
"arrify": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
|
||||
@@ -3199,11 +3171,6 @@
|
||||
"resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz",
|
||||
"integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ=="
|
||||
},
|
||||
"backo2": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz",
|
||||
"integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc="
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
@@ -3259,11 +3226,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"base64-arraybuffer": {
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz",
|
||||
"integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg="
|
||||
},
|
||||
"base64-js": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
|
||||
@@ -3282,14 +3244,6 @@
|
||||
"tweetnacl": "^0.14.3"
|
||||
}
|
||||
},
|
||||
"better-assert": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz",
|
||||
"integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=",
|
||||
"requires": {
|
||||
"callsite": "1.0.0"
|
||||
}
|
||||
},
|
||||
"big.js": {
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
|
||||
@@ -3300,11 +3254,6 @@
|
||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
|
||||
"integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw=="
|
||||
},
|
||||
"blob": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz",
|
||||
"integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE="
|
||||
},
|
||||
"bluebird": {
|
||||
"version": "3.5.5",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.5.tgz",
|
||||
@@ -3638,11 +3587,6 @@
|
||||
"caller-callsite": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"callsite": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz",
|
||||
"integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA="
|
||||
},
|
||||
"callsites": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
|
||||
@@ -3940,47 +3884,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"cloudboost": {
|
||||
"version": "6.6.6",
|
||||
"resolved": "https://registry.npmjs.org/cloudboost/-/cloudboost-6.6.6.tgz",
|
||||
"integrity": "sha1-x1YYauPJSGZw+aEmRW1s5sRtcNw=",
|
||||
"requires": {
|
||||
"axios": "^0.14.0",
|
||||
"bluebird": "^3.4.6",
|
||||
"form-data": "^2.1.2",
|
||||
"jsdom": "^9.10.0",
|
||||
"localStorage": "^1.0.3",
|
||||
"localforage": "^1.5.0",
|
||||
"socket.io-client": "^1.7.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": {
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.14.0.tgz",
|
||||
"integrity": "sha1-QPJPL06RO5+qQ9OnsuQKuHKa+pA=",
|
||||
"requires": {
|
||||
"follow-redirects": "0.0.7"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "0.0.7",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-0.0.7.tgz",
|
||||
"integrity": "sha1-NLkLqyqRGqNHVx2pDyK9NuzYqRk=",
|
||||
"requires": {
|
||||
"debug": "^2.2.0",
|
||||
"stream-consume": "^0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"co": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
||||
@@ -4082,21 +3985,11 @@
|
||||
"resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
|
||||
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs="
|
||||
},
|
||||
"component-bind": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz",
|
||||
"integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E="
|
||||
},
|
||||
"component-emitter": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz",
|
||||
"integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY="
|
||||
},
|
||||
"component-inherit": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz",
|
||||
"integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM="
|
||||
},
|
||||
"components": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/components/-/components-0.1.0.tgz",
|
||||
@@ -4218,11 +4111,6 @@
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
|
||||
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
|
||||
},
|
||||
"content-type-parser": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz",
|
||||
"integrity": "sha512-lM4l4CnMEwOLHAHr/P6MEZwZFPJFtAAKgL6pogbXmVZggIqXhdB6RbBtPOTsw2FcXwYhehRGERJmRrjOiIB8pQ=="
|
||||
},
|
||||
"convert-source-map": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz",
|
||||
@@ -4675,14 +4563,6 @@
|
||||
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz",
|
||||
"integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg=="
|
||||
},
|
||||
"cssstyle": {
|
||||
"version": "0.2.37",
|
||||
"resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz",
|
||||
"integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=",
|
||||
"requires": {
|
||||
"cssom": "0.3.x"
|
||||
}
|
||||
},
|
||||
"csstype": {
|
||||
"version": "2.6.6",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.6.tgz",
|
||||
@@ -5264,53 +5144,6 @@
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"engine.io-client": {
|
||||
"version": "1.8.5",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.8.5.tgz",
|
||||
"integrity": "sha512-AYTgHyeVUPitsseqjoedjhYJapNVoSPShbZ+tEUX9/73jgZ/Z3sUlJf9oYgdEBBdVhupUpUqSxH0kBCXlQnmZg==",
|
||||
"requires": {
|
||||
"component-emitter": "1.2.1",
|
||||
"component-inherit": "0.0.3",
|
||||
"debug": "2.3.3",
|
||||
"engine.io-parser": "1.3.2",
|
||||
"has-cors": "1.1.0",
|
||||
"indexof": "0.0.1",
|
||||
"parsejson": "0.0.3",
|
||||
"parseqs": "0.0.5",
|
||||
"parseuri": "0.0.5",
|
||||
"ws": "~1.1.5",
|
||||
"xmlhttprequest-ssl": "1.5.3",
|
||||
"yeast": "0.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz",
|
||||
"integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=",
|
||||
"requires": {
|
||||
"ms": "0.7.2"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz",
|
||||
"integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U="
|
||||
}
|
||||
}
|
||||
},
|
||||
"engine.io-parser": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.3.2.tgz",
|
||||
"integrity": "sha1-k3sHnwAH0Ik+xW1GyyILjLQ1Igo=",
|
||||
"requires": {
|
||||
"after": "0.8.2",
|
||||
"arraybuffer.slice": "0.0.6",
|
||||
"base64-arraybuffer": "0.1.5",
|
||||
"blob": "0.0.4",
|
||||
"has-binary": "0.1.7",
|
||||
"wtf-8": "1.0.0"
|
||||
}
|
||||
},
|
||||
"enhanced-resolve": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz",
|
||||
@@ -6421,16 +6254,6 @@
|
||||
"worker-rpc": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"form-data": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.0.tgz",
|
||||
"integrity": "sha512-WXieX3G/8side6VIqx44ablyULoGruSde5PNTxoUyo5CeyAMX6nVWUd0rgist/EuX655cjhUhTo1Fo3tRYqbcA==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.6",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"forwarded": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
|
||||
@@ -7198,19 +7021,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"has-binary": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz",
|
||||
"integrity": "sha1-aOYesWIQyVRaClzOBqhzkS/h5ow=",
|
||||
"requires": {
|
||||
"isarray": "0.0.1"
|
||||
}
|
||||
},
|
||||
"has-cors": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz",
|
||||
"integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk="
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
@@ -7569,11 +7379,6 @@
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
|
||||
"integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg=="
|
||||
},
|
||||
"immediate": {
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
|
||||
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
|
||||
},
|
||||
"immer": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/immer/-/immer-1.10.0.tgz",
|
||||
@@ -7628,11 +7433,6 @@
|
||||
"resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz",
|
||||
"integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc="
|
||||
},
|
||||
"indexof": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz",
|
||||
"integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10="
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
@@ -8763,32 +8563,6 @@
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
|
||||
},
|
||||
"jsdom": {
|
||||
"version": "9.12.0",
|
||||
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-9.12.0.tgz",
|
||||
"integrity": "sha1-6MVG//ywbADUgzyoRBD+1/igl9Q=",
|
||||
"requires": {
|
||||
"abab": "^1.0.3",
|
||||
"acorn": "^4.0.4",
|
||||
"acorn-globals": "^3.1.0",
|
||||
"array-equal": "^1.0.0",
|
||||
"content-type-parser": "^1.0.1",
|
||||
"cssom": ">= 0.3.2 < 0.4.0",
|
||||
"cssstyle": ">= 0.2.37 < 0.3.0",
|
||||
"escodegen": "^1.6.1",
|
||||
"html-encoding-sniffer": "^1.0.1",
|
||||
"nwmatcher": ">= 1.3.9 < 2.0.0",
|
||||
"parse5": "^1.5.1",
|
||||
"request": "^2.79.0",
|
||||
"sax": "^1.2.1",
|
||||
"symbol-tree": "^3.2.1",
|
||||
"tough-cookie": "^2.3.2",
|
||||
"webidl-conversions": "^4.0.0",
|
||||
"whatwg-encoding": "^1.0.1",
|
||||
"whatwg-url": "^4.3.0",
|
||||
"xml-name-validator": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"jsesc": {
|
||||
"version": "2.5.2",
|
||||
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
|
||||
@@ -8949,14 +8723,6 @@
|
||||
"type-check": "~0.3.2"
|
||||
}
|
||||
},
|
||||
"lie": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",
|
||||
"integrity": "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=",
|
||||
"requires": {
|
||||
"immediate": "~3.0.5"
|
||||
}
|
||||
},
|
||||
"load-json-file": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
|
||||
@@ -9058,19 +8824,6 @@
|
||||
"resolved": "https://registry.npmjs.org/loaders.css/-/loaders.css-0.1.2.tgz",
|
||||
"integrity": "sha1-Op+0NybHMzSjgUKvnQYpAZtlh0M="
|
||||
},
|
||||
"localStorage": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/localStorage/-/localStorage-1.0.4.tgz",
|
||||
"integrity": "sha512-r35zrihcDiX+dqWlJSeIwS9nrF95OQTgqMFm3FB2D/+XgdmZtcutZOb7t0xXkhOEM8a9kpuu7cc28g1g36I5DQ=="
|
||||
},
|
||||
"localforage": {
|
||||
"version": "1.7.3",
|
||||
"resolved": "https://registry.npmjs.org/localforage/-/localforage-1.7.3.tgz",
|
||||
"integrity": "sha512-1TulyYfc4udS7ECSBT2vwJksWbkwwTX8BzeUIiq8Y07Riy7bDAAnxDaPU/tWyOVmQAcWJIEIFP9lPfBGqVoPgQ==",
|
||||
"requires": {
|
||||
"lie": "3.1.1"
|
||||
}
|
||||
},
|
||||
"locate-path": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
|
||||
@@ -9777,11 +9530,6 @@
|
||||
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
|
||||
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
|
||||
},
|
||||
"nwmatcher": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.4.tgz",
|
||||
"integrity": "sha512-3iuY4N5dhgMpCUrOVnuAdGrgxVqV2cJpM+XNccjR2DKOB1RUP0aA+wGXEiNziG/UKboFyGBIoKOaNlJxx8bciQ=="
|
||||
},
|
||||
"nwsapi": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.4.tgz",
|
||||
@@ -9797,11 +9545,6 @@
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
|
||||
},
|
||||
"object-component": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz",
|
||||
"integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE="
|
||||
},
|
||||
"object-copy": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz",
|
||||
@@ -10029,11 +9772,6 @@
|
||||
"wordwrap": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz",
|
||||
"integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8="
|
||||
},
|
||||
"original": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz",
|
||||
@@ -10175,35 +9913,6 @@
|
||||
"json-parse-better-errors": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"parse5": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz",
|
||||
"integrity": "sha1-m387DeMr543CQBsXVzzK8Pb1nZQ="
|
||||
},
|
||||
"parsejson": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/parsejson/-/parsejson-0.0.3.tgz",
|
||||
"integrity": "sha1-q343WfIJ7OmUN5c/fQ8fZK4OZKs=",
|
||||
"requires": {
|
||||
"better-assert": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"parseqs": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz",
|
||||
"integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=",
|
||||
"requires": {
|
||||
"better-assert": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"parseuri": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz",
|
||||
"integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=",
|
||||
"requires": {
|
||||
"better-assert": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
@@ -13295,70 +13004,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"socket.io-client": {
|
||||
"version": "1.7.4",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.7.4.tgz",
|
||||
"integrity": "sha1-7J+CA1btme9tNX8HVtZIcXvdQoE=",
|
||||
"requires": {
|
||||
"backo2": "1.0.2",
|
||||
"component-bind": "1.0.0",
|
||||
"component-emitter": "1.2.1",
|
||||
"debug": "2.3.3",
|
||||
"engine.io-client": "~1.8.4",
|
||||
"has-binary": "0.1.7",
|
||||
"indexof": "0.0.1",
|
||||
"object-component": "0.0.3",
|
||||
"parseuri": "0.0.5",
|
||||
"socket.io-parser": "2.3.1",
|
||||
"to-array": "0.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz",
|
||||
"integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=",
|
||||
"requires": {
|
||||
"ms": "0.7.2"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz",
|
||||
"integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U="
|
||||
}
|
||||
}
|
||||
},
|
||||
"socket.io-parser": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.3.1.tgz",
|
||||
"integrity": "sha1-3VMgJRA85Clpcya+/WQAX8/ltKA=",
|
||||
"requires": {
|
||||
"component-emitter": "1.1.2",
|
||||
"debug": "2.2.0",
|
||||
"isarray": "0.0.1",
|
||||
"json3": "3.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"component-emitter": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz",
|
||||
"integrity": "sha1-KWWU8nU9qmOZbSrwjRWpURbJrsM="
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
|
||||
"integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
|
||||
"requires": {
|
||||
"ms": "0.7.1"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
|
||||
"integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg="
|
||||
}
|
||||
}
|
||||
},
|
||||
"sockjs": {
|
||||
"version": "0.3.19",
|
||||
"resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.19.tgz",
|
||||
@@ -13625,11 +13270,6 @@
|
||||
"readable-stream": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"stream-consume": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.1.tgz",
|
||||
"integrity": "sha512-tNa3hzgkjEP7XbCkbRXe1jpg+ievoa0O4SCFlMOYEscGSS4JJsckGL8swUyAa/ApGU3Ae4t6Honor4HhL+tRyg=="
|
||||
},
|
||||
"stream-each": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz",
|
||||
@@ -13984,11 +13624,6 @@
|
||||
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz",
|
||||
"integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE="
|
||||
},
|
||||
"to-array": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz",
|
||||
"integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA="
|
||||
},
|
||||
"to-arraybuffer": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz",
|
||||
@@ -14085,11 +13720,6 @@
|
||||
"punycode": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
|
||||
},
|
||||
"trim-right": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz",
|
||||
@@ -14173,11 +13803,6 @@
|
||||
"source-map": "~0.6.1"
|
||||
}
|
||||
},
|
||||
"ultron": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz",
|
||||
"integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po="
|
||||
},
|
||||
"uncontrollable": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/uncontrollable/-/uncontrollable-5.1.0.tgz",
|
||||
@@ -14764,22 +14389,6 @@
|
||||
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz",
|
||||
"integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g=="
|
||||
},
|
||||
"whatwg-url": {
|
||||
"version": "4.8.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-4.8.0.tgz",
|
||||
"integrity": "sha1-0pgaqRSMHgCkHFphMRZqtGg7vMA=",
|
||||
"requires": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
|
||||
}
|
||||
}
|
||||
},
|
||||
"which": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||
@@ -15040,35 +14649,11 @@
|
||||
"signal-exit": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"ws": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-1.1.5.tgz",
|
||||
"integrity": "sha512-o3KqipXNUdS7wpQzBHSe180lBGO60SoK0yVo3CYJgb2MkobuWuBX6dhkYP5ORCLd55y+SaflMOV5fqAB53ux4w==",
|
||||
"requires": {
|
||||
"options": ">=0.0.5",
|
||||
"ultron": "1.0.x"
|
||||
}
|
||||
},
|
||||
"wtf-8": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wtf-8/-/wtf-8-1.0.0.tgz",
|
||||
"integrity": "sha1-OS2LotDxw00e4tYw8V0O+2jhBIo="
|
||||
},
|
||||
"xml-name-validator": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-2.0.1.tgz",
|
||||
"integrity": "sha1-TYuPHszTQZqjYgYb7O9RXh5VljU="
|
||||
},
|
||||
"xmlchars": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.1.1.tgz",
|
||||
"integrity": "sha512-7hew1RPJ1iIuje/Y01bGD/mXokXxegAgVS+e+E0wSi2ILHQkYAH1+JXARwTjZSM4Z4Z+c73aKspEcqj+zPPL/w=="
|
||||
},
|
||||
"xmlhttprequest-ssl": {
|
||||
"version": "1.5.3",
|
||||
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.3.tgz",
|
||||
"integrity": "sha1-GFqIjATspGw+QHDZn3tJ3jUomS0="
|
||||
},
|
||||
"xregexp": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.0.0.tgz",
|
||||
@@ -15131,11 +14716,6 @@
|
||||
"requires": {
|
||||
"fd-slicer": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"yeast": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
|
||||
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1308
home/package-lock.json
generated
1308
home/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -11,26 +11,26 @@
|
||||
"audit": "npm-audit-ci-wrapper --threshold=high"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": "^1.14.1",
|
||||
"compression": "^1.7.0",
|
||||
"ejs": "^2.3.1",
|
||||
"express": "^4.12.3",
|
||||
"express-minify-html": "^0.12.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"compression": "^1.7.4",
|
||||
"ejs": "^2.6.2",
|
||||
"express": "^4.17.1",
|
||||
"express-seojs": "0.0.5",
|
||||
"path": "^0.11.14",
|
||||
"prerender-node": "^3.2.4",
|
||||
"prerender-node": "^3.2.5",
|
||||
"q": "^1.4.1",
|
||||
"request": "^2.88.0",
|
||||
"twitter-node-client": "0.0.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chrome-launcher": "^0.10.2",
|
||||
"chrome-launcher": "^0.10.7",
|
||||
"eslint": "5.16.0",
|
||||
"eslint-plugin-react": "^7.14.3",
|
||||
"faker": "^4.1.0",
|
||||
"jest": "^24.8.0",
|
||||
"lighthouse": "^2.9.4",
|
||||
"eslint": "5.16.0",
|
||||
"npm-audit-ci-wrapper": "^2.2.1",
|
||||
"puppeteer": "^1.18.0",
|
||||
"start-server-and-test": "^1.7.0"
|
||||
"npm-audit-ci-wrapper": "^2.3.0",
|
||||
"puppeteer": "^1.19.0",
|
||||
"start-server-and-test": "^1.9.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,30 +3,11 @@ var app = express();
|
||||
var bodyParser = require('body-parser');
|
||||
var request = require('request');
|
||||
var path = require('path');
|
||||
var minifyHTML = require('express-minify-html');
|
||||
var compression = require('compression');
|
||||
|
||||
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({extended: true}));
|
||||
|
||||
|
||||
//If its in production, then compress everything.
|
||||
if(process.env && process.env.PRODUCTION){
|
||||
app.use(minifyHTML({
|
||||
override: true,
|
||||
exception_url: false,
|
||||
htmlMinifier: {
|
||||
removeComments: true,
|
||||
collapseWhitespace: true,
|
||||
collapseBooleanAttributes: true,
|
||||
removeAttributeQuotes: true,
|
||||
removeEmptyAttributes: true,
|
||||
minifyJS: true
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
app.use(compression());
|
||||
|
||||
app.use('*', function(req, res, next) {
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
var http = require('http').createServer(app);
|
||||
var cors = require('cors');
|
||||
const Main = require('./workers/main');
|
||||
const cron = require('node-cron');
|
||||
|
||||
app.use(cors());
|
||||
app.set('port', process.env.PORT || 3008);
|
||||
|
||||
http.listen(app.get('port'), function () {
|
||||
// eslint-disable-next-line
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
var http = require('http').createServer(app);
|
||||
var cors = require('cors');
|
||||
const Main = require('./workers/main');
|
||||
const cron = require('node-cron');
|
||||
|
||||
app.use(cors());
|
||||
app.set('port', process.env.PORT || 3008);
|
||||
|
||||
http.listen(app.get('port'), function () {
|
||||
// eslint-disable-next-line
|
||||
console.log('Server Started on port ' + app.get('port'));
|
||||
});
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(JSON.stringify({
|
||||
status: 200,
|
||||
message: 'Service Status - OK',
|
||||
}));
|
||||
});
|
||||
|
||||
// This cron runs every minute
|
||||
cron.schedule('* * * * *',() =>{Main.runJob();});
|
||||
|
||||
module.exports = app;
|
||||
});
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(JSON.stringify({
|
||||
status: 200,
|
||||
message: 'Service Status - OK',
|
||||
}));
|
||||
});
|
||||
|
||||
// This cron runs every minute
|
||||
cron.schedule('* * * * *',() =>{Main.runJob();});
|
||||
|
||||
module.exports = app;
|
||||
|
||||
@@ -1,99 +1,99 @@
|
||||
const axios = require('axios');
|
||||
const config = require('./config');
|
||||
|
||||
var headers = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
'probeName': config.probeName,
|
||||
'probeKey': config.accessKey
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
postApi: (url, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
method: 'POST',
|
||||
url: `${config.serverUrl}/${url}`,
|
||||
headers,
|
||||
data
|
||||
})
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (error && error.response && error.response.data)
|
||||
error = error.response.data;
|
||||
if (error && error.data) {
|
||||
error = error.data;
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
getApi: (url) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
method: 'GET',
|
||||
url: `${config.serverUrl}/${url}`,
|
||||
headers
|
||||
})
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (error && error.response && error.response.data)
|
||||
error = error.response.data;
|
||||
if (error && error.data) {
|
||||
error = error.data;
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
putApi: (url, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
method: 'PUT',
|
||||
url: `${config.serverUrl}/${url}`,
|
||||
headers,
|
||||
data
|
||||
})
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (error && error.response && error.response.data)
|
||||
error = error.response.data;
|
||||
if (error && error.data) {
|
||||
error = error.data;
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
deleteApi: (url, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
method: 'DELETE',
|
||||
url: `${config.serverUrl}/${url}`,
|
||||
headers,
|
||||
data
|
||||
})
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (error && error.response && error.response.data)
|
||||
error = error.response.data;
|
||||
if (error && error.data) {
|
||||
error = error.data;
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
const axios = require('axios');
|
||||
const config = require('./config');
|
||||
|
||||
var headers = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
'probeName': config.probeName,
|
||||
'probeKey': config.accessKey
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
postApi: (url, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
method: 'POST',
|
||||
url: `${config.serverUrl}/${url}`,
|
||||
headers,
|
||||
data
|
||||
})
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (error && error.response && error.response.data)
|
||||
error = error.response.data;
|
||||
if (error && error.data) {
|
||||
error = error.data;
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
getApi: (url) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
method: 'GET',
|
||||
url: `${config.serverUrl}/${url}`,
|
||||
headers
|
||||
})
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (error && error.response && error.response.data)
|
||||
error = error.response.data;
|
||||
if (error && error.data) {
|
||||
error = error.data;
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
putApi: (url, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
method: 'PUT',
|
||||
url: `${config.serverUrl}/${url}`,
|
||||
headers,
|
||||
data
|
||||
})
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (error && error.response && error.response.data)
|
||||
error = error.response.data;
|
||||
if (error && error.data) {
|
||||
error = error.data;
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
deleteApi: (url, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
method: 'DELETE',
|
||||
url: `${config.serverUrl}/${url}`,
|
||||
headers,
|
||||
data
|
||||
})
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
if (error && error.response && error.response.data)
|
||||
error = error.response.data;
|
||||
if (error && error.data) {
|
||||
error = error.data;
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const postApi = require('./api').postApi;
|
||||
|
||||
module.exports = {
|
||||
setMonitorTime: async function (monitorId,responseTime,responseStatus,status) {
|
||||
return await postApi(`probe/setTime/${monitorId}`,{responseTime,responseStatus,status});
|
||||
},
|
||||
getMonitorTime: async function (monitorId,date) {
|
||||
return await postApi(`probe/getTime/${monitorId}`,date);
|
||||
},
|
||||
const postApi = require('./api').postApi;
|
||||
|
||||
module.exports = {
|
||||
setMonitorTime: async function (monitorId,responseTime,responseStatus,status) {
|
||||
return await postApi(`probe/setTime/${monitorId}`,{responseTime,responseStatus,status});
|
||||
},
|
||||
getMonitorTime: async function (monitorId,date) {
|
||||
return await postApi(`probe/getTime/${monitorId}`,date);
|
||||
},
|
||||
};
|
||||
@@ -1,305 +1,305 @@
|
||||
var _ = require('lodash');
|
||||
module.exports = {
|
||||
headers: async (val, type) => {
|
||||
let header = {};
|
||||
if (type && type.length) {
|
||||
header['Content-Type'] = type;
|
||||
}
|
||||
if (val && val.length) {
|
||||
val.map(head => {
|
||||
header[head.key] = head.value;
|
||||
});
|
||||
}
|
||||
return header;
|
||||
},
|
||||
|
||||
body: async (val, type) => {
|
||||
let bodyContent = {};
|
||||
if (type && type === 'formData' && val && val[0] && val[0].key) {
|
||||
val.map(bod => {
|
||||
bodyContent[bod.key] = bod.value;
|
||||
});
|
||||
bodyContent = JSON.stringify(bodyContent);
|
||||
}
|
||||
else if (type && type === 'text' && val && val.length) {
|
||||
bodyContent = val;
|
||||
}
|
||||
return bodyContent;
|
||||
},
|
||||
|
||||
conditions: async (respTime, resp, con) => {
|
||||
let stat = true;
|
||||
if (con && con.and && con.and.length) {
|
||||
stat = await checkAnd(respTime, con.and, resp.status || resp.statusCode || null, resp.body || null);
|
||||
}
|
||||
else if (con && con.or && con.or.length) {
|
||||
stat = await checkOr(respTime, con.or, resp.status || resp.statusCode || null, resp.body || null);
|
||||
}
|
||||
return stat;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
const checkAnd = async (respTime, con, statusCode, body) => {
|
||||
let validity = true;
|
||||
for (let i = 0; i < con.length; i++) {
|
||||
if (con[i] && con[i].responseType && con[i].responseType === 'responseTime') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'greaterThan') {
|
||||
if (!(con[i] && con[i].field1 && respTime && respTime > con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'lessThan') {
|
||||
if (!(con[i] && con[i].field1 && respTime && respTime < con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'inBetween') {
|
||||
if (!(con[i] && con[i].field1 && respTime && con[i].field2 && respTime > con[i].field1 && respTime < con[i].field2)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'equalTo') {
|
||||
if (!(con[i] && con[i].field1 && respTime && respTime == con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'notEqualTo') {
|
||||
if (!(con[i] && con[i].field1 && respTime && respTime != con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'gtEqualTo') {
|
||||
if (!(con[i] && con[i].field1 && respTime && respTime >= con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'ltEqualTo') {
|
||||
if (!(con[i] && con[i].field1 && respTime && respTime <= con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].responseType === 'doesRespond') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'isUp') {
|
||||
if (!(con[i] && con[i].filter && respTime)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'isDown') {
|
||||
if (!(con[i] && con[i].filter && !respTime)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].responseType === 'statusCode') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'greaterThan') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && statusCode > con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'lessThan') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && statusCode < con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'inBetween') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && con[i].field2 && statusCode > con[i].field1 && statusCode < con[i].field2)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'equalTo') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && statusCode == con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'notEqualTo') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && statusCode != con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'gtEqualTo') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && statusCode >= con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'ltEqualTo') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && statusCode <= con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].responseType === 'responseBody') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'contains') {
|
||||
if (!(con[i] && con[i].field1 && body && body[con[i].field1])) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'doesNotContain') {
|
||||
if (!(con[i] && con[i].field1 && body && !body[con[i].field1])) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'jsExpression') {
|
||||
if (!(con[i] && con[i].field1 && body && body[con[i].field1] === con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'empty') {
|
||||
if (!(con[i] && con[i].filter && body && _.isEmpty(body))) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'notEmpty') {
|
||||
if (!(con[i] && con[i].filter && body && !_.isEmpty(body))) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (con[i] && con[i].collection && con[i].collection.and && con[i].collection.and.length) {
|
||||
let temp = await checkAnd(respTime, con[i].collection.and, statusCode, body);
|
||||
if (!temp) {
|
||||
validity = temp;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].collection && con[i].collection.or && con[i].collection.or.length) {
|
||||
let temp1 = await checkOr(respTime, con[i].collection.or, statusCode, body);
|
||||
if (!temp1) {
|
||||
validity = temp1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return validity;
|
||||
};
|
||||
|
||||
const checkOr = async (respTime, con, statusCode, body) => {
|
||||
let validity = false;
|
||||
for (let i = 0; i < con.length; i++) {
|
||||
if (con[i] && con[i].responseType === 'responseTime') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'greaterThan') {
|
||||
if (con[i] && con[i].field1 && respTime && respTime > con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'lessThan') {
|
||||
if (con[i] && con[i].field1 && respTime && respTime < con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'inBetween') {
|
||||
if (con[i] && con[i].field1 && respTime && con[i].field2 && respTime > con[i].field1 && respTime < con[i].field2) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'equalTo') {
|
||||
if (con[i] && con[i].field1 && respTime && respTime == con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'notEqualTo') {
|
||||
if (con[i] && con[i].field1 && respTime && respTime != con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'gtEqualTo') {
|
||||
if (con[i] && con[i].field1 && respTime && respTime >= con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'ltEqualTo') {
|
||||
if (con[i] && con[i].field1 && respTime && respTime <= con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].responseType === 'doesRespond') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'isUp') {
|
||||
if (con[i] && con[i].filter && respTime) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'isDown') {
|
||||
if (con[i] && con[i].filter && !respTime) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].responseType === 'statusCode') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'greaterThan') {
|
||||
if (con[i] && con[i].field1 && statusCode && statusCode > con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'lessThan') {
|
||||
if (con[i] && con[i].field1 && statusCode && statusCode < con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'inBetween') {
|
||||
if (con[i] && con[i].field1 && statusCode && con[i].field2 && statusCode > con[i].field1 && statusCode < con[i].field2) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'equalTo') {
|
||||
if (con[i] && con[i].field1 && statusCode && statusCode == con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'notEqualTo') {
|
||||
if (con[i] && con[i].field1 && statusCode && statusCode != con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'gtEqualTo') {
|
||||
if (con[i] && con[i].field1 && statusCode && statusCode >= con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'ltEqualTo') {
|
||||
if (con[i] && con[i].field1 && statusCode && statusCode <= con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].responseType === 'responseBody') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'contains') {
|
||||
if (con[i] && con[i].field1 && body && body[con[i].field1]) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'doesNotContain') {
|
||||
if (con[i] && con[i].field1 && body && !body[con[i].field1]) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'jsExpression') {
|
||||
if (con[i] && con[i].field1 && body && body[con[i].field1] === con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'empty') {
|
||||
if (con[i] && con[i].filter && body && _.isEmpty(body)) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'notEmpty') {
|
||||
if (con[i] && con[i].filter && body && !_.isEmpty(body)) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (con[i] && con[i].collection && con[i].collection.and && con[i].collection.and.length) {
|
||||
let temp = await checkAnd(respTime, con[i].collection.and, statusCode, body);
|
||||
if (temp) {
|
||||
validity = temp;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].collection && con[i].collection.or && con[i].collection.or.length) {
|
||||
let temp1 = await checkOr(respTime, con[i].collection.or, statusCode, body);
|
||||
if (temp1) {
|
||||
validity = temp1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return validity;
|
||||
var _ = require('lodash');
|
||||
module.exports = {
|
||||
headers: async (val, type) => {
|
||||
let header = {};
|
||||
if (type && type.length) {
|
||||
header['Content-Type'] = type;
|
||||
}
|
||||
if (val && val.length) {
|
||||
val.map(head => {
|
||||
header[head.key] = head.value;
|
||||
});
|
||||
}
|
||||
return header;
|
||||
},
|
||||
|
||||
body: async (val, type) => {
|
||||
let bodyContent = {};
|
||||
if (type && type === 'formData' && val && val[0] && val[0].key) {
|
||||
val.map(bod => {
|
||||
bodyContent[bod.key] = bod.value;
|
||||
});
|
||||
bodyContent = JSON.stringify(bodyContent);
|
||||
}
|
||||
else if (type && type === 'text' && val && val.length) {
|
||||
bodyContent = val;
|
||||
}
|
||||
return bodyContent;
|
||||
},
|
||||
|
||||
conditions: async (respTime, resp, con) => {
|
||||
let stat = true;
|
||||
if (con && con.and && con.and.length) {
|
||||
stat = await checkAnd(respTime, con.and, resp.status || resp.statusCode || null, resp.body || null);
|
||||
}
|
||||
else if (con && con.or && con.or.length) {
|
||||
stat = await checkOr(respTime, con.or, resp.status || resp.statusCode || null, resp.body || null);
|
||||
}
|
||||
return stat;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
const checkAnd = async (respTime, con, statusCode, body) => {
|
||||
let validity = true;
|
||||
for (let i = 0; i < con.length; i++) {
|
||||
if (con[i] && con[i].responseType && con[i].responseType === 'responseTime') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'greaterThan') {
|
||||
if (!(con[i] && con[i].field1 && respTime && respTime > con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'lessThan') {
|
||||
if (!(con[i] && con[i].field1 && respTime && respTime < con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'inBetween') {
|
||||
if (!(con[i] && con[i].field1 && respTime && con[i].field2 && respTime > con[i].field1 && respTime < con[i].field2)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'equalTo') {
|
||||
if (!(con[i] && con[i].field1 && respTime && respTime == con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'notEqualTo') {
|
||||
if (!(con[i] && con[i].field1 && respTime && respTime != con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'gtEqualTo') {
|
||||
if (!(con[i] && con[i].field1 && respTime && respTime >= con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'ltEqualTo') {
|
||||
if (!(con[i] && con[i].field1 && respTime && respTime <= con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].responseType === 'doesRespond') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'isUp') {
|
||||
if (!(con[i] && con[i].filter && respTime)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'isDown') {
|
||||
if (!(con[i] && con[i].filter && !respTime)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].responseType === 'statusCode') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'greaterThan') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && statusCode > con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'lessThan') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && statusCode < con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'inBetween') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && con[i].field2 && statusCode > con[i].field1 && statusCode < con[i].field2)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'equalTo') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && statusCode == con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'notEqualTo') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && statusCode != con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'gtEqualTo') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && statusCode >= con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'ltEqualTo') {
|
||||
if (!(con[i] && con[i].field1 && statusCode && statusCode <= con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].responseType === 'responseBody') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'contains') {
|
||||
if (!(con[i] && con[i].field1 && body && body[con[i].field1])) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'doesNotContain') {
|
||||
if (!(con[i] && con[i].field1 && body && !body[con[i].field1])) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'jsExpression') {
|
||||
if (!(con[i] && con[i].field1 && body && body[con[i].field1] === con[i].field1)) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'empty') {
|
||||
if (!(con[i] && con[i].filter && body && _.isEmpty(body))) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'notEmpty') {
|
||||
if (!(con[i] && con[i].filter && body && !_.isEmpty(body))) {
|
||||
validity = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (con[i] && con[i].collection && con[i].collection.and && con[i].collection.and.length) {
|
||||
let temp = await checkAnd(respTime, con[i].collection.and, statusCode, body);
|
||||
if (!temp) {
|
||||
validity = temp;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].collection && con[i].collection.or && con[i].collection.or.length) {
|
||||
let temp1 = await checkOr(respTime, con[i].collection.or, statusCode, body);
|
||||
if (!temp1) {
|
||||
validity = temp1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return validity;
|
||||
};
|
||||
|
||||
const checkOr = async (respTime, con, statusCode, body) => {
|
||||
let validity = false;
|
||||
for (let i = 0; i < con.length; i++) {
|
||||
if (con[i] && con[i].responseType === 'responseTime') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'greaterThan') {
|
||||
if (con[i] && con[i].field1 && respTime && respTime > con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'lessThan') {
|
||||
if (con[i] && con[i].field1 && respTime && respTime < con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'inBetween') {
|
||||
if (con[i] && con[i].field1 && respTime && con[i].field2 && respTime > con[i].field1 && respTime < con[i].field2) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'equalTo') {
|
||||
if (con[i] && con[i].field1 && respTime && respTime == con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'notEqualTo') {
|
||||
if (con[i] && con[i].field1 && respTime && respTime != con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'gtEqualTo') {
|
||||
if (con[i] && con[i].field1 && respTime && respTime >= con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'ltEqualTo') {
|
||||
if (con[i] && con[i].field1 && respTime && respTime <= con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].responseType === 'doesRespond') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'isUp') {
|
||||
if (con[i] && con[i].filter && respTime) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'isDown') {
|
||||
if (con[i] && con[i].filter && !respTime) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].responseType === 'statusCode') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'greaterThan') {
|
||||
if (con[i] && con[i].field1 && statusCode && statusCode > con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'lessThan') {
|
||||
if (con[i] && con[i].field1 && statusCode && statusCode < con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'inBetween') {
|
||||
if (con[i] && con[i].field1 && statusCode && con[i].field2 && statusCode > con[i].field1 && statusCode < con[i].field2) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'equalTo') {
|
||||
if (con[i] && con[i].field1 && statusCode && statusCode == con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'notEqualTo') {
|
||||
if (con[i] && con[i].field1 && statusCode && statusCode != con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'gtEqualTo') {
|
||||
if (con[i] && con[i].field1 && statusCode && statusCode >= con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'ltEqualTo') {
|
||||
if (con[i] && con[i].field1 && statusCode && statusCode <= con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].responseType === 'responseBody') {
|
||||
if (con[i] && con[i].filter && con[i].filter === 'contains') {
|
||||
if (con[i] && con[i].field1 && body && body[con[i].field1]) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'doesNotContain') {
|
||||
if (con[i] && con[i].field1 && body && !body[con[i].field1]) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'jsExpression') {
|
||||
if (con[i] && con[i].field1 && body && body[con[i].field1] === con[i].field1) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'empty') {
|
||||
if (con[i] && con[i].filter && body && _.isEmpty(body)) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].filter && con[i].filter === 'notEmpty') {
|
||||
if (con[i] && con[i].filter && body && !_.isEmpty(body)) {
|
||||
validity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (con[i] && con[i].collection && con[i].collection.and && con[i].collection.and.length) {
|
||||
let temp = await checkAnd(respTime, con[i].collection.and, statusCode, body);
|
||||
if (temp) {
|
||||
validity = temp;
|
||||
}
|
||||
}
|
||||
else if (con[i] && con[i].collection && con[i].collection.or && con[i].collection.or.length) {
|
||||
let temp1 = await checkOr(respTime, con[i].collection.or, statusCode, body);
|
||||
if (temp1) {
|
||||
validity = temp1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return validity;
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
module.exports = {
|
||||
serverUrl: process.env['SERVER_URL'] || 'http://localhost:3002',
|
||||
probeName: process.env['PROBE_NAME'] || 'First Probe',
|
||||
accessKey : process.env['ACCESS_KEY'] || '33b674ca-9fdd-11e9-a2a3-2a2ae2dbcce4',
|
||||
};
|
||||
module.exports = {
|
||||
serverUrl: process.env['SERVER_URL'] || 'http://localhost:3002',
|
||||
probeName: process.env['PROBE_NAME'] || 'First Probe',
|
||||
accessKey : process.env['ACCESS_KEY'] || '33b674ca-9fdd-11e9-a2a3-2a2ae2dbcce4',
|
||||
};
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
const winston = require('winston');
|
||||
const Slack = require('winston-slack-transport');
|
||||
|
||||
if (process.env.PORT) {
|
||||
winston.add(Slack, {
|
||||
webhook_url: 'https://hooks.slack.com/services/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',
|
||||
channel: '#fyipe-logs',
|
||||
username: 'Error Bot',
|
||||
handleExceptions: true
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
log: (functionName, error) => {
|
||||
error = error && error.message ? error.message : error;
|
||||
winston.error(JSON.stringify({
|
||||
'error': String(error),
|
||||
'functionName': String(functionName),
|
||||
'stack': new Error().stack
|
||||
}, 0, 2));
|
||||
}
|
||||
const winston = require('winston');
|
||||
const Slack = require('winston-slack-transport');
|
||||
|
||||
if (process.env.PORT) {
|
||||
winston.add(Slack, {
|
||||
webhook_url: 'https://hooks.slack.com/services/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',
|
||||
channel: '#fyipe-logs',
|
||||
username: 'Error Bot',
|
||||
handleExceptions: true
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
log: (functionName, error) => {
|
||||
error = error && error.message ? error.message : error;
|
||||
winston.error(JSON.stringify({
|
||||
'error': String(error),
|
||||
'functionName': String(functionName),
|
||||
'stack': new Error().stack
|
||||
}, 0, 2));
|
||||
}
|
||||
};
|
||||
@@ -1,92 +1,92 @@
|
||||
/* eslint-disable no-console */
|
||||
const ConditionCheck = require('../utils/conditionCheck');
|
||||
const ApiService = require('../utils/apiService');
|
||||
const ErrorService = require('../utils/errorService');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
|
||||
// it collects all monitors then ping them one by one to store their response
|
||||
// checks if the website of the url in the monitors is up or down
|
||||
// creates incident if a website is down and resolves it when they come back up
|
||||
module.exports = {
|
||||
ping: async (monitor) => {
|
||||
if (monitor && monitor.type) {
|
||||
if (monitor.data.url) {
|
||||
try {
|
||||
let headers = await ConditionCheck.headers(monitor.headers, monitor.bodyType);
|
||||
let body = await ConditionCheck.body(monitor && monitor.text && monitor.text.length ? monitor.text : monitor.formData, monitor && monitor.text && monitor.text.length ?'text':'formData');
|
||||
var { res, resp } = await pingfetch(monitor.data.url, monitor.method, body, headers);
|
||||
} catch (error) {
|
||||
ErrorService.log('ping.pingFetch', error);
|
||||
throw error;
|
||||
}
|
||||
try {
|
||||
await pingService(monitor, res, resp);
|
||||
} catch (error) {
|
||||
ErrorService.log('ping.pingService', error);
|
||||
throw error;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var pingService = async (monitor, res, resp) => {
|
||||
let validUp = await (monitor && monitor.criteria && monitor.criteria.up ? ConditionCheck.conditions(res, resp, monitor.criteria.up) : false);
|
||||
let validDegraded = await (monitor && monitor.criteria && monitor.criteria.degraded ? ConditionCheck.conditions(res, resp, monitor.criteria.degraded) : false);
|
||||
let validDown = await (monitor && monitor.criteria && monitor.criteria.down ? ConditionCheck.conditions(res, resp, monitor.criteria.down) : false);
|
||||
if (validDown) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status, 'offline');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
else if (validDegraded) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status, 'degraded');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
else if (validUp) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status, 'online');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status, 'unknown');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var pingfetch = async (url, method, body, headers) => {
|
||||
let now = (new Date()).getTime();
|
||||
var resp = null;
|
||||
var res = null;
|
||||
try {
|
||||
resp = await fetch(url, {
|
||||
method: method,
|
||||
body: body,
|
||||
headers: headers,
|
||||
timeout: 10000
|
||||
});
|
||||
res = (new Date()).getTime() - now;
|
||||
} catch (error) {
|
||||
resp = error;
|
||||
}
|
||||
return { res, resp };
|
||||
/* eslint-disable no-console */
|
||||
const ConditionCheck = require('../utils/conditionCheck');
|
||||
const ApiService = require('../utils/apiService');
|
||||
const ErrorService = require('../utils/errorService');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
|
||||
// it collects all monitors then ping them one by one to store their response
|
||||
// checks if the website of the url in the monitors is up or down
|
||||
// creates incident if a website is down and resolves it when they come back up
|
||||
module.exports = {
|
||||
ping: async (monitor) => {
|
||||
if (monitor && monitor.type) {
|
||||
if (monitor.data.url) {
|
||||
try {
|
||||
let headers = await ConditionCheck.headers(monitor.headers, monitor.bodyType);
|
||||
let body = await ConditionCheck.body(monitor && monitor.text && monitor.text.length ? monitor.text : monitor.formData, monitor && monitor.text && monitor.text.length ?'text':'formData');
|
||||
var { res, resp } = await pingfetch(monitor.data.url, monitor.method, body, headers);
|
||||
} catch (error) {
|
||||
ErrorService.log('ping.pingFetch', error);
|
||||
throw error;
|
||||
}
|
||||
try {
|
||||
await pingService(monitor, res, resp);
|
||||
} catch (error) {
|
||||
ErrorService.log('ping.pingService', error);
|
||||
throw error;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var pingService = async (monitor, res, resp) => {
|
||||
let validUp = await (monitor && monitor.criteria && monitor.criteria.up ? ConditionCheck.conditions(res, resp, monitor.criteria.up) : false);
|
||||
let validDegraded = await (monitor && monitor.criteria && monitor.criteria.degraded ? ConditionCheck.conditions(res, resp, monitor.criteria.degraded) : false);
|
||||
let validDown = await (monitor && monitor.criteria && monitor.criteria.down ? ConditionCheck.conditions(res, resp, monitor.criteria.down) : false);
|
||||
if (validDown) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status, 'offline');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
else if (validDegraded) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status, 'degraded');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
else if (validUp) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status, 'online');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status, 'unknown');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var pingfetch = async (url, method, body, headers) => {
|
||||
let now = (new Date()).getTime();
|
||||
var resp = null;
|
||||
var res = null;
|
||||
try {
|
||||
resp = await fetch(url, {
|
||||
method: method,
|
||||
body: body,
|
||||
headers: headers,
|
||||
timeout: 10000
|
||||
});
|
||||
res = (new Date()).getTime() - now;
|
||||
} catch (error) {
|
||||
resp = error;
|
||||
}
|
||||
return { res, resp };
|
||||
};
|
||||
@@ -1,68 +1,68 @@
|
||||
const moment = require('moment');
|
||||
const ApiService = require('../utils/apiService');
|
||||
const ErrorService = require('../utils/errorService');
|
||||
// it collects all IOT device monitors then check the last time they where pinged
|
||||
// If the difference is greater than 2 minutes
|
||||
// creates incident if a website is down and resolves it when they come back up
|
||||
module.exports = {
|
||||
ping: async (monitor) => {
|
||||
var newDate = new moment();
|
||||
var resDate = new Date();
|
||||
if (monitor && monitor.type) {
|
||||
var d = new moment(monitor.lastPingTime);
|
||||
|
||||
if (newDate.diff(d, 'minutes') > 3) {
|
||||
try {
|
||||
var time = await ApiService.getMonitorTime(monitor._id, newDate);
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.getMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
if (time.status === 'online') {
|
||||
try {
|
||||
await pingService(monitor);
|
||||
} catch (error) {
|
||||
ErrorService.log('ping.pingService', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var res = (new Date()).getTime() - resDate.getTime();
|
||||
try {
|
||||
var newTime = await ApiService.getMonitorTime(monitor._id, newDate);
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.getMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
if (newTime.status === 'offline') {
|
||||
try {
|
||||
await pingService(monitor, res);
|
||||
} catch (error) {
|
||||
ErrorService.log('ping.pingService', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var pingService = async (monitor, res) => {
|
||||
if (res) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res,null, 'online');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, 0,null, 'offline');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
const moment = require('moment');
|
||||
const ApiService = require('../utils/apiService');
|
||||
const ErrorService = require('../utils/errorService');
|
||||
// it collects all IOT device monitors then check the last time they where pinged
|
||||
// If the difference is greater than 2 minutes
|
||||
// creates incident if a website is down and resolves it when they come back up
|
||||
module.exports = {
|
||||
ping: async (monitor) => {
|
||||
var newDate = new moment();
|
||||
var resDate = new Date();
|
||||
if (monitor && monitor.type) {
|
||||
var d = new moment(monitor.lastPingTime);
|
||||
|
||||
if (newDate.diff(d, 'minutes') > 3) {
|
||||
try {
|
||||
var time = await ApiService.getMonitorTime(monitor._id, newDate);
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.getMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
if (time.status === 'online') {
|
||||
try {
|
||||
await pingService(monitor);
|
||||
} catch (error) {
|
||||
ErrorService.log('ping.pingService', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var res = (new Date()).getTime() - resDate.getTime();
|
||||
try {
|
||||
var newTime = await ApiService.getMonitorTime(monitor._id, newDate);
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.getMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
if (newTime.status === 'offline') {
|
||||
try {
|
||||
await pingService(monitor, res);
|
||||
} catch (error) {
|
||||
ErrorService.log('ping.pingService', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var pingService = async (monitor, res) => {
|
||||
if (res) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res,null, 'online');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, 0,null, 'offline');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
/**
|
||||
*
|
||||
* Copyright HackerBay, Inc.
|
||||
*
|
||||
*/
|
||||
const getApi = require('../utils/api').getApi;
|
||||
const ApiMonitors = require('./apiMonitors');
|
||||
const UrlMonitors = require('./urlMonitors');
|
||||
const DeviceMonitors = require('./deviceMonitors');
|
||||
|
||||
module.exports = {
|
||||
runJob: async function () {
|
||||
let monitors = await getApi('probe/monitors');
|
||||
monitors = monitors.data;
|
||||
await Promise.all(monitors.map(monitor =>{
|
||||
if(monitor.type === 'api'){
|
||||
ApiMonitors.ping(monitor);
|
||||
}
|
||||
else if(monitor.type === 'url'){
|
||||
UrlMonitors.ping(monitor);
|
||||
}
|
||||
else if(monitor.type === 'device'){
|
||||
DeviceMonitors.ping(monitor);
|
||||
}
|
||||
}));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* Copyright HackerBay, Inc.
|
||||
*
|
||||
*/
|
||||
const getApi = require('../utils/api').getApi;
|
||||
const ApiMonitors = require('./apiMonitors');
|
||||
const UrlMonitors = require('./urlMonitors');
|
||||
const DeviceMonitors = require('./deviceMonitors');
|
||||
|
||||
module.exports = {
|
||||
runJob: async function () {
|
||||
let monitors = await getApi('probe/monitors');
|
||||
monitors = monitors.data;
|
||||
await Promise.all(monitors.map(monitor =>{
|
||||
if(monitor.type === 'api'){
|
||||
ApiMonitors.ping(monitor);
|
||||
}
|
||||
else if(monitor.type === 'url'){
|
||||
UrlMonitors.ping(monitor);
|
||||
}
|
||||
else if(monitor.type === 'device'){
|
||||
DeviceMonitors.ping(monitor);
|
||||
}
|
||||
}));
|
||||
},
|
||||
};
|
||||
@@ -1,86 +1,86 @@
|
||||
/* eslint-disable no-console */
|
||||
const ApiService = require('../utils/apiService');
|
||||
const ErrorService = require('../utils/errorService');
|
||||
const ConditionCheck = require('../utils/conditionCheck');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
|
||||
// it collects all monitors then ping them one by one to store their response
|
||||
// checks if the website of the url in the monitors is up or down
|
||||
// creates incident if a website is down and resolves it when they come back up
|
||||
module.exports = {
|
||||
ping: async (monitor) => {
|
||||
if (monitor && monitor.type) {
|
||||
if (monitor.data.url) {
|
||||
try {
|
||||
var { res, resp } = await pingfetch(monitor.data.url);
|
||||
} catch (error) {
|
||||
ErrorService.log('ping.pingFetch', error);
|
||||
throw error;
|
||||
}
|
||||
try {
|
||||
await pingService(monitor, res, resp);
|
||||
} catch (error) {
|
||||
ErrorService.log('ping.pingService', error);
|
||||
throw error;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var pingService = async (monitor, res, resp) => {
|
||||
let validUp = await (monitor && monitor.criteria && monitor.criteria.up ? ConditionCheck.conditions(res, resp, monitor.criteria.up) : false);
|
||||
let validDegraded = await (monitor && monitor.criteria && monitor.criteria.degraded ? ConditionCheck.conditions(res, resp, monitor.criteria.degraded) : false);
|
||||
let validDown = await (monitor && monitor.criteria && monitor.criteria.down ? ConditionCheck.conditions(res, resp, monitor.criteria.down) : false);
|
||||
if (validDown) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status || null, 'offline');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
else if (validDegraded) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status || null, 'degraded');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
else if (validUp) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status || null, 'online');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status || null, 'unknown');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const pingfetch = async (url) => {
|
||||
let now = (new Date()).getTime();
|
||||
var resp = null;
|
||||
var res = null;
|
||||
try {
|
||||
resp = await fetch(url, { timeout: 5000 });
|
||||
res = (new Date()).getTime() - now;
|
||||
} catch (error) {
|
||||
resp = error;
|
||||
}
|
||||
return { res, resp };
|
||||
/* eslint-disable no-console */
|
||||
const ApiService = require('../utils/apiService');
|
||||
const ErrorService = require('../utils/errorService');
|
||||
const ConditionCheck = require('../utils/conditionCheck');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
|
||||
// it collects all monitors then ping them one by one to store their response
|
||||
// checks if the website of the url in the monitors is up or down
|
||||
// creates incident if a website is down and resolves it when they come back up
|
||||
module.exports = {
|
||||
ping: async (monitor) => {
|
||||
if (monitor && monitor.type) {
|
||||
if (monitor.data.url) {
|
||||
try {
|
||||
var { res, resp } = await pingfetch(monitor.data.url);
|
||||
} catch (error) {
|
||||
ErrorService.log('ping.pingFetch', error);
|
||||
throw error;
|
||||
}
|
||||
try {
|
||||
await pingService(monitor, res, resp);
|
||||
} catch (error) {
|
||||
ErrorService.log('ping.pingService', error);
|
||||
throw error;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var pingService = async (monitor, res, resp) => {
|
||||
let validUp = await (monitor && monitor.criteria && monitor.criteria.up ? ConditionCheck.conditions(res, resp, monitor.criteria.up) : false);
|
||||
let validDegraded = await (monitor && monitor.criteria && monitor.criteria.degraded ? ConditionCheck.conditions(res, resp, monitor.criteria.degraded) : false);
|
||||
let validDown = await (monitor && monitor.criteria && monitor.criteria.down ? ConditionCheck.conditions(res, resp, monitor.criteria.down) : false);
|
||||
if (validDown) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status || null, 'offline');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
else if (validDegraded) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status || null, 'degraded');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
else if (validUp) {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status || null, 'online');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
await ApiService.setMonitorTime(monitor._id, res, resp.status || null, 'unknown');
|
||||
} catch (error) {
|
||||
ErrorService.log('ApiService.setMonitorTime', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const pingfetch = async (url) => {
|
||||
let now = (new Date()).getTime();
|
||||
var resp = null;
|
||||
var res = null;
|
||||
try {
|
||||
resp = await fetch(url, { timeout: 5000 });
|
||||
res = (new Date()).getTime() - now;
|
||||
} catch (error) {
|
||||
resp = error;
|
||||
}
|
||||
return { res, resp };
|
||||
};
|
||||
Reference in New Issue
Block a user