diff --git a/example/cds-hooks-api-guide/package-lock.json b/example/cds-hooks-api-guide/package-lock.json index 0e5ddd3..8ee8c87 100644 --- a/example/cds-hooks-api-guide/package-lock.json +++ b/example/cds-hooks-api-guide/package-lock.json @@ -5,10 +5,12 @@ "requires": true, "packages": { "": { + "name": "cds-hooks-api-guide", "version": "1.0.0", "license": "ISC", "dependencies": { - "@sero.run/sero": "0.0.17" + "@sero.run/sero": "^0.0.19", + "fastify": "^3.21.6" } }, "node_modules/@babel/runtime": { @@ -30,6 +32,42 @@ "ajv": "^6.12.6" } }, + "node_modules/@hapi/boom": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz", + "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==", + "dependencies": { + "@hapi/hoek": "9.x.x" + } + }, + "node_modules/@hapi/bourne": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-2.0.0.tgz", + "integrity": "sha512-WEezM1FWztfbzqIUbsDzFRVMxSoLy3HugVcux6KDDtTqzPsLE8NDRHfXvev66aH1i2oOKKar3/XDjbvh/OUBdg==" + }, + "node_modules/@hapi/hoek": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz", + "integrity": "sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==" + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@hapi/wreck": { + "version": "17.1.0", + "resolved": "https://registry.npmjs.org/@hapi/wreck/-/wreck-17.1.0.tgz", + "integrity": "sha512-nx6sFyfqOpJ+EFrHX+XWwJAxs3ju4iHdbB/bwR8yTNZOiYmuhA8eCe7lYPtYmb4j7vyK/SlbaQsmTtUrMvPEBw==", + "dependencies": { + "@hapi/boom": "9.x.x", + "@hapi/bourne": "2.x.x", + "@hapi/hoek": "9.x.x" + } + }, "node_modules/@reduxjs/toolkit": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.6.1.tgz", @@ -54,18 +92,38 @@ } }, "node_modules/@sero.run/sero": { - "version": "0.0.17", - "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.17.tgz", - "integrity": "sha512-fu652LrbBe1tzgximV6AQBVgK1oFqRfnYmR10mwzV+WfdKeSeTi+g4hmWrbAYBkfsCqgYzTOwUdlAtzQ5ispKw==", + "version": "0.0.19", + "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.19.tgz", + "integrity": "sha512-Bz1PMolkshpkfuR281AmoishLxHcAUOeg0hyIm6ZfJhHS0Ny4RaeRt/bUN0ftqv8Ko2pJDMhgO/4NivR+pRO1A==", "dependencies": { "@reduxjs/toolkit": "^1.6.1", "cross-fetch": "^3.1.4", - "fastify": "^3.18.0" + "fastify": "^3.18.0", + "fastify-plugin": "^3.0.0", + "simple-oauth2": "^4.2.0" }, "engines": { "node": ">=14.17" } }, + "node_modules/@sideway/address": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz", + "integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, "node_modules/abstract-logging": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/abstract-logging/-/abstract-logging-2.0.1.tgz", @@ -193,9 +251,9 @@ "integrity": "sha512-lXatBjf3WPjmWD6DpIZxkeSsCOwqI0maYMpgDlx8g4U2qi4lbjA9oH/HD2a87G+KfsUmo5WbJFmqBZlPxtptag==" }, "node_modules/fastify": { - "version": "3.20.2", - "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.20.2.tgz", - "integrity": "sha512-POvayPpbyvkE/wHQquQsNwIgYKVRz7HhCXYJyzUuWEN3kch7/QeI+/azQCjS6+XHiHZPWQwrBKjJB9FBdJHrgA==", + "version": "3.21.6", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.21.6.tgz", + "integrity": "sha512-PextZFavEZaqn2ZYbVGBPAI0AiElnVdfqo9sN1wlOi0mhGtYuec4KT82MHe5npCf3Lz++6i7jLl7YKyYidPrMg==", "dependencies": { "@fastify/ajv-compiler": "^1.0.0", "abstract-logging": "^2.0.0", @@ -220,6 +278,11 @@ "resolved": "https://registry.npmjs.org/fastify-error/-/fastify-error-0.3.1.tgz", "integrity": "sha512-oCfpcsDndgnDVgiI7bwFKAun2dO+4h84vBlkWsWnz/OUK9Reff5UFoFl241xTiLeHWX/vU9zkDVXqYUxjOwHcQ==" }, + "node_modules/fastify-plugin": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.0.tgz", + "integrity": "sha512-ZdCvKEEd92DNLps5n0v231Bha8bkz1DjnPP/aEz37rz/q42Z5JVLmgnqR4DYuNn3NXAO3IDCPyRvgvxtJ4Ym4w==" + }, "node_modules/fastify-warning": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/fastify-warning/-/fastify-warning-0.2.0.tgz", @@ -282,6 +345,18 @@ "node": ">= 0.10" } }, + "node_modules/joi": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.2.tgz", + "integrity": "sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==", + "dependencies": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -531,6 +606,17 @@ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz", "integrity": "sha512-edRH8mBKEWNVIVMKejNnuJxleqYE/ZSdcT8/Nem9/mmosx12pctd80s2Oy00KNZzrogMZS5mauK2/ymL1bvlvg==" }, + "node_modules/simple-oauth2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/simple-oauth2/-/simple-oauth2-4.2.0.tgz", + "integrity": "sha512-AV62tGdq9JfLd/uveKpeNtQl+VVm89a35QKlwGuvisYIjCoz2ZmTGRGuSIGiYr+QUhSKJ5kYN1jq2BBa/ac/GQ==", + "dependencies": { + "@hapi/hoek": "^9.0.4", + "@hapi/wreck": "^17.0.0", + "debug": "^4.1.1", + "joi": "^17.3.0" + } + }, "node_modules/sonic-boom": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", @@ -597,6 +683,42 @@ "ajv": "^6.12.6" } }, + "@hapi/boom": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz", + "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==", + "requires": { + "@hapi/hoek": "9.x.x" + } + }, + "@hapi/bourne": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-2.0.0.tgz", + "integrity": "sha512-WEezM1FWztfbzqIUbsDzFRVMxSoLy3HugVcux6KDDtTqzPsLE8NDRHfXvev66aH1i2oOKKar3/XDjbvh/OUBdg==" + }, + "@hapi/hoek": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz", + "integrity": "sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==" + }, + "@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@hapi/wreck": { + "version": "17.1.0", + "resolved": "https://registry.npmjs.org/@hapi/wreck/-/wreck-17.1.0.tgz", + "integrity": "sha512-nx6sFyfqOpJ+EFrHX+XWwJAxs3ju4iHdbB/bwR8yTNZOiYmuhA8eCe7lYPtYmb4j7vyK/SlbaQsmTtUrMvPEBw==", + "requires": { + "@hapi/boom": "9.x.x", + "@hapi/bourne": "2.x.x", + "@hapi/hoek": "9.x.x" + } + }, "@reduxjs/toolkit": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.6.1.tgz", @@ -609,15 +731,35 @@ } }, "@sero.run/sero": { - "version": "0.0.17", - "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.17.tgz", - "integrity": "sha512-fu652LrbBe1tzgximV6AQBVgK1oFqRfnYmR10mwzV+WfdKeSeTi+g4hmWrbAYBkfsCqgYzTOwUdlAtzQ5ispKw==", + "version": "0.0.19", + "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.19.tgz", + "integrity": "sha512-Bz1PMolkshpkfuR281AmoishLxHcAUOeg0hyIm6ZfJhHS0Ny4RaeRt/bUN0ftqv8Ko2pJDMhgO/4NivR+pRO1A==", "requires": { "@reduxjs/toolkit": "^1.6.1", "cross-fetch": "^3.1.4", - "fastify": "^3.18.0" + "fastify": "^3.18.0", + "fastify-plugin": "^3.0.0", + "simple-oauth2": "^4.2.0" } }, + "@sideway/address": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz", + "integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@sideway/formula": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" + }, + "@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, "abstract-logging": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/abstract-logging/-/abstract-logging-2.0.1.tgz", @@ -718,9 +860,9 @@ "integrity": "sha512-lXatBjf3WPjmWD6DpIZxkeSsCOwqI0maYMpgDlx8g4U2qi4lbjA9oH/HD2a87G+KfsUmo5WbJFmqBZlPxtptag==" }, "fastify": { - "version": "3.20.2", - "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.20.2.tgz", - "integrity": "sha512-POvayPpbyvkE/wHQquQsNwIgYKVRz7HhCXYJyzUuWEN3kch7/QeI+/azQCjS6+XHiHZPWQwrBKjJB9FBdJHrgA==", + "version": "3.21.6", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.21.6.tgz", + "integrity": "sha512-PextZFavEZaqn2ZYbVGBPAI0AiElnVdfqo9sN1wlOi0mhGtYuec4KT82MHe5npCf3Lz++6i7jLl7YKyYidPrMg==", "requires": { "@fastify/ajv-compiler": "^1.0.0", "abstract-logging": "^2.0.0", @@ -745,6 +887,11 @@ "resolved": "https://registry.npmjs.org/fastify-error/-/fastify-error-0.3.1.tgz", "integrity": "sha512-oCfpcsDndgnDVgiI7bwFKAun2dO+4h84vBlkWsWnz/OUK9Reff5UFoFl241xTiLeHWX/vU9zkDVXqYUxjOwHcQ==" }, + "fastify-plugin": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.0.tgz", + "integrity": "sha512-ZdCvKEEd92DNLps5n0v231Bha8bkz1DjnPP/aEz37rz/q42Z5JVLmgnqR4DYuNn3NXAO3IDCPyRvgvxtJ4Ym4w==" + }, "fastify-warning": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/fastify-warning/-/fastify-warning-0.2.0.tgz", @@ -794,6 +941,18 @@ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, + "joi": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.2.tgz", + "integrity": "sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==", + "requires": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -979,6 +1138,17 @@ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz", "integrity": "sha512-edRH8mBKEWNVIVMKejNnuJxleqYE/ZSdcT8/Nem9/mmosx12pctd80s2Oy00KNZzrogMZS5mauK2/ymL1bvlvg==" }, + "simple-oauth2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/simple-oauth2/-/simple-oauth2-4.2.0.tgz", + "integrity": "sha512-AV62tGdq9JfLd/uveKpeNtQl+VVm89a35QKlwGuvisYIjCoz2ZmTGRGuSIGiYr+QUhSKJ5kYN1jq2BBa/ac/GQ==", + "requires": { + "@hapi/hoek": "^9.0.4", + "@hapi/wreck": "^17.0.0", + "debug": "^4.1.1", + "joi": "^17.3.0" + } + }, "sonic-boom": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", diff --git a/example/cds-hooks-api-guide/package.json b/example/cds-hooks-api-guide/package.json index 58fac20..488b128 100644 --- a/example/cds-hooks-api-guide/package.json +++ b/example/cds-hooks-api-guide/package.json @@ -10,7 +10,8 @@ "author": "", "license": "ISC", "dependencies": { - "@sero.run/sero": "0.0.17" + "@sero.run/sero": "^0.0.19", + "fastify": "^3.21.6" }, "type": "module" } diff --git a/example/cds-hooks-api-guide/src/current-time/current-time.js b/example/cds-hooks-api-guide/src/current-time/current-time.js index fb35cda..36f83d2 100644 --- a/example/cds-hooks-api-guide/src/current-time/current-time.js +++ b/example/cds-hooks-api-guide/src/current-time/current-time.js @@ -1,4 +1,4 @@ -import { Service, Card } from "@sero.run/sero"; +import { CDSService, CDSCard } from "@sero.run/sero"; const options = { id: "get-current-time", @@ -16,7 +16,7 @@ const handler = async () => { }${minutes}:${today.getSeconds()}`; return { cards: [ - new Card({ + new CDSCard({ source: { label: "Automate Medical, Inc.", url: "https://www.automatemedical.com/", @@ -29,4 +29,4 @@ const handler = async () => { }; }; -export default new Service(options, handler); +export default new CDSService(options, handler); diff --git a/example/cds-hooks-api-guide/src/index.js b/example/cds-hooks-api-guide/src/index.js index 209e7e1..f6b6755 100644 --- a/example/cds-hooks-api-guide/src/index.js +++ b/example/cds-hooks-api-guide/src/index.js @@ -1,16 +1,23 @@ -import { Http, CDSHooks, start } from "@sero.run/sero"; +import { CDSHooks } from "@sero.run/sero"; +import Fastify from "fastify"; import compareTimeService from "./current-time/current-time.js"; import prefetchContext from "./prefetch-context/prefetch-context.js"; import suggestionsLinksFhir from "./suggestions-links-fhir/suggestions-links-fhir.js"; const config = { - cdsHooks: { - services: [compareTimeService, prefetchContext, suggestionsLinksFhir], - cors: true, - }, + services: [compareTimeService, prefetchContext, suggestionsLinksFhir], + cors: true, }; -const http = Http(config); -CDSHooks(config, http); -start(http); +const fastify = Fastify({ + logger: true, +}); + +fastify.register(CDSHooks, config); +fastify.listen(8080, (err) => { + if (err) { + fastify.log.error(err); + process.exit(1); + } +}); diff --git a/example/cds-hooks-api-guide/src/prefetch-context/prefetch-context.js b/example/cds-hooks-api-guide/src/prefetch-context/prefetch-context.js index 333ef2f..9b4ef42 100644 --- a/example/cds-hooks-api-guide/src/prefetch-context/prefetch-context.js +++ b/example/cds-hooks-api-guide/src/prefetch-context/prefetch-context.js @@ -1,4 +1,4 @@ -import { Service, Card } from "@sero.run/sero"; +import { CDSService, CDSCard } from "@sero.run/sero"; import { processAddresses, processPatientNames, @@ -29,7 +29,7 @@ const handler = async (request) => { return { cards: [ // Name(s) - new Card({ + new CDSCard({ detail: `This patient has ${patientNames.length} name${ patientNames.length ? "s" : "" } on record.`, @@ -41,7 +41,7 @@ const handler = async (request) => { indicator: "info", }), // DOB - new Card({ + new CDSCard({ source: { label: "Automate Medical, Inc.", url: "https://www.automatemedical.com/", @@ -50,7 +50,7 @@ const handler = async (request) => { indicator: "info", }), // Active - new Card({ + new CDSCard({ detail: data.patient.active ? "Yes" : "No", source: { label: "Automate Medical, Inc.", @@ -60,7 +60,7 @@ const handler = async (request) => { indicator: "info", }), // Address - new Card({ + new CDSCard({ detail: `${addresses[0].line}, ${addresses[0].city}, ${addresses[0].state} ${addresses[0].postalCode}`, source: { label: "Automate Medical, Inc.", @@ -70,7 +70,7 @@ const handler = async (request) => { indicator: "info", }), // Gender - new Card({ + new CDSCard({ detail: `${data.patient.gender}`, source: { label: "Automate Medical, Inc.", @@ -80,7 +80,7 @@ const handler = async (request) => { indicator: "info", }), // Telecom (only pulls value of first element in array) - new Card({ + new CDSCard({ detail: `${telecom[0].value}`, source: { label: "Automate Medical, Inc.", @@ -90,7 +90,7 @@ const handler = async (request) => { indicator: "info", }), // Information on the last encounter - new Card({ + new CDSCard({ detail: `Last visit was on ${ encounters.pop().resource.period.start }. There are ${encounters.length} encounter${ @@ -104,7 +104,7 @@ const handler = async (request) => { indicator: "info", }), // Seeing the last encounter information - new Card({ + new CDSCard({ detail: `Make a new appointment? ${ newApp[0] ? "Yes" : "No" }, last appointment was ${newApp[1]} day${newApp[1] ? "s" : ""} ago.`, @@ -119,4 +119,4 @@ const handler = async (request) => { }; }; -export default new Service(options, handler); +export default new CDSService(options, handler); diff --git a/example/cds-hooks-api-guide/src/suggestions-links-fhir/suggestions-links-fhir.js b/example/cds-hooks-api-guide/src/suggestions-links-fhir/suggestions-links-fhir.js index f5ae809..92a841b 100644 --- a/example/cds-hooks-api-guide/src/suggestions-links-fhir/suggestions-links-fhir.js +++ b/example/cds-hooks-api-guide/src/suggestions-links-fhir/suggestions-links-fhir.js @@ -1,6 +1,6 @@ /* eslint-disable indent */ -import { Service, Card } from "@sero.run/sero"; +import { CDSService, CDSCard } from "@sero.run/sero"; import { reynoldsRiskScore, getAge, @@ -55,7 +55,7 @@ const handler = async (request) => { * This assumes that the reynolds risk score card will be sent every time */ let cards = [ - new Card({ + new CDSCard({ detail: `More information on this score:`, source: { label: "Reynold's Risk Score", @@ -77,7 +77,7 @@ const handler = async (request) => { */ if (riskScore[1] === "warning" || riskScore[1] === "critical") { cards.push( - new Card({ + new CDSCard({ detail: `This patient has a ${riskThresholdString} risk of cardiovascular disease over the next 10 years. ${ riskScore[1] === "warning" ? "Consider prescribing an anti-inflammatory like aspirin." @@ -128,4 +128,4 @@ const handler = async (request) => { }; }; -export default new Service(options, handler); +export default new CDSService(options, handler); diff --git a/example/connectathon-cds-hooks/package-lock.json b/example/connectathon-cds-hooks/package-lock.json index f5172cb..a5ac47b 100644 --- a/example/connectathon-cds-hooks/package-lock.json +++ b/example/connectathon-cds-hooks/package-lock.json @@ -9,7 +9,8 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@sero.run/sero": "^0.0.17" + "@sero.run/sero": "^0.0.19", + "fastify": "^3.21.6" } }, "node_modules/@babel/runtime": { @@ -31,6 +32,42 @@ "ajv": "^6.12.6" } }, + "node_modules/@hapi/boom": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz", + "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==", + "dependencies": { + "@hapi/hoek": "9.x.x" + } + }, + "node_modules/@hapi/bourne": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-2.0.0.tgz", + "integrity": "sha512-WEezM1FWztfbzqIUbsDzFRVMxSoLy3HugVcux6KDDtTqzPsLE8NDRHfXvev66aH1i2oOKKar3/XDjbvh/OUBdg==" + }, + "node_modules/@hapi/hoek": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz", + "integrity": "sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==" + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@hapi/wreck": { + "version": "17.1.0", + "resolved": "https://registry.npmjs.org/@hapi/wreck/-/wreck-17.1.0.tgz", + "integrity": "sha512-nx6sFyfqOpJ+EFrHX+XWwJAxs3ju4iHdbB/bwR8yTNZOiYmuhA8eCe7lYPtYmb4j7vyK/SlbaQsmTtUrMvPEBw==", + "dependencies": { + "@hapi/boom": "9.x.x", + "@hapi/bourne": "2.x.x", + "@hapi/hoek": "9.x.x" + } + }, "node_modules/@reduxjs/toolkit": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.6.1.tgz", @@ -55,18 +92,38 @@ } }, "node_modules/@sero.run/sero": { - "version": "0.0.17", - "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.17.tgz", - "integrity": "sha512-fu652LrbBe1tzgximV6AQBVgK1oFqRfnYmR10mwzV+WfdKeSeTi+g4hmWrbAYBkfsCqgYzTOwUdlAtzQ5ispKw==", + "version": "0.0.19", + "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.19.tgz", + "integrity": "sha512-Bz1PMolkshpkfuR281AmoishLxHcAUOeg0hyIm6ZfJhHS0Ny4RaeRt/bUN0ftqv8Ko2pJDMhgO/4NivR+pRO1A==", "dependencies": { "@reduxjs/toolkit": "^1.6.1", "cross-fetch": "^3.1.4", - "fastify": "^3.18.0" + "fastify": "^3.18.0", + "fastify-plugin": "^3.0.0", + "simple-oauth2": "^4.2.0" }, "engines": { "node": ">=14.17" } }, + "node_modules/@sideway/address": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz", + "integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, "node_modules/abstract-logging": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/abstract-logging/-/abstract-logging-2.0.1.tgz", @@ -194,9 +251,9 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" }, "node_modules/fastify": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.21.0.tgz", - "integrity": "sha512-hc9p0meCV8PXIQzg8BwXekhCmJm5LHfeJi7U3mKQTMu7pQT24CL756jUxM9sOLEbBpQoD82PejVPW2lfLiXJsw==", + "version": "3.21.6", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.21.6.tgz", + "integrity": "sha512-PextZFavEZaqn2ZYbVGBPAI0AiElnVdfqo9sN1wlOi0mhGtYuec4KT82MHe5npCf3Lz++6i7jLl7YKyYidPrMg==", "dependencies": { "@fastify/ajv-compiler": "^1.0.0", "abstract-logging": "^2.0.0", @@ -221,6 +278,11 @@ "resolved": "https://registry.npmjs.org/fastify-error/-/fastify-error-0.3.1.tgz", "integrity": "sha512-oCfpcsDndgnDVgiI7bwFKAun2dO+4h84vBlkWsWnz/OUK9Reff5UFoFl241xTiLeHWX/vU9zkDVXqYUxjOwHcQ==" }, + "node_modules/fastify-plugin": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.0.tgz", + "integrity": "sha512-ZdCvKEEd92DNLps5n0v231Bha8bkz1DjnPP/aEz37rz/q42Z5JVLmgnqR4DYuNn3NXAO3IDCPyRvgvxtJ4Ym4w==" + }, "node_modules/fastify-warning": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/fastify-warning/-/fastify-warning-0.2.0.tgz", @@ -283,6 +345,18 @@ "node": ">= 0.10" } }, + "node_modules/joi": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.2.tgz", + "integrity": "sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==", + "dependencies": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -532,6 +606,17 @@ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz", "integrity": "sha512-edRH8mBKEWNVIVMKejNnuJxleqYE/ZSdcT8/Nem9/mmosx12pctd80s2Oy00KNZzrogMZS5mauK2/ymL1bvlvg==" }, + "node_modules/simple-oauth2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/simple-oauth2/-/simple-oauth2-4.2.0.tgz", + "integrity": "sha512-AV62tGdq9JfLd/uveKpeNtQl+VVm89a35QKlwGuvisYIjCoz2ZmTGRGuSIGiYr+QUhSKJ5kYN1jq2BBa/ac/GQ==", + "dependencies": { + "@hapi/hoek": "^9.0.4", + "@hapi/wreck": "^17.0.0", + "debug": "^4.1.1", + "joi": "^17.3.0" + } + }, "node_modules/sonic-boom": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", @@ -598,6 +683,42 @@ "ajv": "^6.12.6" } }, + "@hapi/boom": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz", + "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==", + "requires": { + "@hapi/hoek": "9.x.x" + } + }, + "@hapi/bourne": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-2.0.0.tgz", + "integrity": "sha512-WEezM1FWztfbzqIUbsDzFRVMxSoLy3HugVcux6KDDtTqzPsLE8NDRHfXvev66aH1i2oOKKar3/XDjbvh/OUBdg==" + }, + "@hapi/hoek": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz", + "integrity": "sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==" + }, + "@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@hapi/wreck": { + "version": "17.1.0", + "resolved": "https://registry.npmjs.org/@hapi/wreck/-/wreck-17.1.0.tgz", + "integrity": "sha512-nx6sFyfqOpJ+EFrHX+XWwJAxs3ju4iHdbB/bwR8yTNZOiYmuhA8eCe7lYPtYmb4j7vyK/SlbaQsmTtUrMvPEBw==", + "requires": { + "@hapi/boom": "9.x.x", + "@hapi/bourne": "2.x.x", + "@hapi/hoek": "9.x.x" + } + }, "@reduxjs/toolkit": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.6.1.tgz", @@ -610,15 +731,35 @@ } }, "@sero.run/sero": { - "version": "0.0.17", - "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.17.tgz", - "integrity": "sha512-fu652LrbBe1tzgximV6AQBVgK1oFqRfnYmR10mwzV+WfdKeSeTi+g4hmWrbAYBkfsCqgYzTOwUdlAtzQ5ispKw==", + "version": "0.0.19", + "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.19.tgz", + "integrity": "sha512-Bz1PMolkshpkfuR281AmoishLxHcAUOeg0hyIm6ZfJhHS0Ny4RaeRt/bUN0ftqv8Ko2pJDMhgO/4NivR+pRO1A==", "requires": { "@reduxjs/toolkit": "^1.6.1", "cross-fetch": "^3.1.4", - "fastify": "^3.18.0" + "fastify": "^3.18.0", + "fastify-plugin": "^3.0.0", + "simple-oauth2": "^4.2.0" } }, + "@sideway/address": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz", + "integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@sideway/formula": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" + }, + "@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, "abstract-logging": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/abstract-logging/-/abstract-logging-2.0.1.tgz", @@ -719,9 +860,9 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" }, "fastify": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.21.0.tgz", - "integrity": "sha512-hc9p0meCV8PXIQzg8BwXekhCmJm5LHfeJi7U3mKQTMu7pQT24CL756jUxM9sOLEbBpQoD82PejVPW2lfLiXJsw==", + "version": "3.21.6", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.21.6.tgz", + "integrity": "sha512-PextZFavEZaqn2ZYbVGBPAI0AiElnVdfqo9sN1wlOi0mhGtYuec4KT82MHe5npCf3Lz++6i7jLl7YKyYidPrMg==", "requires": { "@fastify/ajv-compiler": "^1.0.0", "abstract-logging": "^2.0.0", @@ -746,6 +887,11 @@ "resolved": "https://registry.npmjs.org/fastify-error/-/fastify-error-0.3.1.tgz", "integrity": "sha512-oCfpcsDndgnDVgiI7bwFKAun2dO+4h84vBlkWsWnz/OUK9Reff5UFoFl241xTiLeHWX/vU9zkDVXqYUxjOwHcQ==" }, + "fastify-plugin": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.0.tgz", + "integrity": "sha512-ZdCvKEEd92DNLps5n0v231Bha8bkz1DjnPP/aEz37rz/q42Z5JVLmgnqR4DYuNn3NXAO3IDCPyRvgvxtJ4Ym4w==" + }, "fastify-warning": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/fastify-warning/-/fastify-warning-0.2.0.tgz", @@ -795,6 +941,18 @@ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, + "joi": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.2.tgz", + "integrity": "sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==", + "requires": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -980,6 +1138,17 @@ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz", "integrity": "sha512-edRH8mBKEWNVIVMKejNnuJxleqYE/ZSdcT8/Nem9/mmosx12pctd80s2Oy00KNZzrogMZS5mauK2/ymL1bvlvg==" }, + "simple-oauth2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/simple-oauth2/-/simple-oauth2-4.2.0.tgz", + "integrity": "sha512-AV62tGdq9JfLd/uveKpeNtQl+VVm89a35QKlwGuvisYIjCoz2ZmTGRGuSIGiYr+QUhSKJ5kYN1jq2BBa/ac/GQ==", + "requires": { + "@hapi/hoek": "^9.0.4", + "@hapi/wreck": "^17.0.0", + "debug": "^4.1.1", + "joi": "^17.3.0" + } + }, "sonic-boom": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", diff --git a/example/connectathon-cds-hooks/package.json b/example/connectathon-cds-hooks/package.json index 3f4d9e1..c4aef2e 100644 --- a/example/connectathon-cds-hooks/package.json +++ b/example/connectathon-cds-hooks/package.json @@ -10,7 +10,8 @@ "author": "", "license": "ISC", "dependencies": { - "@sero.run/sero": "^0.0.17" + "@sero.run/sero": "^0.0.19", + "fastify": "^3.21.6" }, "type": "module" } diff --git a/example/connectathon-cds-hooks/src/index.js b/example/connectathon-cds-hooks/src/index.js index c340018..9b6e87d 100644 --- a/example/connectathon-cds-hooks/src/index.js +++ b/example/connectathon-cds-hooks/src/index.js @@ -1,13 +1,21 @@ -import { Http, CDSHooks, start } from "@sero.run/sero"; +import { CDSHooks } from "@sero.run/sero"; +import Fastify from "fastify"; + import patientView from "./patient-view/patient-view.js"; const config = { - cdsHooks: { - services: [patientView], - cors: true, - }, + services: [patientView], + cors: true, }; -const http = Http(config); -CDSHooks(config, http); -start(http); +const fastify = Fastify({ + logger: true, +}); + +fastify.register(CDSHooks, config); +fastify.listen(8080, (err) => { + if (err) { + fastify.log.error(err); + process.exit(1); + } +}); diff --git a/example/goodrx-cds-price-comparison/package-lock.json b/example/goodrx-cds-price-comparison/package-lock.json index 232a943..3e966cc 100644 --- a/example/goodrx-cds-price-comparison/package-lock.json +++ b/example/goodrx-cds-price-comparison/package-lock.json @@ -9,7 +9,8 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@sero.run/sero": "0.0.17", + "@sero.run/sero": "^0.0.19", + "fastify": "^3.21.6", "pino-pretty": "^5.1.2" }, "devDependencies": { @@ -37,11 +38,42 @@ "ajv": "^6.12.6" } }, + "node_modules/@hapi/boom": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz", + "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==", + "dependencies": { + "@hapi/hoek": "9.x.x" + } + }, "node_modules/@hapi/bourne": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-2.0.0.tgz", "integrity": "sha512-WEezM1FWztfbzqIUbsDzFRVMxSoLy3HugVcux6KDDtTqzPsLE8NDRHfXvev66aH1i2oOKKar3/XDjbvh/OUBdg==" }, + "node_modules/@hapi/hoek": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz", + "integrity": "sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==" + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@hapi/wreck": { + "version": "17.1.0", + "resolved": "https://registry.npmjs.org/@hapi/wreck/-/wreck-17.1.0.tgz", + "integrity": "sha512-nx6sFyfqOpJ+EFrHX+XWwJAxs3ju4iHdbB/bwR8yTNZOiYmuhA8eCe7lYPtYmb4j7vyK/SlbaQsmTtUrMvPEBw==", + "dependencies": { + "@hapi/boom": "9.x.x", + "@hapi/bourne": "2.x.x", + "@hapi/hoek": "9.x.x" + } + }, "node_modules/@reduxjs/toolkit": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.6.1.tgz", @@ -66,18 +98,38 @@ } }, "node_modules/@sero.run/sero": { - "version": "0.0.17", - "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.17.tgz", - "integrity": "sha512-fu652LrbBe1tzgximV6AQBVgK1oFqRfnYmR10mwzV+WfdKeSeTi+g4hmWrbAYBkfsCqgYzTOwUdlAtzQ5ispKw==", + "version": "0.0.19", + "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.19.tgz", + "integrity": "sha512-Bz1PMolkshpkfuR281AmoishLxHcAUOeg0hyIm6ZfJhHS0Ny4RaeRt/bUN0ftqv8Ko2pJDMhgO/4NivR+pRO1A==", "dependencies": { "@reduxjs/toolkit": "^1.6.1", "cross-fetch": "^3.1.4", - "fastify": "^3.18.0" + "fastify": "^3.18.0", + "fastify-plugin": "^3.0.0", + "simple-oauth2": "^4.2.0" }, "engines": { "node": ">=14.17" } }, + "node_modules/@sideway/address": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz", + "integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, "node_modules/@types/fhir": { "version": "0.0.34", "resolved": "https://registry.npmjs.org/@types/fhir/-/fhir-0.0.34.tgz", @@ -364,9 +416,9 @@ "integrity": "sha512-lXatBjf3WPjmWD6DpIZxkeSsCOwqI0maYMpgDlx8g4U2qi4lbjA9oH/HD2a87G+KfsUmo5WbJFmqBZlPxtptag==" }, "node_modules/fastify": { - "version": "3.20.2", - "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.20.2.tgz", - "integrity": "sha512-POvayPpbyvkE/wHQquQsNwIgYKVRz7HhCXYJyzUuWEN3kch7/QeI+/azQCjS6+XHiHZPWQwrBKjJB9FBdJHrgA==", + "version": "3.21.6", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.21.6.tgz", + "integrity": "sha512-PextZFavEZaqn2ZYbVGBPAI0AiElnVdfqo9sN1wlOi0mhGtYuec4KT82MHe5npCf3Lz++6i7jLl7YKyYidPrMg==", "dependencies": { "@fastify/ajv-compiler": "^1.0.0", "abstract-logging": "^2.0.0", @@ -391,6 +443,11 @@ "resolved": "https://registry.npmjs.org/fastify-error/-/fastify-error-0.3.1.tgz", "integrity": "sha512-oCfpcsDndgnDVgiI7bwFKAun2dO+4h84vBlkWsWnz/OUK9Reff5UFoFl241xTiLeHWX/vU9zkDVXqYUxjOwHcQ==" }, + "node_modules/fastify-plugin": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.0.tgz", + "integrity": "sha512-ZdCvKEEd92DNLps5n0v231Bha8bkz1DjnPP/aEz37rz/q42Z5JVLmgnqR4DYuNn3NXAO3IDCPyRvgvxtJ4Ym4w==" + }, "node_modules/fastify-warning": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/fastify-warning/-/fastify-warning-0.2.0.tgz", @@ -469,6 +526,18 @@ "node": ">= 0.6.0" } }, + "node_modules/joi": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.2.tgz", + "integrity": "sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==", + "dependencies": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "node_modules/joycon": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.0.1.tgz", @@ -781,6 +850,17 @@ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz", "integrity": "sha512-edRH8mBKEWNVIVMKejNnuJxleqYE/ZSdcT8/Nem9/mmosx12pctd80s2Oy00KNZzrogMZS5mauK2/ymL1bvlvg==" }, + "node_modules/simple-oauth2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/simple-oauth2/-/simple-oauth2-4.2.0.tgz", + "integrity": "sha512-AV62tGdq9JfLd/uveKpeNtQl+VVm89a35QKlwGuvisYIjCoz2ZmTGRGuSIGiYr+QUhSKJ5kYN1jq2BBa/ac/GQ==", + "dependencies": { + "@hapi/hoek": "^9.0.4", + "@hapi/wreck": "^17.0.0", + "debug": "^4.1.1", + "joi": "^17.3.0" + } + }, "node_modules/sonic-boom": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", @@ -895,11 +975,42 @@ "ajv": "^6.12.6" } }, + "@hapi/boom": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz", + "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==", + "requires": { + "@hapi/hoek": "9.x.x" + } + }, "@hapi/bourne": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-2.0.0.tgz", "integrity": "sha512-WEezM1FWztfbzqIUbsDzFRVMxSoLy3HugVcux6KDDtTqzPsLE8NDRHfXvev66aH1i2oOKKar3/XDjbvh/OUBdg==" }, + "@hapi/hoek": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz", + "integrity": "sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==" + }, + "@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@hapi/wreck": { + "version": "17.1.0", + "resolved": "https://registry.npmjs.org/@hapi/wreck/-/wreck-17.1.0.tgz", + "integrity": "sha512-nx6sFyfqOpJ+EFrHX+XWwJAxs3ju4iHdbB/bwR8yTNZOiYmuhA8eCe7lYPtYmb4j7vyK/SlbaQsmTtUrMvPEBw==", + "requires": { + "@hapi/boom": "9.x.x", + "@hapi/bourne": "2.x.x", + "@hapi/hoek": "9.x.x" + } + }, "@reduxjs/toolkit": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.6.1.tgz", @@ -912,15 +1023,35 @@ } }, "@sero.run/sero": { - "version": "0.0.17", - "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.17.tgz", - "integrity": "sha512-fu652LrbBe1tzgximV6AQBVgK1oFqRfnYmR10mwzV+WfdKeSeTi+g4hmWrbAYBkfsCqgYzTOwUdlAtzQ5ispKw==", + "version": "0.0.19", + "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.19.tgz", + "integrity": "sha512-Bz1PMolkshpkfuR281AmoishLxHcAUOeg0hyIm6ZfJhHS0Ny4RaeRt/bUN0ftqv8Ko2pJDMhgO/4NivR+pRO1A==", "requires": { "@reduxjs/toolkit": "^1.6.1", "cross-fetch": "^3.1.4", - "fastify": "^3.18.0" + "fastify": "^3.18.0", + "fastify-plugin": "^3.0.0", + "simple-oauth2": "^4.2.0" + } + }, + "@sideway/address": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz", + "integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==", + "requires": { + "@hapi/hoek": "^9.0.0" } }, + "@sideway/formula": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" + }, + "@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, "@types/fhir": { "version": "0.0.34", "resolved": "https://registry.npmjs.org/@types/fhir/-/fhir-0.0.34.tgz", @@ -1143,9 +1274,9 @@ "integrity": "sha512-lXatBjf3WPjmWD6DpIZxkeSsCOwqI0maYMpgDlx8g4U2qi4lbjA9oH/HD2a87G+KfsUmo5WbJFmqBZlPxtptag==" }, "fastify": { - "version": "3.20.2", - "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.20.2.tgz", - "integrity": "sha512-POvayPpbyvkE/wHQquQsNwIgYKVRz7HhCXYJyzUuWEN3kch7/QeI+/azQCjS6+XHiHZPWQwrBKjJB9FBdJHrgA==", + "version": "3.21.6", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.21.6.tgz", + "integrity": "sha512-PextZFavEZaqn2ZYbVGBPAI0AiElnVdfqo9sN1wlOi0mhGtYuec4KT82MHe5npCf3Lz++6i7jLl7YKyYidPrMg==", "requires": { "@fastify/ajv-compiler": "^1.0.0", "abstract-logging": "^2.0.0", @@ -1170,6 +1301,11 @@ "resolved": "https://registry.npmjs.org/fastify-error/-/fastify-error-0.3.1.tgz", "integrity": "sha512-oCfpcsDndgnDVgiI7bwFKAun2dO+4h84vBlkWsWnz/OUK9Reff5UFoFl241xTiLeHWX/vU9zkDVXqYUxjOwHcQ==" }, + "fastify-plugin": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.0.tgz", + "integrity": "sha512-ZdCvKEEd92DNLps5n0v231Bha8bkz1DjnPP/aEz37rz/q42Z5JVLmgnqR4DYuNn3NXAO3IDCPyRvgvxtJ4Ym4w==" + }, "fastify-warning": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/fastify-warning/-/fastify-warning-0.2.0.tgz", @@ -1229,6 +1365,18 @@ "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=" }, + "joi": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.2.tgz", + "integrity": "sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==", + "requires": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "joycon": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.0.1.tgz", @@ -1465,6 +1613,17 @@ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz", "integrity": "sha512-edRH8mBKEWNVIVMKejNnuJxleqYE/ZSdcT8/Nem9/mmosx12pctd80s2Oy00KNZzrogMZS5mauK2/ymL1bvlvg==" }, + "simple-oauth2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/simple-oauth2/-/simple-oauth2-4.2.0.tgz", + "integrity": "sha512-AV62tGdq9JfLd/uveKpeNtQl+VVm89a35QKlwGuvisYIjCoz2ZmTGRGuSIGiYr+QUhSKJ5kYN1jq2BBa/ac/GQ==", + "requires": { + "@hapi/hoek": "^9.0.4", + "@hapi/wreck": "^17.0.0", + "debug": "^4.1.1", + "joi": "^17.3.0" + } + }, "sonic-boom": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", diff --git a/example/goodrx-cds-price-comparison/package.json b/example/goodrx-cds-price-comparison/package.json index b325632..06ddc84 100644 --- a/example/goodrx-cds-price-comparison/package.json +++ b/example/goodrx-cds-price-comparison/package.json @@ -11,7 +11,8 @@ "type": "module", "license": "ISC", "dependencies": { - "@sero.run/sero": "0.0.17", + "@sero.run/sero": "^0.0.19", + "fastify": "^3.21.6", "pino-pretty": "^5.1.2" }, "devDependencies": { diff --git a/example/goodrx-cds-price-comparison/src/good-rx-compare-price.ts b/example/goodrx-cds-price-comparison/src/good-rx-compare-price.ts index 903a4d1..3275470 100644 --- a/example/goodrx-cds-price-comparison/src/good-rx-compare-price.ts +++ b/example/goodrx-cds-price-comparison/src/good-rx-compare-price.ts @@ -1,5 +1,10 @@ /* eslint-disable indent */ -import { Service, Card, HookRequest, NoDecisionResponse } from "@sero.run/sero"; +import { + CDSService, + CDSCard, + CDSHookRequest, + CDSNoDecisionResponse, +} from "@sero.run/sero"; import { Hooks } from "@sero.run/sero/cds-hooks/util"; import { comparePrice } from "./api.js"; @@ -11,7 +16,7 @@ const options = { "GoodRx's Compare Price API is used to provide drug cost estimates during the prescription order workflow", }; -const handler = async (request: HookRequest) => { +const handler = async (request: CDSHookRequest) => { /** * draftOrders is a required context submission for the order-select hook * @@ -36,7 +41,7 @@ const handler = async (request: HookRequest) => { * If no MedicationRequest was found, throw a NoDecisionResponse - which is * handled by Sero automatically and returns an empty Card set */ - if (!medicationRequest) throw new NoDecisionResponse(); + if (!medicationRequest) throw new CDSNoDecisionResponse(); /** * Otherwise, we have a MedicationRequest, so let's use the text associated @@ -68,7 +73,7 @@ const handler = async (request: HookRequest) => { */ return { cards: [ - new Card({ + new CDSCard({ source: { label: "GoodRx", }, @@ -94,4 +99,4 @@ const handler = async (request: HookRequest) => { * interface/API envisioned to run directly on the rails of existing EHR * systems. */ -export default new Service(options, handler); +export default new CDSService(options, handler); diff --git a/example/goodrx-cds-price-comparison/src/index.ts b/example/goodrx-cds-price-comparison/src/index.ts index ff74b5d..b7e3ee3 100644 --- a/example/goodrx-cds-price-comparison/src/index.ts +++ b/example/goodrx-cds-price-comparison/src/index.ts @@ -1,21 +1,25 @@ -import { Http, CDSHooks, start } from "@sero.run/sero" +import { CDSHooks } from "@sero.run/sero"; +import Fastify from "fastify"; import goodRxComparePriceService from "./good-rx-compare-price.js"; const config = { - cdsHooks: { - services: [ - goodRxComparePriceService - ], - cors: true - }, + services: [goodRxComparePriceService], + cors: true, http: { logger: { - prettyPrint: true - } - } -} + prettyPrint: true, + }, + }, +}; -const http = Http(config); +const fastify = Fastify({ + logger: true, +}); -CDSHooks(config, http); -start(http); \ No newline at end of file +fastify.register(CDSHooks, config); +fastify.listen(8080, (err) => { + if (err) { + fastify.log.error(err); + process.exit(1); + } +}); diff --git a/example/humana-specialist-search/package-lock.json b/example/humana-specialist-search/package-lock.json index 8c1ca9d..f4e8135 100644 --- a/example/humana-specialist-search/package-lock.json +++ b/example/humana-specialist-search/package-lock.json @@ -5,11 +5,13 @@ "requires": true, "packages": { "": { + "name": "humana-specialist-search", "version": "1.0.0", "license": "ISC", "dependencies": { - "@sero.run/sero": "^0.0.16", + "@sero.run/sero": "^0.0.19", "chalk": "^4.1.2", + "fastify": "^3.21.6", "pretty-print-json": "^1.0.3" }, "devDependencies": { @@ -37,6 +39,42 @@ "ajv": "^6.12.6" } }, + "node_modules/@hapi/boom": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz", + "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==", + "dependencies": { + "@hapi/hoek": "9.x.x" + } + }, + "node_modules/@hapi/bourne": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-2.0.0.tgz", + "integrity": "sha512-WEezM1FWztfbzqIUbsDzFRVMxSoLy3HugVcux6KDDtTqzPsLE8NDRHfXvev66aH1i2oOKKar3/XDjbvh/OUBdg==" + }, + "node_modules/@hapi/hoek": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz", + "integrity": "sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==" + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@hapi/wreck": { + "version": "17.1.0", + "resolved": "https://registry.npmjs.org/@hapi/wreck/-/wreck-17.1.0.tgz", + "integrity": "sha512-nx6sFyfqOpJ+EFrHX+XWwJAxs3ju4iHdbB/bwR8yTNZOiYmuhA8eCe7lYPtYmb4j7vyK/SlbaQsmTtUrMvPEBw==", + "dependencies": { + "@hapi/boom": "9.x.x", + "@hapi/bourne": "2.x.x", + "@hapi/hoek": "9.x.x" + } + }, "node_modules/@reduxjs/toolkit": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.6.1.tgz", @@ -61,18 +99,38 @@ } }, "node_modules/@sero.run/sero": { - "version": "0.0.16", - "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.16.tgz", - "integrity": "sha512-KHi0h624o2wxzW600va7kLNFIo5ltAmp9+ACQWTAaupI5Wg1+M8eIVLjaUp72wDVvjyjvqjF4aXLxmYMo55eZA==", + "version": "0.0.19", + "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.19.tgz", + "integrity": "sha512-Bz1PMolkshpkfuR281AmoishLxHcAUOeg0hyIm6ZfJhHS0Ny4RaeRt/bUN0ftqv8Ko2pJDMhgO/4NivR+pRO1A==", "dependencies": { "@reduxjs/toolkit": "^1.6.1", "cross-fetch": "^3.1.4", - "fastify": "^3.18.0" + "fastify": "^3.18.0", + "fastify-plugin": "^3.0.0", + "simple-oauth2": "^4.2.0" }, "engines": { "node": ">=14.17" } }, + "node_modules/@sideway/address": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz", + "integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, "node_modules/@types/fhir": { "version": "0.0.34", "resolved": "https://registry.npmjs.org/@types/fhir/-/fhir-0.0.34.tgz", @@ -257,9 +315,9 @@ "integrity": "sha512-lXatBjf3WPjmWD6DpIZxkeSsCOwqI0maYMpgDlx8g4U2qi4lbjA9oH/HD2a87G+KfsUmo5WbJFmqBZlPxtptag==" }, "node_modules/fastify": { - "version": "3.20.2", - "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.20.2.tgz", - "integrity": "sha512-POvayPpbyvkE/wHQquQsNwIgYKVRz7HhCXYJyzUuWEN3kch7/QeI+/azQCjS6+XHiHZPWQwrBKjJB9FBdJHrgA==", + "version": "3.21.6", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.21.6.tgz", + "integrity": "sha512-PextZFavEZaqn2ZYbVGBPAI0AiElnVdfqo9sN1wlOi0mhGtYuec4KT82MHe5npCf3Lz++6i7jLl7YKyYidPrMg==", "dependencies": { "@fastify/ajv-compiler": "^1.0.0", "abstract-logging": "^2.0.0", @@ -284,6 +342,11 @@ "resolved": "https://registry.npmjs.org/fastify-error/-/fastify-error-0.3.1.tgz", "integrity": "sha512-oCfpcsDndgnDVgiI7bwFKAun2dO+4h84vBlkWsWnz/OUK9Reff5UFoFl241xTiLeHWX/vU9zkDVXqYUxjOwHcQ==" }, + "node_modules/fastify-plugin": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.0.tgz", + "integrity": "sha512-ZdCvKEEd92DNLps5n0v231Bha8bkz1DjnPP/aEz37rz/q42Z5JVLmgnqR4DYuNn3NXAO3IDCPyRvgvxtJ4Ym4w==" + }, "node_modules/fastify-warning": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/fastify-warning/-/fastify-warning-0.2.0.tgz", @@ -354,6 +417,18 @@ "node": ">= 0.10" } }, + "node_modules/joi": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.2.tgz", + "integrity": "sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==", + "dependencies": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -608,6 +683,17 @@ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz", "integrity": "sha512-edRH8mBKEWNVIVMKejNnuJxleqYE/ZSdcT8/Nem9/mmosx12pctd80s2Oy00KNZzrogMZS5mauK2/ymL1bvlvg==" }, + "node_modules/simple-oauth2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/simple-oauth2/-/simple-oauth2-4.2.0.tgz", + "integrity": "sha512-AV62tGdq9JfLd/uveKpeNtQl+VVm89a35QKlwGuvisYIjCoz2ZmTGRGuSIGiYr+QUhSKJ5kYN1jq2BBa/ac/GQ==", + "dependencies": { + "@hapi/hoek": "^9.0.4", + "@hapi/wreck": "^17.0.0", + "debug": "^4.1.1", + "joi": "^17.3.0" + } + }, "node_modules/sonic-boom": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", @@ -698,6 +784,42 @@ "ajv": "^6.12.6" } }, + "@hapi/boom": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz", + "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==", + "requires": { + "@hapi/hoek": "9.x.x" + } + }, + "@hapi/bourne": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-2.0.0.tgz", + "integrity": "sha512-WEezM1FWztfbzqIUbsDzFRVMxSoLy3HugVcux6KDDtTqzPsLE8NDRHfXvev66aH1i2oOKKar3/XDjbvh/OUBdg==" + }, + "@hapi/hoek": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz", + "integrity": "sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==" + }, + "@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@hapi/wreck": { + "version": "17.1.0", + "resolved": "https://registry.npmjs.org/@hapi/wreck/-/wreck-17.1.0.tgz", + "integrity": "sha512-nx6sFyfqOpJ+EFrHX+XWwJAxs3ju4iHdbB/bwR8yTNZOiYmuhA8eCe7lYPtYmb4j7vyK/SlbaQsmTtUrMvPEBw==", + "requires": { + "@hapi/boom": "9.x.x", + "@hapi/bourne": "2.x.x", + "@hapi/hoek": "9.x.x" + } + }, "@reduxjs/toolkit": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.6.1.tgz", @@ -710,15 +832,35 @@ } }, "@sero.run/sero": { - "version": "0.0.16", - "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.16.tgz", - "integrity": "sha512-KHi0h624o2wxzW600va7kLNFIo5ltAmp9+ACQWTAaupI5Wg1+M8eIVLjaUp72wDVvjyjvqjF4aXLxmYMo55eZA==", + "version": "0.0.19", + "resolved": "https://registry.npmjs.org/@sero.run/sero/-/sero-0.0.19.tgz", + "integrity": "sha512-Bz1PMolkshpkfuR281AmoishLxHcAUOeg0hyIm6ZfJhHS0Ny4RaeRt/bUN0ftqv8Ko2pJDMhgO/4NivR+pRO1A==", "requires": { "@reduxjs/toolkit": "^1.6.1", "cross-fetch": "^3.1.4", - "fastify": "^3.18.0" + "fastify": "^3.18.0", + "fastify-plugin": "^3.0.0", + "simple-oauth2": "^4.2.0" + } + }, + "@sideway/address": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz", + "integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==", + "requires": { + "@hapi/hoek": "^9.0.0" } }, + "@sideway/formula": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" + }, + "@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, "@types/fhir": { "version": "0.0.34", "resolved": "https://registry.npmjs.org/@types/fhir/-/fhir-0.0.34.tgz", @@ -861,9 +1003,9 @@ "integrity": "sha512-lXatBjf3WPjmWD6DpIZxkeSsCOwqI0maYMpgDlx8g4U2qi4lbjA9oH/HD2a87G+KfsUmo5WbJFmqBZlPxtptag==" }, "fastify": { - "version": "3.20.2", - "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.20.2.tgz", - "integrity": "sha512-POvayPpbyvkE/wHQquQsNwIgYKVRz7HhCXYJyzUuWEN3kch7/QeI+/azQCjS6+XHiHZPWQwrBKjJB9FBdJHrgA==", + "version": "3.21.6", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.21.6.tgz", + "integrity": "sha512-PextZFavEZaqn2ZYbVGBPAI0AiElnVdfqo9sN1wlOi0mhGtYuec4KT82MHe5npCf3Lz++6i7jLl7YKyYidPrMg==", "requires": { "@fastify/ajv-compiler": "^1.0.0", "abstract-logging": "^2.0.0", @@ -888,6 +1030,11 @@ "resolved": "https://registry.npmjs.org/fastify-error/-/fastify-error-0.3.1.tgz", "integrity": "sha512-oCfpcsDndgnDVgiI7bwFKAun2dO+4h84vBlkWsWnz/OUK9Reff5UFoFl241xTiLeHWX/vU9zkDVXqYUxjOwHcQ==" }, + "fastify-plugin": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.0.tgz", + "integrity": "sha512-ZdCvKEEd92DNLps5n0v231Bha8bkz1DjnPP/aEz37rz/q42Z5JVLmgnqR4DYuNn3NXAO3IDCPyRvgvxtJ4Ym4w==" + }, "fastify-warning": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/fastify-warning/-/fastify-warning-0.2.0.tgz", @@ -942,6 +1089,18 @@ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, + "joi": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.2.tgz", + "integrity": "sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==", + "requires": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -1132,6 +1291,17 @@ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz", "integrity": "sha512-edRH8mBKEWNVIVMKejNnuJxleqYE/ZSdcT8/Nem9/mmosx12pctd80s2Oy00KNZzrogMZS5mauK2/ymL1bvlvg==" }, + "simple-oauth2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/simple-oauth2/-/simple-oauth2-4.2.0.tgz", + "integrity": "sha512-AV62tGdq9JfLd/uveKpeNtQl+VVm89a35QKlwGuvisYIjCoz2ZmTGRGuSIGiYr+QUhSKJ5kYN1jq2BBa/ac/GQ==", + "requires": { + "@hapi/hoek": "^9.0.4", + "@hapi/wreck": "^17.0.0", + "debug": "^4.1.1", + "joi": "^17.3.0" + } + }, "sonic-boom": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", diff --git a/example/humana-specialist-search/package.json b/example/humana-specialist-search/package.json index 8b96341..2ef770b 100644 --- a/example/humana-specialist-search/package.json +++ b/example/humana-specialist-search/package.json @@ -17,8 +17,9 @@ "typescript": "^4.3.5" }, "dependencies": { - "@sero.run/sero": "^0.0.17", + "@sero.run/sero": "^0.0.19", "chalk": "^4.1.2", + "fastify": "^3.21.6", "pretty-print-json": "^1.0.3" } }