fluent-cerner-js 1.0.0-3 → 1.0.0-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/fluent-cerner-js.cjs.development.js +7 -157
- package/dist/fluent-cerner-js.cjs.development.js.map +1 -1
- package/dist/fluent-cerner-js.cjs.production.min.js +1 -1
- package/dist/fluent-cerner-js.cjs.production.min.js.map +1 -1
- package/dist/fluent-cerner-js.esm.js +2 -157
- package/dist/fluent-cerner-js.esm.js.map +1 -1
- package/dist/index.d.ts +1 -45
- package/package.json +5 -2
- package/src/index.ts +7 -53
- package/dist/makeCclRequestAsync.d.ts +0 -97
- package/src/makeCclRequestAsync.spec.ts +0 -119
- package/src/makeCclRequestAsync.ts +0 -240
package/README.md
CHANGED
|
@@ -45,6 +45,8 @@ const {
|
|
|
45
45
|
]);
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
**Note**: This project exposes the function `makeCclRequestAsync` through [`easy-ccl-request`](https://github.com/geekmdtravis/easy-ccl-request) and is a _peer dependency_. This function is used to make AJAX calls to CCL end-points. If you choose to use this function, you will need to install the peer dependency. This decision was made since `makeCclRequestAsync` is being leveraged in a number of different packages and I wanted to offer it as a stand-alone package without bringing in the entire `fluent-cerner-js` package, which itself is dependent on a limited set of dependencies. Please see the _package.json_ file for the current version of `easy-ccl-request` to see the supported versions.
|
|
49
|
+
|
|
48
50
|
### Open a Chart Level Tab
|
|
49
51
|
|
|
50
52
|
Open a tab at the chart level. Just provide the patient ID, encounter ID, and the tab name.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var easyCclRequest = require('easy-ccl-request');
|
|
5
6
|
var fastXmlParser = require('fast-xml-parser');
|
|
6
7
|
|
|
7
8
|
function _regeneratorRuntime() {
|
|
@@ -910,162 +911,6 @@ var launchPowerNoteAsync = /*#__PURE__*/function () {
|
|
|
910
911
|
};
|
|
911
912
|
}();
|
|
912
913
|
|
|
913
|
-
/**
|
|
914
|
-
* Make AJAX calls to CCL end-points to retrieve data from the Cerner PowerChart
|
|
915
|
-
* application. This function is a wrapper around the `XMLCclRequest` native Discern function
|
|
916
|
-
* provided by the Cerner PowerChart application that greatly simplifies it's use. This
|
|
917
|
-
* request is ultimately a wrapper around the `XMLHttpRequest` object and is only set to
|
|
918
|
-
* handle GET requests.
|
|
919
|
-
* @param prg {string} - the name of the CCL program to call.
|
|
920
|
-
* @param params {Array<CclCallParam|string|number>} - an array of parameters to pass to the CCL program.
|
|
921
|
-
* @param excludeMine {boolean} - (optional) determines whether or not to include the "MINE" parameter as the
|
|
922
|
-
* first parameter in the CCL request's argument list.
|
|
923
|
-
* @resolves `CclRequestResponse<T>`.
|
|
924
|
-
* @rejects {Error} if the `prg` parameter is an empty string.
|
|
925
|
-
* @rejects {Error} if the request fails for any reason.
|
|
926
|
-
*/
|
|
927
|
-
// For more information on the XMLCclRequest object, see the Cerner PowerChart
|
|
928
|
-
// documentation at https://wiki.cerner.com/pages/releaseview.action?spaceKey=MPDEVWIKI&title=XMLCCLREQUEST#Browsers--827740610
|
|
929
|
-
function makeCclRequestAsync(_x, _x2, _x3) {
|
|
930
|
-
return _makeCclRequestAsync.apply(this, arguments);
|
|
931
|
-
}
|
|
932
|
-
/**
|
|
933
|
-
* A function which processes the CCL request parameters, converting them to a string compatible with an XmlCclRequest.
|
|
934
|
-
* @param params {Array<CclCallParam|string|number>} An array of CclCallParam objects when explicitly defining
|
|
935
|
-
* type, or strings and numbers when implicitly defining type, each of which represents
|
|
936
|
-
* @param excludeMine {boolean} Determines whether or not to include the "MINE" parameter as the
|
|
937
|
-
* @returns {string} the XmlCclRequest compatible string.
|
|
938
|
-
* @throws {TypeError} if an invalid parameter type is passed.
|
|
939
|
-
*/
|
|
940
|
-
function _makeCclRequestAsync() {
|
|
941
|
-
_makeCclRequestAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(prg, params, excludeMine) {
|
|
942
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
943
|
-
while (1) switch (_context.prev = _context.next) {
|
|
944
|
-
case 0:
|
|
945
|
-
if (params === void 0) {
|
|
946
|
-
params = [];
|
|
947
|
-
}
|
|
948
|
-
if (!(prg.trim() === '')) {
|
|
949
|
-
_context.next = 3;
|
|
950
|
-
break;
|
|
951
|
-
}
|
|
952
|
-
throw new Error('The CCL program name cannot be empty.');
|
|
953
|
-
case 3:
|
|
954
|
-
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
|
955
|
-
var res = {
|
|
956
|
-
inPowerChart: true,
|
|
957
|
-
code: 418,
|
|
958
|
-
result: 'im a teapot',
|
|
959
|
-
status: 'uninitialized',
|
|
960
|
-
details: '',
|
|
961
|
-
data: undefined,
|
|
962
|
-
__request: undefined
|
|
963
|
-
};
|
|
964
|
-
try {
|
|
965
|
-
var req = window.external.XMLCclRequest();
|
|
966
|
-
req.onreadystatechange = function () {
|
|
967
|
-
var requestComplete = req.readyState === 4;
|
|
968
|
-
if (!requestComplete) return;
|
|
969
|
-
var successfulRequest = req.status >= 200 && req.status < 300;
|
|
970
|
-
if (successfulRequest) {
|
|
971
|
-
res.inPowerChart = true;
|
|
972
|
-
res.code = req.status;
|
|
973
|
-
res.result = statusCodeMap.get(req.status) || 'unknown';
|
|
974
|
-
res.status = readyStateMap.get(req.readyState) || 'unknown';
|
|
975
|
-
res.details = req.statusText;
|
|
976
|
-
res.data = parsedResponseText(req.responseText);
|
|
977
|
-
res.__request = req;
|
|
978
|
-
resolve(res);
|
|
979
|
-
} else {
|
|
980
|
-
reject(new Error("Request failed with status: " + req.status + " and status text: " + req.statusText));
|
|
981
|
-
}
|
|
982
|
-
};
|
|
983
|
-
req.onerror = function () {
|
|
984
|
-
reject(new Error('XMLCclRequest encountered a network error.'));
|
|
985
|
-
};
|
|
986
|
-
req.open('GET', "" + prg);
|
|
987
|
-
req.send(formattedParams(params, excludeMine));
|
|
988
|
-
} catch (e) {
|
|
989
|
-
if (outsideOfPowerChartError(e)) {
|
|
990
|
-
res.inPowerChart = false;
|
|
991
|
-
resolve(res);
|
|
992
|
-
} else {
|
|
993
|
-
reject(e);
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
}));
|
|
997
|
-
case 4:
|
|
998
|
-
case "end":
|
|
999
|
-
return _context.stop();
|
|
1000
|
-
}
|
|
1001
|
-
}, _callee);
|
|
1002
|
-
}));
|
|
1003
|
-
return _makeCclRequestAsync.apply(this, arguments);
|
|
1004
|
-
}
|
|
1005
|
-
function formattedParams(params, excludeMine) {
|
|
1006
|
-
params = params || [];
|
|
1007
|
-
var processedParams = params.map(function (param) {
|
|
1008
|
-
if (typeof param === 'string') {
|
|
1009
|
-
return {
|
|
1010
|
-
type: 'string',
|
|
1011
|
-
param: param
|
|
1012
|
-
};
|
|
1013
|
-
} else if (typeof param === 'number') {
|
|
1014
|
-
return {
|
|
1015
|
-
type: 'number',
|
|
1016
|
-
param: param
|
|
1017
|
-
};
|
|
1018
|
-
} else if (typeof param === 'object' && param.param && param.type) {
|
|
1019
|
-
return param;
|
|
1020
|
-
} else {
|
|
1021
|
-
throw new TypeError("makeCclRequestAsync params can only be string, number, or CclCallParam");
|
|
1022
|
-
}
|
|
1023
|
-
});
|
|
1024
|
-
var mineParam = {
|
|
1025
|
-
type: 'string',
|
|
1026
|
-
param: 'MINE'
|
|
1027
|
-
};
|
|
1028
|
-
if (!excludeMine) {
|
|
1029
|
-
processedParams.unshift(mineParam);
|
|
1030
|
-
}
|
|
1031
|
-
var paramString = processedParams.map(function (_ref) {
|
|
1032
|
-
var type = _ref.type,
|
|
1033
|
-
param = _ref.param;
|
|
1034
|
-
return type === 'string' ? "'" + param + "'" : param;
|
|
1035
|
-
}).join(',');
|
|
1036
|
-
return paramString;
|
|
1037
|
-
}
|
|
1038
|
-
/**
|
|
1039
|
-
* Parse the response text from an XmlCclRequest into a JSON object, if possible.
|
|
1040
|
-
* @param responseText - the response text from the XmlCclRequest.
|
|
1041
|
-
* @returns a parsed JSON object or undefined if the response text is not valid JSON.
|
|
1042
|
-
*/
|
|
1043
|
-
function parsedResponseText(responseText) {
|
|
1044
|
-
try {
|
|
1045
|
-
return JSON.parse(responseText);
|
|
1046
|
-
} catch (e) {
|
|
1047
|
-
if (e instanceof SyntaxError) {
|
|
1048
|
-
return undefined;
|
|
1049
|
-
} else {
|
|
1050
|
-
throw e;
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
var readyStateMap = /*#__PURE__*/new Map();
|
|
1055
|
-
readyStateMap.set(0, 'uninitialized');
|
|
1056
|
-
readyStateMap.set(1, 'loading');
|
|
1057
|
-
readyStateMap.set(2, 'loaded');
|
|
1058
|
-
readyStateMap.set(3, 'interactive');
|
|
1059
|
-
readyStateMap.set(4, 'completed');
|
|
1060
|
-
var statusCodeMap = /*#__PURE__*/new Map();
|
|
1061
|
-
statusCodeMap.set(200, 'success');
|
|
1062
|
-
statusCodeMap.set(405, 'method not allowed');
|
|
1063
|
-
statusCodeMap.set(409, 'invalid state');
|
|
1064
|
-
statusCodeMap.set(418, 'im a teapot');
|
|
1065
|
-
statusCodeMap.set(492, 'non-fatal error');
|
|
1066
|
-
statusCodeMap.set(493, 'memory error');
|
|
1067
|
-
statusCodeMap.set(500, 'internal server exception');
|
|
1068
|
-
|
|
1069
914
|
/**
|
|
1070
915
|
* Managed appointments in PowerChart. For any given appointment ID, the
|
|
1071
916
|
* following actions can be performed: check in, check out, cancel, no show,
|
|
@@ -2397,6 +2242,12 @@ var isStandaloneOrder = function isStandaloneOrder(o) {
|
|
|
2397
2242
|
return o.hasOwnProperty('synonymId') && o.hasOwnProperty('origination');
|
|
2398
2243
|
};
|
|
2399
2244
|
|
|
2245
|
+
Object.defineProperty(exports, 'makeCclRequestAsync', {
|
|
2246
|
+
enumerable: true,
|
|
2247
|
+
get: function () {
|
|
2248
|
+
return easyCclRequest.makeCclRequestAsync;
|
|
2249
|
+
}
|
|
2250
|
+
});
|
|
2400
2251
|
exports.addAddendumToDocumentAsync = addAddendumToDocumentAsync;
|
|
2401
2252
|
exports.createNewDocumentAsync = createNewDocumentAsync;
|
|
2402
2253
|
exports.getValidEncountersAsync = getValidEncountersAsync;
|
|
@@ -2405,7 +2256,6 @@ exports.launchDischargeProcessAsync = launchDischargeProcessAsync;
|
|
|
2405
2256
|
exports.launchPatientEducationAsync = launchPatientEducationAsync;
|
|
2406
2257
|
exports.launchPowerFormAsync = launchPowerFormAsync;
|
|
2407
2258
|
exports.launchPowerNoteAsync = launchPowerNoteAsync;
|
|
2408
|
-
exports.makeCclRequestAsync = makeCclRequestAsync;
|
|
2409
2259
|
exports.manageAppointmentAsync = manageAppointmentAsync;
|
|
2410
2260
|
exports.openApplicationAsync = openApplicationAsync;
|
|
2411
2261
|
exports.openOrganizerTabAsync = openOrganizerTabAsync;
|