diff --git a/CHANGELOG.md b/CHANGELOG.md index b2ec304..02828dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.1.5](https://github.com/iris-gateway/IRIS-library-js/compare/v1.1.4...v1.1.5) (2021-03-27) + + +### Bug Fixes + +* remove code from codeKeyMap after sending data ([b43ba7b](https://github.com/iris-gateway/IRIS-library-js/commit/b43ba7bedfb4ecf1f47c71dc96dcb4ba903d3042)), closes [#3](https://github.com/iris-gateway/IRIS-library-js/issues/3) + ## [1.1.4](https://github.com/iris-gateway/IRIS-library-js/compare/v1.1.3...v1.1.4) (2021-03-21) diff --git a/dist/index.d.ts b/dist/index.d.ts index 468a1f5..0e6ce3e 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,2 +1,7 @@ import Iris from './lib/'; +import IrisCode from './types/IrisCode'; +import IrisDataRequest from './types/IrisDataRequest'; +import IrisContactsEvents from './types/IrisContactsEvents'; +import IrisUserInfo from './types/IrisUserInfo'; export default Iris; +export { IrisCode, IrisDataRequest, IrisContactsEvents, IrisUserInfo }; diff --git a/dist/index.js.map b/dist/index.js.map index 2917c34..14ad5a0 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,gCAA0B;AAC1B,kBAAe,aAAI,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,gCAA0B;AAM1B,kBAAe,aAAI,CAAC"} \ No newline at end of file diff --git a/dist/lib/Iris.d.ts b/dist/lib/Iris.d.ts index e6f2ee7..9f1f48e 100644 --- a/dist/lib/Iris.d.ts +++ b/dist/lib/Iris.d.ts @@ -6,7 +6,25 @@ import IrisUserInfo from '../types/IrisUserInfo'; export default class Iris { private axiosInstance; private codeKeyMap; + /** + * Generate an instance of the IRIS connector library + * + * @param options General settings like baseUrl + */ constructor(options: Partial); + /** + * Retrieve the data request and relevant information of the requesting health office + * + * @param code The code tied to the data request + * @returns Data Request + */ getDataRequest(code: IrisCode): Promise; + /** + * Sends Contact and event information to IRIS + * + * @param code The code tied to the data request + * @param data Data to be sent + * @param user Information about the user sending the data + */ sendContactsEvents(code: IrisCode, data: IrisContactsEvents, user: IrisUserInfo): Promise; } diff --git a/dist/lib/Iris.js b/dist/lib/Iris.js index 465b8a2..4fb2974 100644 --- a/dist/lib/Iris.js +++ b/dist/lib/Iris.js @@ -7,6 +7,11 @@ const defaultOptions = { baseUrl: '', }; class Iris { + /** + * Generate an instance of the IRIS connector library + * + * @param options General settings like baseUrl + */ constructor(options) { this.codeKeyMap = new Map(); const opts = Object.assign(defaultOptions, options); @@ -14,6 +19,12 @@ class Iris { baseURL: opts.baseUrl, }); } + /** + * Retrieve the data request and relevant information of the requesting health office + * + * @param code The code tied to the data request + * @returns Data Request + */ async getDataRequest(code) { const response = await this.axiosInstance.get(`/data-requests/${code}`); if (response.status !== 200) { @@ -32,6 +43,13 @@ class Iris { requestDetails: dataRequest.requestDetails, }; } + /** + * Sends Contact and event information to IRIS + * + * @param code The code tied to the data request + * @param data Data to be sent + * @param user Information about the user sending the data + */ async sendContactsEvents(code, data, user) { if (!this.codeKeyMap.has(code)) { throw new Error("Code could not be found in key map. Did you perform 'getDataRequest' before?"); @@ -49,6 +67,7 @@ class Iris { console.error('IRIS Gateway responded the following data', response.data); throw new Error(`Request failed with status Code ${response.status}`); } + this.codeKeyMap.delete(code); } } exports.default = Iris; diff --git a/dist/lib/Iris.js.map b/dist/lib/Iris.js.map index a3f1a8a..7552d5b 100644 --- a/dist/lib/Iris.js.map +++ b/dist/lib/Iris.js.map @@ -1 +1 @@ -{"version":3,"file":"Iris.js","sourceRoot":"","sources":["../../src/lib/Iris.ts"],"names":[],"mappings":";;AAAA,iCAA6C;AAE7C,qCAAuC;AACvC,iCAAiE;AAWjE,MAAM,cAAc,GAAgB;IAClC,OAAO,EAAE,EAAE;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AE,IAAI,CAAC,CAAC;QAC/E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,qBAAqB,IAAI,kBAAkB,EAAE;YAC1F,SAAS,EAAE,CAAC,uBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,4BAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CACxG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CACX;YACD,MAAM,EAAE,cAAc;YACtB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,aAAa,EAAE,eAAe;YAC9B,KAAK;SAC6B,CAAC,CAAC;QACtC,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;YAC3B,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC1E,MAAM,IAAI,KAAK,CAAC,mCAAmC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;SACvE;QACD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AAtED,uBAsEC"} \ No newline at end of file diff --git a/package.json b/package.json index a130956..3b8ba59 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "type": "git", "url": "https://github.com/iris-gateway/IRIS-library-js.git" }, - "version": "1.1.4", + "version": "1.1.5", "dependencies": { "axios": "^0.21.1" },