diff --git a/server/lib/dataSync.js b/server/lib/dataSync.js index 6957a87..3fe02c4 100644 --- a/server/lib/dataSync.js +++ b/server/lib/dataSync.js @@ -43,19 +43,26 @@ function syncWorkflows (callback) { }, () => { syncStatus.syncWorkflows = 'not_running' if (!processingError) { - mixin.updateConfigFile(['lastSync', 'syncWorkflows', 'time'], newRunsLastSync, () => {}); + mixin.updateLastIndexingTime(newRunsLastSync, 'syncWorkflows') } return callback(processingError); }); } -function syncContacts(callback) { +async function syncContacts(callback) { if(syncStatus.syncContacts === 'running') { return callback() } syncStatus.syncContacts = 'running' let newRunsLastSync = moment().format('Y-MM-DDTHH:mm:ss'); - let runsLastSync = config.get('lastSync:syncContacts:time'); + + let runsLastSync + await mixin.getLastIndexingTime('syncContacts', false).then((time) => { + runsLastSync = time + }).catch((time) => { + runsLastSync = moment('1970-01-01').format('Y-MM-DDTHH:mm:ss'); + }) + const isValid = moment(runsLastSync, 'Y-MM-DD').isValid(); if (!isValid) { runsLastSync = moment('1970-01-01').format('Y-MM-DD'); @@ -119,7 +126,7 @@ function syncContacts(callback) { }, () => { syncStatus.syncContacts = 'not_running' if(!processingError) { - mixin.updateConfigFile(['lastSync', 'syncContacts', 'time'], newRunsLastSync, () => {}); + mixin.updateLastIndexingTime(newRunsLastSync, 'syncContacts') cacheFHIR2ES(() => {}); logger.info('Contacts Sync Done'); return callback() @@ -164,7 +171,7 @@ function syncContactsGroups(callback) { }, () => { syncStatus.syncContactsGroups = 'not_running' if (!processingError) { - mixin.updateConfigFile(['lastSync', 'syncContactsGroups', 'time'], newRunsLastSync, () => {}); + mixin.updateLastIndexingTime(newRunsLastSync, 'syncContactsGroups') } return callback(processingError); }); @@ -194,7 +201,7 @@ function syncWorkflowRunMessages(callback) { }, () => { syncStatus.syncWorkflowRunMessages = 'not_running' if (!processingError) { - mixin.updateConfigFile(['lastSync', 'syncWorkflowRunMessages', 'time'], newRunsLastSync, () => {}); + mixin.updateLastIndexingTime(newRunsLastSync, 'syncWorkflowRunMessages') } return callback(processingError); }); @@ -210,7 +217,7 @@ function syncFloipFlowResults(callback) { syncStatus.syncFloipFlowResults = 'not_running' logger.info("Done Synchronizing flow results from FLOIP server"); if(!err) { - mixin.updateConfigFile(['lastSync', 'syncFloipFlowResults', 'time'], newRunsLastSync, () => {}); + mixin.updateLastIndexingTime(newRunsLastSync, 'syncFloipFlowResults') } return callback(err); }); diff --git a/server/lib/floip.js b/server/lib/floip.js index a3a79f4..d416c2f 100644 --- a/server/lib/floip.js +++ b/server/lib/floip.js @@ -14,7 +14,12 @@ async function flowResultsToQuestionnaire(callback) { bundle.type = 'batch'; bundle.resourceType = 'Bundle'; bundle.entry = []; - let runsLastSync = config.get('lastSync:syncFloipFlowResults:time'); + let runsLastSync + await mixin.getLastIndexingTime('syncFloipFlowResults', false).then((time) => { + runsLastSync = time + }).catch((time) => { + runsLastSync = moment('1970-01-01').format('Y-MM-DDTHH:mm:ss'); + }) const isValid = moment(runsLastSync, 'Y-MM-DD HH:mm:ss').isValid(); if (!isValid) { runsLastSync = moment('1970-01-01').format('Y-MM-DD HH:mm:ss'); diff --git a/server/lib/mixin.js b/server/lib/mixin.js index d778aa4..5b396ac 100644 --- a/server/lib/mixin.js +++ b/server/lib/mixin.js @@ -1,10 +1,147 @@ const fs = require('fs'); const medUtils = require('openhim-mediator-utils'); const request = require('request'); +const axios = require('axios'); +const URI = require('urijs'); const logger = require('./winston'); const config = require('./config'); const env = process.env.NODE_ENV || 'development'; +const updateLastIndexingTime = (time, syncType) => { + return new Promise((resolve, reject) => { + logger.info('Updating lastIndexingTime') + axios({ + url: URI(config.get("elastic:baseURL")).segment('emnuttsyncdata').segment("_doc").segment(syncType).toString(), + method: 'PUT', + auth: { + username: config.get("elastic:username"), + password: config.get("elastic:password") + }, + data: { + "lastIndexingTime": time + } + }).then((response) => { + if(response.status < 200 && response.status > 299) { + logger.error('An error occured while updating lastIndexingTime') + return reject() + } + return resolve(false) + }).catch((err) => { + logger.error(err) + logger.error('An error occured while updating lastIndexingTime') + return reject(true) + }) + }) +} + +const getLastIndexingTime = (syncType, reset) => { + return new Promise((resolve, reject) => { + logger.info('Getting lastIndexingTime') + let query = { + query: { + term: { + _id: syncType + } + } + } + axios({ + method: "GET", + url: URI(config.get("elastic:baseURL")).segment('emnuttsyncdata').segment("_search").toString(), + data: query, + auth: { + username: config.get("elastic:username"), + password: config.get("elastic:password") + } + }).then((response) => { + if(reset) { + logger.info('Returning lastIndexingTime of 1970-01-01T00:00:00') + return resolve('1970-01-01T00:00:00') + } + if(response.data.hits.hits.length === 0) { + logger.info('Returning lastIndexingTime of 1970-01-01T00:00:00') + return resolve('1970-01-01T00:00:00') + } + logger.info('Returning lastIndexingTime of ' + response.data.hits.hits[0]._source.lastIndexingTime) + return resolve(response.data.hits.hits[0]._source.lastIndexingTime) + }).catch((err) => { + if (err.response && err.response.status && err.response.status === 404) { + logger.info('Index not found, creating index syncData'); + let mappings = { + mappings: { + properties: { + lastIndexingTime: { + type: "text" + } + }, + }, + }; + axios({ + method: 'PUT', + url: URI(config.get("elastic:baseURL")).segment('emnuttsyncdata').toString(), + data: mappings, + auth: { + username: config.get("elastic:username"), + password: config.get("elastic:password") + } + }) + .then(response => { + if (response.status !== 200) { + logger.error('Something went wrong and index was not created'); + logger.error(response.data); + logger.info('Returning lastIndexingTime of 1970-01-01T00:00:00') + return reject() + } else { + logger.info('Index syncdata created successfully'); + logger.info('Adding default lastIndexTime which is 1970-01-01T00:00:00') + axios({ + method: 'PUT', + auth: { + username: config.get("elastic:username"), + password: config.get("elastic:password") + }, + url: URI(config.get("elastic:baseURL")).segment('emnuttsyncdata').segment("_doc").segment(syncType).toString(), + data: { + "lastIndexingTime": "1970-01-01T00:00:00" + } + }).then((response) => { + if(response.status >= 200 && response.status <= 299) { + logger.info('Default lastIndexTime added') + } else { + logger.error('An error has occured while saving default lastIndexTime'); + return reject("1970-01-01T00:00:00") + } + logger.info('Returning lastIndexingTime of 1970-01-01T00:00:00') + return resolve("1970-01-01T00:00:00") + }).catch((err) => { + logger.error('An error has occured while saving default lastIndexTime'); + if (err.response && err.response.data) { + logger.error(err.response.data); + } + if (err.error) { + logger.error(err.error); + } + if (!err.response) { + logger.error(err); + } + return reject("1970-01-01T00:00:00") + }) + } + }) + .catch(err => { + logger.error('Error: ' + err); + logger.info('Returning lastIndexingTime of 1970-01-01T00:00:00') + return reject("1970-01-01T00:00:00") + }); + } else { + logger.error('Error occured while getting last indexing time in ES'); + logger.error(err); + logger.info('Returning lastIndexingTime of 1970-01-01T00:00:00') + return reject("1970-01-01T00:00:00") + } + }) + }) +} + const setNestedKey = (obj, path, value, callback) => { if (path.length === 1) { obj[path] = value; @@ -130,6 +267,8 @@ const getNameFromResource = (resource) => { } module.exports = { + updateLastIndexingTime, + getLastIndexingTime, updateConfigFile, updateopenHIMConfig, updatePhoneNumber, diff --git a/server/lib/rapidpro.js b/server/lib/rapidpro.js index a49c605..5102f9d 100644 --- a/server/lib/rapidpro.js +++ b/server/lib/rapidpro.js @@ -21,9 +21,14 @@ module.exports = function () { * @param {Object} param0 * @param {*} callback */ - syncWorkflows(callback) { + async syncWorkflows(callback) { let processingError = false; - let runsLastSync = config.get('lastSync:syncWorkflows:time'); + let runsLastSync + await mixin.getLastIndexingTime('syncWorkflows', false).then((time) => { + runsLastSync = time + }).catch((time) => { + runsLastSync = moment('1970-01-01').format('Y-MM-DDTHH:mm:ss'); + }) const isValid = moment(runsLastSync, 'Y-MM-DDTHH:mm:ss').isValid(); if (!isValid) { runsLastSync = moment('1970-01-01').format('Y-MM-DDTHH:mm:ss'); @@ -47,8 +52,13 @@ module.exports = function () { } ); }, - syncWorkflowRunMessages(callback) { - let runsLastSync = moment('1970-01-01').format('Y-MM-DDTHH:mm:ss'); + async syncWorkflowRunMessages(callback) { + let runsLastSync + await mixin.getLastIndexingTime('syncWorkflowRunMessages', false).then((time) => { + runsLastSync = time + }).catch((time) => { + runsLastSync = moment('1970-01-01').format('Y-MM-DDTHH:mm:ss'); + }) let processingError = false; let runBundle = {}; runBundle.type = 'batch'; @@ -60,7 +70,6 @@ module.exports = function () { let nextRunURL = false async.doWhilst( (callback) => { - runsLastSync = config.get('lastSync:syncWorkflowRunMessages:time'); const isValid = moment(runsLastSync, 'Y-MM-DDTHH:mm:ss').isValid(); if (!isValid) { runsLastSync = moment('1970-01-01').format('Y-MM-DDTHH:mm:ss'); @@ -448,10 +457,15 @@ module.exports = function () { } }, - POSContactGroupsSync(callback) { + async POSContactGroupsSync(callback) { let failed = false; logger.info('Received a request to sync POS Contacts Groups'); - let runsLastSync = config.get('lastSync:syncContactsGroups:time'); + let runsLastSync + await mixin.getLastIndexingTime('syncContactsGroups', false).then((time) => { + runsLastSync = time + }).catch((time) => { + runsLastSync = moment('1970-01-01').format('Y-MM-DDTHH:mm:ss'); + }) const isValid = moment(runsLastSync, 'Y-MM-DD').isValid(); if (!isValid) { runsLastSync = moment('1970-01-01').format('Y-MM-DD'); @@ -635,8 +649,13 @@ module.exports = function () { }); }, - RPContactGroupsSync(callback) { - let runsLastSync = config.get('lastSync:syncContactsGroups:time'); + async RPContactGroupsSync(callback) { + let runsLastSync + await mixin.getLastIndexingTime('syncContactsGroups', false).then((time) => { + runsLastSync = time + }).catch((time) => { + runsLastSync = moment('1970-01-01').format('Y-MM-DDTHH:mm:ss'); + }) const isValid = moment(runsLastSync, 'Y-MM-DD').isValid(); if (!isValid) { runsLastSync = moment('1970-01-01').format('Y-MM-DD'); diff --git a/server/lib/routes/dataSync.js b/server/lib/routes/dataSync.js index f6dbf23..9f8de44 100644 --- a/server/lib/routes/dataSync.js +++ b/server/lib/routes/dataSync.js @@ -71,7 +71,7 @@ router.post('/syncContacts', (req, res) => { }); router.get('/syncContactsGroups', (req, res) => { - logger.info('Received a request to sync workflow messages'); + logger.info('Received a request to sync contacts groups'); dataSync.syncContactsGroups((error) => { if (error) { return res.status(500).send('Some errors occured'); diff --git a/server/package-lock.json b/server/package-lock.json index 5535b7a..0f50f45 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -5,11 +5,12 @@ "requires": true, "dependencies": { "@ahryman40k/ts-fhir-types": { - "version": "4.0.32", - "resolved": "https://registry.npmjs.org/@ahryman40k/ts-fhir-types/-/ts-fhir-types-4.0.32.tgz", - "integrity": "sha512-BDXzMJ7xb0umn0P0GpmpR+XdAq7Ws32C5lvIFDuYtgUp2SklrUiDPanx9ed8CrciFOB/cVMfMIp/hXMrDkF3Yg==", + "version": "4.0.34", + "resolved": "https://registry.npmjs.org/@ahryman40k/ts-fhir-types/-/ts-fhir-types-4.0.34.tgz", + "integrity": "sha512-G/o0wmYoqOfvgSids46U6ge767OjQfNkr8lUcqblZsLpOZF/xiXE46eXmfmnxzjYD2FvlpUQM4LxmK4f0feWkA==", "requires": { - "io-ts": "<2.0.0", + "fp-ts": "^2.8.3", + "io-ts": "^2.0.0", "reflect-metadata": "^0.1.13" } }, @@ -54,14 +55,13 @@ } }, "@lhncbc/ucum-lhc": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/@lhncbc/ucum-lhc/-/ucum-lhc-4.1.3.tgz", - "integrity": "sha512-F49BJBDr5lE+AkbyJVRE4b/cog3mP5xK+SlxSyztUk2Wzak5bX5vydQhdCmyRZupgtDQlFAvEr7TmIuUmNHH8g==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@lhncbc/ucum-lhc/-/ucum-lhc-4.1.4.tgz", + "integrity": "sha512-ErlXJv6lrerZbthxc33SWTKrZv4KjMIaCN2lNxsNrGZW4PqyVFEKDie6lok//SvC6QeEoAC1mWN8xD87r72qPQ==", "requires": { "csv-parse": "^4.4.6", "csv-stringify": "^1.0.4", "escape-html": "^1.0.3", - "grunt-extract-sourcemap": "^0.1.19", "is-integer": "^1.0.6", "jsonfile": "^2.2.3", "stream": "0.0.2", @@ -80,9 +80,9 @@ } }, "acorn": { - "version": "8.0.4", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.0.4.tgz", - "integrity": "sha512-XNP0PqF1XD19ZlLKvB7cMmnZswW4C/03pRHgirB30uSJTaS3A3V1/P4sS3HPvFmjoriPCJQs+JDSbm4bL1TxGQ==", + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.2.2.tgz", + "integrity": "sha512-VrMS8kxT0e7J1EX0p6rI/E0FbfOVcvBpbIqHThFv+f8YrZIlMfVotYcXKVPmTvPW8sW5miJzfUFrrvthUZg8VQ==", "dev": true }, "ajv": { @@ -97,9 +97,9 @@ } }, "antlr4": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/antlr4/-/antlr4-4.8.0.tgz", - "integrity": "sha512-en/MxQ4OkPgGJQ3wD/muzj1uDnFSzdFIhc2+c6bHZokWkuBb6RRvFjpWhPxWLbgQvaEzldJZ0GSQpfSAaE3hqg==" + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/antlr4/-/antlr4-4.9.2.tgz", + "integrity": "sha512-UjMSlenUORL+a+6g4RNZxRh5LcFWybRi2g0ASDBpgXBY6nlavg0BRVAVEQF0dz8jH6SyX3lV7uP5y/krJzc+Hw==" }, "argparse": { "version": "1.0.10", @@ -304,11 +304,6 @@ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, - "coffee-script": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.10.0.tgz", - "integrity": "sha1-EpOLz5vhlI+gBvkuDEyegXBRCMA=" - }, "color": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/color/-/color-3.0.0.tgz", @@ -422,14 +417,14 @@ } }, "cronstrue": { - "version": "1.105.0", - "resolved": "https://registry.npmjs.org/cronstrue/-/cronstrue-1.105.0.tgz", - "integrity": "sha512-Bv8GHi5uJvxtq/9T7lgBwum7UVKMfR+LSPHZXiezP0E5gnODPVRQBAkCwijCIaWEepqmRcxTAxrUFB0UQK2wdw==" + "version": "1.112.0", + "resolved": "https://registry.npmjs.org/cronstrue/-/cronstrue-1.112.0.tgz", + "integrity": "sha512-sVw7RKaOm4l3DRGeOXpdxDKL5qcFrKy9diZHob/kie14OYuOV3uCxAthb56OOf/M2u+FCYPiBMYhZuFibuxwMQ==" }, "csv-parse": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-4.14.1.tgz", - "integrity": "sha512-4wmcO7QbWtDAncGFaBwlWFPhEN4Akr64IbM4zvDwEOFekI8blLc04Nw7XjQjtSNy+3AUAgBgtUa9nWo5Cq89Xg==" + "version": "4.15.4", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-4.15.4.tgz", + "integrity": "sha512-OdBbFc0yZhOm17lSxqkirrHlFFVpKRT0wp4DAGoJelsP3LbGzV9LNr7XmM/lrr0uGkCtaqac9UhP8PDHXOAbMg==" }, "csv-stringify": { "version": "1.1.2", @@ -647,9 +642,9 @@ } }, "eslint-plugin-promise": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz", - "integrity": "sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.3.1.tgz", + "integrity": "sha512-bY2sGqyptzFBDLh/GMbAxfdJC+b0f23ME63FOE4+Jao0oZ3E1LEwFtWJX/1pGMJLiTtrSSern2CRM/g+dfc0eQ==", "dev": true }, "eslint-plugin-standard": { @@ -751,9 +746,9 @@ "integrity": "sha512-aN3pcx/DSmtyoovUudctc8+6Hl4T+hI9GBBHLjA76jdZl7+b1sgh5g4k+u/GL3dTy1/pnYzKp69FpJ0OicE3Wg==" }, "fhir": { - "version": "4.7.11", - "resolved": "https://registry.npmjs.org/fhir/-/fhir-4.7.11.tgz", - "integrity": "sha512-60TtFbwGZcpkdpCmysTSGgmL8IujKH8AoNMz/BlhBQjx0UXtvbSlxsrzi9Q0SRDxhO3LehO3eWbprKYKpbiwEw==", + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/fhir/-/fhir-4.8.2.tgz", + "integrity": "sha512-4F29bMxILAxrFaSYMsmCaJ8NcUYfzqMhzCnYJCSYVWctNbf5I7KSXhRBsCkrHUoz7rcFMfuL4gSAziF1Qcz2hQ==", "requires": { "lodash": "^4.17.19", "path": "^0.12.7", @@ -807,44 +802,52 @@ } }, "fhir2es": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/fhir2es/-/fhir2es-2.1.1.tgz", - "integrity": "sha512-jiG9O5PKwSoDpBmjKf+ZXoEYelB0SAD6GBAl1Xc7cPok7y8GOLOQFw7aXcQjefm3Z7VpBSCUj4Ltxf8D8RXgfQ==", + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/fhir2es/-/fhir2es-3.0.12.tgz", + "integrity": "sha512-3n3oOyz1TDw1NNH4TWbjcYHcWkuSJnc/RZbMjZMCEQUyoYTFRAgilX9EsRW+cyVe7TqCkubJTGRc2eeO68OfVw==", "requires": { "async": "^3.2.0", - "axios": "^0.19.2", + "axios": "^0.21.1", "fhir": "^4.7.3", "fhirpath": "^2.6.2", "lodash": "^4.17.15", - "moment": "^2.27.0", + "moment": "^2.29.0", "urijs": "^1.19.2", "winston": "^3.3.3" }, "dependencies": { - "fhirpath": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/fhirpath/-/fhirpath-2.7.1.tgz", - "integrity": "sha512-O7xIrtt3lY7aA0y+i9uJQWvVFWMph3z5ErG6gFI6HxXk+sxou80g1GtjbgawKvDDXGKUu8RPlp9LqrLkzdvp1g==", + "axios": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", "requires": { - "@lhncbc/ucum-lhc": "^4.1.3", - "antlr4": "^4.7.1", - "commander": "^2.18.0", - "date-fns": "^1.30.1", - "js-yaml": "^3.13.1" + "follow-redirects": "^1.10.0" } + }, + "follow-redirects": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.0.tgz", + "integrity": "sha512-0vRwd7RKQBTt+mgu87mtYeofLFZpTas2S9zY+jIeuLJMNvudIgF52nr19q40HOwH5RrhWIPuj9puybzSJiRrVg==" } } }, "fhirpath": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/fhirpath/-/fhirpath-2.7.1.tgz", - "integrity": "sha512-O7xIrtt3lY7aA0y+i9uJQWvVFWMph3z5ErG6gFI6HxXk+sxou80g1GtjbgawKvDDXGKUu8RPlp9LqrLkzdvp1g==", + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/fhirpath/-/fhirpath-2.7.4.tgz", + "integrity": "sha512-2HJV29akZcej1fjvNmYUfb1chKQdTakI7tJdd96Y71fCBxG3QS5Y1bdEJqyrYzDmzWEN3RE85fLHdKg2VpS4yA==", "requires": { "@lhncbc/ucum-lhc": "^4.1.3", - "antlr4": "^4.7.1", + "antlr4": "~4.8.0", "commander": "^2.18.0", "date-fns": "^1.30.1", "js-yaml": "^3.13.1" + }, + "dependencies": { + "antlr4": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/antlr4/-/antlr4-4.8.0.tgz", + "integrity": "sha512-en/MxQ4OkPgGJQ3wD/muzj1uDnFSzdFIhc2+c6bHZokWkuBb6RRvFjpWhPxWLbgQvaEzldJZ0GSQpfSAaE3hqg==" + } } }, "file-stream-rotator": { @@ -918,9 +921,9 @@ "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" }, "fp-ts": { - "version": "1.19.5", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.5.tgz", - "integrity": "sha512-wDNqTimnzs8QqpldiId9OavWK2NptormjXnRJTQecNjzwfyp6P/8s/zG8e4h3ja3oqkKaY72UlTjQYt/1yXf9A==" + "version": "2.10.5", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.10.5.tgz", + "integrity": "sha512-X2KfTIV0cxIk3d7/2Pvp/pxL/xr2MV1WooyEzKtTWYSc1+52VF4YzjBTXqeOlSiZsPCxIBpDGfT9Dyo7WEY0DQ==" }, "fresh": { "version": "0.5.2", @@ -951,20 +954,11 @@ } }, "graceful-fs": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", "optional": true }, - "grunt-extract-sourcemap": { - "version": "0.1.19", - "resolved": "https://registry.npmjs.org/grunt-extract-sourcemap/-/grunt-extract-sourcemap-0.1.19.tgz", - "integrity": "sha1-vUYwEl1Wh1x8s7cAA8owE3JFppI=", - "requires": { - "coffee-script": "~1.10.0", - "lazy.js": "~0.4.2" - } - }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -1038,12 +1032,9 @@ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" }, "io-ts": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-1.10.4.tgz", - "integrity": "sha512-b23PteSnYXSONJ6JQXRAlvJhuw8KOtkqa87W4wDtvMrud/DTJd5X+NpOOI+O/zZwVq6v0VLAaJ+1EDViKEuN9g==", - "requires": { - "fp-ts": "^1.0.0" - } + "version": "2.2.16", + "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.2.16.tgz", + "integrity": "sha512-y5TTSa6VP6le0hhmIyN0dqEXkrZeJLeC5KApJq6VLci3UEKF80lZ+KuoUs02RhBxNWlrqSNxzfI7otLX1Euv8Q==" }, "ipaddr.js": { "version": "1.9.0", @@ -1135,9 +1126,9 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, "js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -1214,11 +1205,6 @@ "language-subtag-registry": "~0.3.2" } }, - "lazy.js": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.4.3.tgz", - "integrity": "sha1-h/Z6B602VVEh5P/xUg3zG+Znhtg=" - }, "lcid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", @@ -1228,15 +1214,25 @@ } }, "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" }, + "lodash.times": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/lodash.times/-/lodash.times-4.3.2.tgz", + "integrity": "sha1-Ph8lZcQxdU1Uq1fy7RdBk5KFyh0=" + }, + "lodash.zip": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz", + "integrity": "sha1-7GZi5IlkCO1KtsVCo5kLcswIACA=" + }, "logform": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/logform/-/logform-2.2.0.tgz", @@ -1372,9 +1368,9 @@ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, "object-hash": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.0.3.tgz", - "integrity": "sha512-JPKn0GMu+Fa3zt3Bmr66JhokJU5BaNBIh4ZeTlaCBzrBsOeXzwcKKAK1tbLiPKgvwmPXsDvvLHoWh5Bm7ofIYg==" + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.1.1.tgz", + "integrity": "sha512-VOJmgmS+7wvXf8CjbQmimtCnEx3IAoLxI3fp2fbWehxrWBcAQFbk+vcwb6vzR0VZv/eNCJ/27j151ZTwqW/JeQ==" }, "object-inspect": { "version": "1.8.0", @@ -1533,20 +1529,20 @@ } }, "redis": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/redis/-/redis-3.0.2.tgz", - "integrity": "sha512-PNhLCrjU6vKVuMOyFu7oSP296mwBkcE6lrAjruBYG5LgdSqtRBoVQIylrMyVZD/lkF24RSNNatzvYag6HRBHjQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/redis/-/redis-3.1.2.tgz", + "integrity": "sha512-grn5KoZLr/qrRQVwoSkmzdbw6pwF+/rwODtrOr6vuBRiR/f3rjSTGupbF90Zpqm2oenix8Do6RV7pYEkGwlKkw==", "requires": { - "denque": "^1.4.1", - "redis-commands": "^1.5.0", + "denque": "^1.5.0", + "redis-commands": "^1.7.0", "redis-errors": "^1.2.0", "redis-parser": "^3.0.0" } }, "redis-commands": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.6.0.tgz", - "integrity": "sha512-2jnZ0IkjZxvguITjFTrGiLyzQZcTvaw8DAaCXxZq/dsHXz7KfMQ3OUJy7Tz9vnRtZRVz6VRCPDvruvU8Ts44wQ==" + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz", + "integrity": "sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ==" }, "redis-errors": { "version": "1.2.0", @@ -1710,19 +1706,15 @@ } }, "sparkson": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/sparkson/-/sparkson-1.3.4.tgz", - "integrity": "sha512-sPG6Y9ajyeEbGVGYAcm8b+2wsqAMzg3qcMSIwYsNWDhE/mPW5sDN9owMGPARBz65ObGso19074uaZI9dj+QAgw==", + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/sparkson/-/sparkson-1.3.6.tgz", + "integrity": "sha512-hn75TVt4lHgVIe367YZqrprYrsVDb9DHzBbFLeDH3U0BqOH47jL6X0OzkqtcQ16G0gJn8D69Ev4Vnj/rvxNV4g==", "requires": { - "lodash": "4.17.4", + "lodash.times": "4.3.2", + "lodash.zip": "4.2.0", "reflect-metadata": "0.1.12" }, "dependencies": { - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" - }, "reflect-metadata": { "version": "0.1.12", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.12.tgz", @@ -1915,9 +1907,9 @@ } }, "urijs": { - "version": "1.19.2", - "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.2.tgz", - "integrity": "sha512-s/UIq9ap4JPZ7H1EB5ULo/aOUbWqfDi7FKzMC2Nz+0Si8GiT1rIEaprt8hy3Vy2Ex2aJPpOQv4P4DuOZ+K1c6w==" + "version": "1.19.6", + "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.6.tgz", + "integrity": "sha512-eSXsXZ2jLvGWeLYlQA3Gh36BcjF+0amo92+wHPyN1mdR8Nxf75fuEuYTd9c0a+m/vhCjRK0ESlE9YNLW+E1VEw==" }, "util-deprecate": { "version": "1.0.2", @@ -1971,14 +1963,47 @@ } }, "winston-daily-rotate-file": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/winston-daily-rotate-file/-/winston-daily-rotate-file-4.5.0.tgz", - "integrity": "sha512-/HqeWiU48dzGqcrABRlxYWVMdL6l3uKCtFSJyrqK+E2rLnSFNsgYpvwx15EgTitBLNzH69lQd/+z2ASryV2aqw==", + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/winston-daily-rotate-file/-/winston-daily-rotate-file-4.5.3.tgz", + "integrity": "sha512-/V0wWnxK6RviPIKJ4ZNgBxj2BMHWHMvaBpUsY4wietLsdmoUS77w+XXtAZ2ed44FxaD3n3K8XE2r0J6527uHkw==", "requires": { "file-stream-rotator": "^0.5.7", "object-hash": "^2.0.1", "triple-beam": "^1.3.0", - "winston-transport": "^4.2.0" + "winston-transport": "github:winstonjs/winston-transport#868d657" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "winston-transport": { + "version": "github:winstonjs/winston-transport#868d6577956f82ee0b021b119a4de938c61645f7", + "from": "github:winstonjs/winston-transport#868d657", + "requires": { + "logform": "^2.2.0", + "readable-stream": "^2.3.7", + "triple-beam": "^1.2.0" + } + } } }, "winston-transport": { diff --git a/server/package.json b/server/package.json index 280f9be..b3fd5d5 100644 --- a/server/package.json +++ b/server/package.json @@ -10,37 +10,37 @@ "license": "ISC", "dependencies": { "@floip/flow-results-utils": "^1.0.5", - "antlr4": "^4.8.0", - "uuid": "3.4.0", + "antlr4": "^4.9.2", "async": "^3.2.0", "axios": "^0.19.2", "cors": "^2.8.5", - "cronstrue": "^1.105.0", + "cronstrue": "^1.112.0", "eslint-plugin-jsx-a11y": "^6.4.1", "express": "^4.17.1", - "fhir": "^4.7.11", + "fhir": "^4.8.2", "fhir2es": ">3.0.0", - "fhirpath": "^2.7.1", + "fhirpath": "^2.7.4", "formidable": "^1.2.2", "is-json": "^2.0.1", - "lodash": "^4.17.20", + "lodash": "^4.17.21", "moment": "^2.29.1", "nconf": "^0.10.0", "node-cron": "^2.0.3", "openhim-mediator-utils": "^0.2.3", - "redis": "^3.0.2", + "redis": "^3.1.2", "request": "^2.88.2", "request-promise-native": "^1.0.9", - "urijs": "^1.19.2", + "urijs": "^1.19.6", + "uuid": "3.4.0", "winston": "^3.3.3", - "winston-daily-rotate-file": "^4.5.0" + "winston-daily-rotate-file": "^4.5.3" }, "devDependencies": { - "acorn": "^8.0.4", + "acorn": "^8.2.2", "eslint-config-airbnb-base": "^14.2.1", "eslint-config-standard": "^14.1.1", "eslint-plugin-node": "^10.0.0", - "eslint-plugin-promise": "^4.2.1", + "eslint-plugin-promise": "^4.3.1", "eslint-plugin-standard": "^4.1.0", "minimist": ">=1.2.2" }