oro-sdk 2.2.0 → 2.2.1

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.
Files changed (63) hide show
  1. package/README.md +26 -34
  2. package/dist/client.d.ts +4 -4
  3. package/dist/helpers/client.d.ts +1 -1
  4. package/dist/helpers/patient-registration.d.ts +1 -1
  5. package/dist/helpers/vault-grants.d.ts +1 -1
  6. package/dist/helpers/workflow.d.ts +1 -1
  7. package/dist/index.d.ts +15 -1
  8. package/dist/models/client.d.ts +1 -1
  9. package/dist/models/error.d.ts +0 -14
  10. package/dist/models/index.d.ts +0 -7
  11. package/dist/oro-sdk.cjs.development.js +313 -2367
  12. package/dist/oro-sdk.cjs.development.js.map +1 -1
  13. package/dist/oro-sdk.cjs.production.min.js +1 -1
  14. package/dist/oro-sdk.cjs.production.min.js.map +1 -1
  15. package/dist/oro-sdk.esm.js +246 -2344
  16. package/dist/oro-sdk.esm.js.map +1 -1
  17. package/dist/sdk-revision/client.d.ts +2 -2
  18. package/dist/services/index.d.ts +0 -9
  19. package/package.json +4 -1
  20. package/src/client.ts +161 -435
  21. package/src/helpers/client.ts +1 -1
  22. package/src/helpers/patient-registration.ts +85 -166
  23. package/src/helpers/vault-grants.ts +1 -1
  24. package/src/helpers/workflow.ts +21 -59
  25. package/src/index.ts +42 -28
  26. package/src/models/client.ts +1 -1
  27. package/src/models/error.ts +6 -13
  28. package/src/models/index.ts +0 -7
  29. package/src/sdk-revision/client.ts +25 -20
  30. package/src/services/external/clinia.ts +1 -1
  31. package/src/services/index.ts +0 -9
  32. package/dist/models/consult.d.ts +0 -102
  33. package/dist/models/diagnosis.d.ts +0 -122
  34. package/dist/models/guard.d.ts +0 -119
  35. package/dist/models/practice.d.ts +0 -353
  36. package/dist/models/shared.d.ts +0 -8
  37. package/dist/models/vault.d.ts +0 -124
  38. package/dist/models/workflow.d.ts +0 -106
  39. package/dist/services/api.d.ts +0 -11
  40. package/dist/services/axios.d.ts +0 -14
  41. package/dist/services/consult.d.ts +0 -54
  42. package/dist/services/diagnosis.d.ts +0 -44
  43. package/dist/services/guard.d.ts +0 -92
  44. package/dist/services/practice.d.ts +0 -100
  45. package/dist/services/teller.d.ts +0 -9
  46. package/dist/services/vault.d.ts +0 -54
  47. package/dist/services/workflow.d.ts +0 -21
  48. package/src/models/consult.ts +0 -110
  49. package/src/models/diagnosis.ts +0 -141
  50. package/src/models/guard.ts +0 -136
  51. package/src/models/practice.ts +0 -411
  52. package/src/models/shared.ts +0 -6
  53. package/src/models/vault.ts +0 -158
  54. package/src/models/workflow.ts +0 -142
  55. package/src/services/api.ts +0 -77
  56. package/src/services/axios.ts +0 -91
  57. package/src/services/consult.ts +0 -265
  58. package/src/services/diagnosis.ts +0 -144
  59. package/src/services/guard.ts +0 -228
  60. package/src/services/practice.ts +0 -537
  61. package/src/services/teller.ts +0 -39
  62. package/src/services/vault.ts +0 -178
  63. package/src/services/workflow.ts +0 -36
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
6
 
7
- var axios = _interopDefault(require('axios'));
8
- var createAuthRefreshInterceptor = _interopDefault(require('axios-auth-refresh'));
7
+ var initApis = require('oro-sdk-apis');
8
+ var initApis__default = _interopDefault(initApis);
9
9
  var oroToolbox = require('oro-toolbox');
10
10
  var idbKeyval = require('idb-keyval');
11
11
 
@@ -235,14 +235,6 @@ function _objectWithoutPropertiesLoose(source, excluded) {
235
235
  return target;
236
236
  }
237
237
 
238
- function _assertThisInitialized(self) {
239
- if (self === void 0) {
240
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
241
- }
242
-
243
- return self;
244
- }
245
-
246
238
  function _unsupportedIterableToArray(o, minLen) {
247
239
  if (!o) return;
248
240
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -918,2296 +910,131 @@ var runtime = (function (exports) {
918
910
  }
919
911
  }
920
912
 
921
- if (finallyEntry &&
922
- (type === "break" ||
923
- type === "continue") &&
924
- finallyEntry.tryLoc <= arg &&
925
- arg <= finallyEntry.finallyLoc) {
926
- // Ignore the finally entry if control is not jumping to a
927
- // location outside the try/catch block.
928
- finallyEntry = null;
929
- }
930
-
931
- var record = finallyEntry ? finallyEntry.completion : {};
932
- record.type = type;
933
- record.arg = arg;
934
-
935
- if (finallyEntry) {
936
- this.method = "next";
937
- this.next = finallyEntry.finallyLoc;
938
- return ContinueSentinel;
939
- }
940
-
941
- return this.complete(record);
942
- },
943
-
944
- complete: function(record, afterLoc) {
945
- if (record.type === "throw") {
946
- throw record.arg;
947
- }
948
-
949
- if (record.type === "break" ||
950
- record.type === "continue") {
951
- this.next = record.arg;
952
- } else if (record.type === "return") {
953
- this.rval = this.arg = record.arg;
954
- this.method = "return";
955
- this.next = "end";
956
- } else if (record.type === "normal" && afterLoc) {
957
- this.next = afterLoc;
958
- }
959
-
960
- return ContinueSentinel;
961
- },
962
-
963
- finish: function(finallyLoc) {
964
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
965
- var entry = this.tryEntries[i];
966
- if (entry.finallyLoc === finallyLoc) {
967
- this.complete(entry.completion, entry.afterLoc);
968
- resetTryEntry(entry);
969
- return ContinueSentinel;
970
- }
971
- }
972
- },
973
-
974
- "catch": function(tryLoc) {
975
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
976
- var entry = this.tryEntries[i];
977
- if (entry.tryLoc === tryLoc) {
978
- var record = entry.completion;
979
- if (record.type === "throw") {
980
- var thrown = record.arg;
981
- resetTryEntry(entry);
982
- }
983
- return thrown;
984
- }
985
- }
986
-
987
- // The context.catch method must only be called with a location
988
- // argument that corresponds to a known catch block.
989
- throw new Error("illegal catch attempt");
990
- },
991
-
992
- delegateYield: function(iterable, resultName, nextLoc) {
993
- this.delegate = {
994
- iterator: values(iterable),
995
- resultName: resultName,
996
- nextLoc: nextLoc
997
- };
998
-
999
- if (this.method === "next") {
1000
- // Deliberately forget the last sent value so that we don't
1001
- // accidentally pass it on to the delegate.
1002
- this.arg = undefined$1;
1003
- }
1004
-
1005
- return ContinueSentinel;
1006
- }
1007
- };
1008
-
1009
- // Regardless of whether this script is executing as a CommonJS module
1010
- // or not, return the runtime object so that we can declare the variable
1011
- // regeneratorRuntime in the outer scope, which allows this module to be
1012
- // injected easily by `bin/regenerator --include-runtime script.js`.
1013
- return exports;
1014
-
1015
- }(
1016
- // If this script is executing as a CommonJS module, use module.exports
1017
- // as the regeneratorRuntime namespace. Otherwise create a new empty
1018
- // object. Either way, the resulting object will be used to initialize
1019
- // the regeneratorRuntime variable at the top of this file.
1020
- module.exports
1021
- ));
1022
-
1023
- try {
1024
- regeneratorRuntime = runtime;
1025
- } catch (accidentalStrictMode) {
1026
- // This module should not be running in strict mode, so the above
1027
- // assignment should always work unless something is misconfigured. Just
1028
- // in case runtime.js accidentally runs in strict mode, in modern engines
1029
- // we can explicitly access globalThis. In older engines we can escape
1030
- // strict mode using a global Function call. This could conceivably fail
1031
- // if a Content Security Policy forbids using Function, but in that case
1032
- // the proper solution is to fix the accidental strict mode problem. If
1033
- // you've misconfigured your bundler to force strict mode and applied a
1034
- // CSP to forbid Function, and you're not willing to fix either of those
1035
- // problems, please detail your unique predicament in a GitHub issue.
1036
- if (typeof globalThis === "object") {
1037
- globalThis.regeneratorRuntime = runtime;
1038
- } else {
1039
- Function("r", "regeneratorRuntime = r")(runtime);
1040
- }
1041
- }
1042
- });
1043
-
1044
- var AxiosService = /*#__PURE__*/function () {
1045
- function AxiosService(config) {
1046
- if (!config) config = {};
1047
- this.axios = axios.create(config);
1048
- }
1049
-
1050
- var _proto = AxiosService.prototype;
1051
-
1052
- _proto.apiRequest = /*#__PURE__*/function () {
1053
- var _apiRequest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(config, url, data) {
1054
- return runtime_1.wrap(function _callee$(_context) {
1055
- while (1) {
1056
- switch (_context.prev = _context.next) {
1057
- case 0:
1058
- if (!config.headers) config.headers = {};
1059
- config.headers['Content-Type'] = 'application/json';
1060
- return _context.abrupt("return", this.axios(_extends({}, config, {
1061
- url: url,
1062
- data: data
1063
- })).then(function (res) {
1064
- return res.data;
1065
- }));
1066
-
1067
- case 3:
1068
- case "end":
1069
- return _context.stop();
1070
- }
1071
- }
1072
- }, _callee, this);
1073
- }));
1074
-
1075
- function apiRequest(_x, _x2, _x3) {
1076
- return _apiRequest.apply(this, arguments);
1077
- }
1078
-
1079
- return apiRequest;
1080
- }();
1081
-
1082
- _proto.apiRequestHeader = /*#__PURE__*/function () {
1083
- var _apiRequestHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(config, url, headerToRetrieve, data) {
1084
- return runtime_1.wrap(function _callee2$(_context2) {
1085
- while (1) {
1086
- switch (_context2.prev = _context2.next) {
1087
- case 0:
1088
- if (!config.headers) config.headers = {};
1089
- config.headers['Content-Type'] = 'application/json';
1090
- return _context2.abrupt("return", this.axios(_extends({}, config, {
1091
- url: url,
1092
- data: data
1093
- })).then(function (res) {
1094
- if (headerToRetrieve) {
1095
- var _res$headers$headerTo;
1096
-
1097
- return (_res$headers$headerTo = res.headers[headerToRetrieve]) != null ? _res$headers$headerTo : res.headers[headerToRetrieve.toLowerCase()];
1098
- }
1099
-
1100
- return res.headers;
1101
- }));
1102
-
1103
- case 3:
1104
- case "end":
1105
- return _context2.stop();
1106
- }
1107
- }
1108
- }, _callee2, this);
1109
- }));
1110
-
1111
- function apiRequestHeader(_x4, _x5, _x6, _x7) {
1112
- return _apiRequestHeader.apply(this, arguments);
1113
- }
1114
-
1115
- return apiRequestHeader;
1116
- }();
1117
-
1118
- _proto.get = function get(url, config) {
1119
- return this.apiRequest(_extends({}, config, {
1120
- method: 'get'
1121
- }), url);
1122
- };
1123
-
1124
- _proto.deleteRequest = function deleteRequest(url, config) {
1125
- return this.apiRequest(_extends({}, config, {
1126
- method: 'delete'
1127
- }), url);
1128
- };
1129
-
1130
- _proto.post = function post(url, data, config) {
1131
- return this.apiRequest(_extends({}, config, {
1132
- method: 'post'
1133
- }), url, data);
1134
- };
1135
-
1136
- _proto.put = function put(url, data, config) {
1137
- return this.apiRequest(_extends({}, config, {
1138
- method: 'put'
1139
- }), url, data);
1140
- };
1141
-
1142
- _proto.patch = function patch(url, data, config) {
1143
- return this.apiRequest(_extends({}, config, {
1144
- method: 'patch'
1145
- }), url, data);
1146
- };
1147
-
1148
- _proto.head = function head(url, config, headerToRetrieve, data) {
1149
- return this.apiRequestHeader(_extends({}, config, {
1150
- method: 'head'
1151
- }), url, headerToRetrieve, data);
1152
- };
1153
-
1154
- return AxiosService;
1155
- }();
1156
-
1157
- var APIService = /*#__PURE__*/function (_AxiosService) {
1158
- _inheritsLoose(APIService, _AxiosService);
1159
-
1160
- function APIService(config, tokenRefreshFailureCallback) {
1161
- var _this;
1162
-
1163
- _this = _AxiosService.call(this, config) || this;
1164
- _this.tokenRefreshFailureCallback = tokenRefreshFailureCallback;
1165
-
1166
- var self = _assertThisInitialized(_this);
1167
-
1168
- _this.axios.interceptors.request.use(function (config) {
1169
- var token = config.useRefreshToken ? self.getTokens().refreshToken : self.getTokens().accessToken;
1170
- config.headers = _extends({}, config.headers, {
1171
- Authorization: "Bearer " + token
1172
- });
1173
- return config;
1174
- }, function (error) {
1175
- Promise.reject(error);
1176
- });
1177
-
1178
- createAuthRefreshInterceptor(_this.axios, /*#__PURE__*/function () {
1179
- var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(failedRequest) {
1180
- var tokenResp;
1181
- return runtime_1.wrap(function _callee$(_context) {
1182
- while (1) {
1183
- switch (_context.prev = _context.next) {
1184
- case 0:
1185
- if (!self.authRefreshFn) {
1186
- _context.next = 15;
1187
- break;
1188
- }
1189
-
1190
- _context.prev = 1;
1191
- _context.next = 4;
1192
- return self.authRefreshFn(self.getTokens().refreshToken);
1193
-
1194
- case 4:
1195
- tokenResp = _context.sent;
1196
- self.setTokens({
1197
- accessToken: tokenResp.accessToken,
1198
- refreshToken: tokenResp.refreshToken
1199
- });
1200
- failedRequest.response.config.headers['Authorization'] = "Bearer " + self.getTokens().accessToken;
1201
- return _context.abrupt("return", Promise.resolve());
1202
-
1203
- case 10:
1204
- _context.prev = 10;
1205
- _context.t0 = _context["catch"](1);
1206
- console.error('an error occured while refreshing tokens (notifying callback)', _context.t0);
1207
- if (self.tokenRefreshFailureCallback) self.tokenRefreshFailureCallback(failedRequest);
1208
- return _context.abrupt("return", Promise.resolve());
1209
-
1210
- case 15:
1211
- console.error('The request could not refresh the token (authRefreshFn was not set)', failedRequest);
1212
- return _context.abrupt("return", Promise.resolve());
1213
-
1214
- case 17:
1215
- case "end":
1216
- return _context.stop();
1217
- }
1218
- }
1219
- }, _callee, null, [[1, 10]]);
1220
- }));
1221
-
1222
- return function (_x) {
1223
- return _ref.apply(this, arguments);
1224
- };
1225
- }(), {
1226
- statusCodes: [401, 403]
1227
- });
1228
- return _this;
1229
- }
1230
-
1231
- var _proto = APIService.prototype;
1232
-
1233
- _proto.setAuthRefreshFn = function setAuthRefreshFn(fn) {
1234
- this.authRefreshFn = fn;
1235
- };
1236
-
1237
- _proto.setTokens = function setTokens(tokens) {
1238
- localStorage.setItem('tokens', JSON.stringify(tokens));
1239
- };
1240
-
1241
- _proto.getTokens = function getTokens() {
1242
- var tokens = {};
1243
- var item = localStorage.getItem('tokens');
1244
-
1245
- if (item) {
1246
- tokens = JSON.parse(item);
1247
- }
1248
-
1249
- return tokens;
1250
- };
1251
-
1252
- return APIService;
1253
- }(AxiosService);
1254
-
1255
- (function (AssistantType) {
1256
- AssistantType["MedicalSecretary"] = "MedicalSecretary";
1257
- AssistantType["Nurse"] = "Nurse";
1258
- AssistantType["Specialist"] = "Specialist";
1259
- AssistantType["Administrative"] = "Administrative";
1260
- AssistantType["Other"] = "Other";
1261
- })(exports.AssistantType || (exports.AssistantType = {}));
1262
-
1263
- (function (TransmissionKind) {
1264
- TransmissionKind["Fax"] = "Fax";
1265
- TransmissionKind["Email"] = "Email";
1266
- TransmissionKind["SMS"] = "SMS";
1267
- TransmissionKind["EncryptedEmail"] = "EncryptedEmail";
1268
- TransmissionKind["Logs"] = "Logs";
1269
- TransmissionKind["API"] = "API";
1270
- TransmissionKind["Other"] = "Other";
1271
- })(exports.TransmissionKind || (exports.TransmissionKind = {}));
1272
-
1273
- (function (TransmissionStatus) {
1274
- TransmissionStatus["Preparing"] = "Preparing";
1275
- TransmissionStatus["Sending"] = "Sending";
1276
- TransmissionStatus["Sent"] = "Sent";
1277
- TransmissionStatus["Retrying"] = "Retrying";
1278
- TransmissionStatus["Failed"] = "Failed";
1279
- TransmissionStatus["DriverError"] = "DriverError";
1280
- TransmissionStatus["TimedOut"] = "TimedOut";
1281
- TransmissionStatus["ReceiverNotExist"] = "ReceiverNotExist";
1282
- TransmissionStatus["ReceiverNotAnswering"] = "ReceiverNotAnswering";
1283
- TransmissionStatus["ReceiverIncompatible"] = "ReceiverIncompatible";
1284
- })(exports.TransmissionStatus || (exports.TransmissionStatus = {}));
1285
-
1286
- (function (FeeStatus) {
1287
- FeeStatus["NoFee"] = "NoFee";
1288
- FeeStatus["Pending"] = "Pending";
1289
- FeeStatus["Paid"] = "Paid";
1290
- FeeStatus["Reimbursed"] = "Reimbursed";
1291
- FeeStatus["Cancelled"] = "Cancelled";
1292
- FeeStatus["Contested"] = "Contested";
1293
- })(exports.FeeStatus || (exports.FeeStatus = {}));
1294
-
1295
- (function (MedicalStatus) {
1296
- MedicalStatus["Creating"] = "Creating";
1297
- MedicalStatus["New"] = "New";
1298
- MedicalStatus["ToAnswer"] = "ToAnswer";
1299
- MedicalStatus["Answered"] = "Answered";
1300
- MedicalStatus["Closed"] = "Closed";
1301
- MedicalStatus["Reopened"] = "Reopened";
1302
- MedicalStatus["Archived"] = "Archived";
1303
- })(exports.MedicalStatus || (exports.MedicalStatus = {}));
1304
-
1305
- (function (TaskStatus) {
1306
- TaskStatus["None"] = "None";
1307
- TaskStatus["ToDo"] = "ToDo";
1308
- TaskStatus["InProgress"] = "InProgress";
1309
- TaskStatus["Blocked"] = "Blocked";
1310
- TaskStatus["Done"] = "Done";
1311
- })(exports.TaskStatus || (exports.TaskStatus = {}));
1312
-
1313
- (function (DiagnosisType) {
1314
- DiagnosisType["Generic"] = "Generic";
1315
- DiagnosisType["Private"] = "Private";
1316
- DiagnosisType["Instance"] = "Instance";
1317
- })(exports.DiagnosisType || (exports.DiagnosisType = {}));
1318
-
1319
- (function (DrugType) {
1320
- DrugType["Generic"] = "Generic";
1321
- DrugType["Instance"] = "Instance";
1322
- })(exports.DrugType || (exports.DrugType = {}));
1323
-
1324
- (function (PlanStatus) {
1325
- PlanStatus["Pending"] = "Pending";
1326
- PlanStatus["Accepted"] = "Accepted";
1327
- PlanStatus["Rejected"] = "Rejected";
1328
- })(exports.PlanStatus || (exports.PlanStatus = {}));
1329
-
1330
- var IncompleteAuthentication = /*#__PURE__*/function (_Error) {
1331
- _inheritsLoose(IncompleteAuthentication, _Error);
1332
-
1333
- function IncompleteAuthentication() {
1334
- return _Error.apply(this, arguments) || this;
1335
- }
1336
-
1337
- return IncompleteAuthentication;
1338
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1339
- var MissingGrant = /*#__PURE__*/function (_Error2) {
1340
- _inheritsLoose(MissingGrant, _Error2);
1341
-
1342
- function MissingGrant() {
1343
- return _Error2.apply(this, arguments) || this;
1344
- }
1345
-
1346
- return MissingGrant;
1347
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1348
- var MissingLockbox = /*#__PURE__*/function (_Error3) {
1349
- _inheritsLoose(MissingLockbox, _Error3);
1350
-
1351
- function MissingLockbox() {
1352
- return _Error3.apply(this, arguments) || this;
1353
- }
1354
-
1355
- return MissingLockbox;
1356
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1357
- var MissingLockboxOwner = /*#__PURE__*/function (_Error4) {
1358
- _inheritsLoose(MissingLockboxOwner, _Error4);
1359
-
1360
- function MissingLockboxOwner() {
1361
- return _Error4.apply(this, arguments) || this;
1362
- }
1363
-
1364
- return MissingLockboxOwner;
1365
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1366
- var IndexBuildError = /*#__PURE__*/function (_Error5) {
1367
- _inheritsLoose(IndexBuildError, _Error5);
1368
-
1369
- function IndexBuildError() {
1370
- return _Error5.apply(this, arguments) || this;
1371
- }
1372
-
1373
- return IndexBuildError;
1374
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1375
- var AssociatedLockboxNotFound = /*#__PURE__*/function (_Error6) {
1376
- _inheritsLoose(AssociatedLockboxNotFound, _Error6);
1377
-
1378
- function AssociatedLockboxNotFound() {
1379
- return _Error6.apply(this, arguments) || this;
1380
- }
1381
-
1382
- return AssociatedLockboxNotFound;
1383
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1384
- var WorkflowAnswersMissingError = /*#__PURE__*/function (_Error7) {
1385
- _inheritsLoose(WorkflowAnswersMissingError, _Error7);
1386
-
1387
- function WorkflowAnswersMissingError() {
1388
- return _Error7.apply(this, arguments) || this;
1389
- }
1390
-
1391
- return WorkflowAnswersMissingError;
1392
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1393
- var AuthenticationFailed = /*#__PURE__*/function (_Error8) {
1394
- _inheritsLoose(AuthenticationFailed, _Error8);
1395
-
1396
- function AuthenticationFailed() {
1397
- return _Error8.apply(this, arguments) || this;
1398
- }
1399
-
1400
- return AuthenticationFailed;
1401
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1402
- var AuthenticationBadRequest = /*#__PURE__*/function (_Error9) {
1403
- _inheritsLoose(AuthenticationBadRequest, _Error9);
1404
-
1405
- function AuthenticationBadRequest() {
1406
- return _Error9.apply(this, arguments) || this;
1407
- }
1408
-
1409
- return AuthenticationBadRequest;
1410
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1411
- var AuthenticationServerError = /*#__PURE__*/function (_Error10) {
1412
- _inheritsLoose(AuthenticationServerError, _Error10);
1413
-
1414
- function AuthenticationServerError() {
1415
- return _Error10.apply(this, arguments) || this;
1416
- }
1417
-
1418
- return AuthenticationServerError;
1419
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1420
- var IdentityCreationFailed = /*#__PURE__*/function (_Error11) {
1421
- _inheritsLoose(IdentityCreationFailed, _Error11);
1422
-
1423
- function IdentityCreationFailed() {
1424
- return _Error11.apply(this, arguments) || this;
1425
- }
1426
-
1427
- return IdentityCreationFailed;
1428
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1429
- var IdentityCreationBadRequest = /*#__PURE__*/function (_Error12) {
1430
- _inheritsLoose(IdentityCreationBadRequest, _Error12);
1431
-
1432
- function IdentityCreationBadRequest() {
1433
- return _Error12.apply(this, arguments) || this;
1434
- }
1435
-
1436
- return IdentityCreationBadRequest;
1437
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1438
- var IdentityCreationConflict = /*#__PURE__*/function (_Error13) {
1439
- _inheritsLoose(IdentityCreationConflict, _Error13);
1440
-
1441
- function IdentityCreationConflict() {
1442
- return _Error13.apply(this, arguments) || this;
1443
- }
1444
-
1445
- return IdentityCreationConflict;
1446
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1447
-
1448
- (function (WorkflowType) {
1449
- WorkflowType["Onboard"] = "Onboard";
1450
- WorkflowType["Followup"] = "Followup";
1451
- WorkflowType["Renew"] = "Renew";
1452
- WorkflowType["DataRetrieve"] = "DataRetrieve";
1453
- })(exports.WorkflowType || (exports.WorkflowType = {}));
1454
-
1455
- (function (RateDimension) {
1456
- RateDimension["RatioOnTotal"] = "RatioOnTotal";
1457
- RateDimension["FixedOnTotal"] = "FixedOnTotal";
1458
- RateDimension["RatioPlatformFee"] = "RatioPlatformFee";
1459
- RateDimension["FixedPlatformFee"] = "FixedPlatformFee";
1460
- RateDimension["RatioOnPlatformFeeTotal"] = "RatioOnPlatformFeeTotal";
1461
- RateDimension["FixedOnPlatformFeeTotal"] = "FixedOnPlatformFeeTotal";
1462
- RateDimension["RatioOnItem"] = "RatioOnItem";
1463
- RateDimension["FixedOnItem"] = "FixedOnItem";
1464
- })(exports.RateDimension || (exports.RateDimension = {}));
1465
-
1466
- (function (PlanType) {
1467
- PlanType["Onboard"] = "Onboard";
1468
- PlanType["Followup"] = "Followup";
1469
- PlanType["Renew"] = "Renew";
1470
- PlanType["DataRetrieve"] = "DataRetrieve";
1471
- })(exports.PlanType || (exports.PlanType = {}));
1472
-
1473
- (function (PaymentStatus) {
1474
- PaymentStatus["Pending"] = "Pending";
1475
- PaymentStatus["Success"] = "Success";
1476
- PaymentStatus["Failure"] = "Failure";
1477
- PaymentStatus["Canceled"] = "Canceled";
1478
- })(exports.PaymentStatus || (exports.PaymentStatus = {}));
1479
-
1480
- (function (PractitionerStatus) {
1481
- PractitionerStatus["Practicing"] = "Practicing";
1482
- PractitionerStatus["Retired"] = "Retired";
1483
- PractitionerStatus["NotInvolvedAnymore"] = "NotInvolvedAnymore";
1484
- PractitionerStatus["Deactivated"] = "Deactivated";
1485
- PractitionerStatus["Flagged"] = "Flagged";
1486
- PractitionerStatus["InConflict"] = "InConflict";
1487
- PractitionerStatus["Delicensed"] = "Delicensed";
1488
- })(exports.PractitionerStatus || (exports.PractitionerStatus = {}));
1489
-
1490
- (function (AssignmentStatus) {
1491
- AssignmentStatus["Assigned"] = "Assigned";
1492
- AssignmentStatus["Reassigned"] = "Reassigned";
1493
- AssignmentStatus["Cancelled"] = "Cancelled";
1494
- })(exports.AssignmentStatus || (exports.AssignmentStatus = {}));
1495
-
1496
- (function (PractitionnerRoleType) {
1497
- PractitionnerRoleType["Doctor"] = "Doctor";
1498
- PractitionnerRoleType["MedicalAssistant"] = "MedicalAssistant";
1499
- PractitionnerRoleType["MedicalSecretary"] = "MedicalSecretary";
1500
- PractitionnerRoleType["Nurse"] = "Nurse";
1501
- PractitionnerRoleType["Specialist"] = "Specialist";
1502
- PractitionnerRoleType["LabAssistant"] = "LabAssistant";
1503
- PractitionnerRoleType["Administrative"] = "Administrative";
1504
- PractitionnerRoleType["ManualDispatcher"] = "ManualDispatcher";
1505
- PractitionnerRoleType["Other"] = "Other";
1506
- })(exports.PractitionnerRoleType || (exports.PractitionnerRoleType = {}));
1507
-
1508
- (function (OtherRoleType) {
1509
- OtherRoleType["Patient"] = "Patient";
1510
- OtherRoleType["User"] = "User";
1511
- OtherRoleType["System"] = "System";
1512
- })(exports.OtherRoleType || (exports.OtherRoleType = {}));
1513
-
1514
- (function (LicenseStatus) {
1515
- LicenseStatus["Valid"] = "Valid";
1516
- LicenseStatus["Invalid"] = "Invalid";
1517
- LicenseStatus["Expired"] = "Expired";
1518
- LicenseStatus["NA"] = "NA";
1519
- LicenseStatus["Removed"] = "Removed";
1520
- })(exports.LicenseStatus || (exports.LicenseStatus = {}));
1521
-
1522
- (function (PeriodType) {
1523
- PeriodType["PerYear"] = "PerYear";
1524
- PeriodType["PerQuarter"] = "PerQuarter";
1525
- PeriodType["PerMonth"] = "PerMonth";
1526
- PeriodType["PerWeek"] = "PerWeek";
1527
- PeriodType["PerBusinessDay"] = "PerBusinessDay";
1528
- PeriodType["PerDay"] = "PerDay";
1529
- PeriodType["PerHour"] = "PerHour";
1530
- })(exports.PeriodType || (exports.PeriodType = {}));
1531
-
1532
- (function (SyncStatus) {
1533
- SyncStatus["Requested"] = "Requested";
1534
- SyncStatus["Started"] = "Started";
1535
- SyncStatus["Succeeded"] = "Succeeded";
1536
- SyncStatus["Failed"] = "Failed";
1537
- SyncStatus["Cancelled"] = "Cancelled";
1538
- })(exports.SyncStatus || (exports.SyncStatus = {}));
1539
-
1540
- (function (PracticeEmailKind) {
1541
- PracticeEmailKind["SignedUp"] = "SignedUp";
1542
- PracticeEmailKind["Onboarded"] = "Onboarded";
1543
- PracticeEmailKind["OnboardedPractitioner"] = "OnboardedPractitioner";
1544
- PracticeEmailKind["OnboardedPatient"] = "OnboardedPatient";
1545
- PracticeEmailKind["Answered"] = "Answered";
1546
- PracticeEmailKind["ToAnswer"] = "ToAnswer";
1547
- PracticeEmailKind["FollowedUp"] = "FollowedUp";
1548
- PracticeEmailKind["Renewed"] = "Renewed";
1549
- PracticeEmailKind["DataRetrieved"] = "DataRetrieved";
1550
- })(exports.PracticeEmailKind || (exports.PracticeEmailKind = {}));
1551
-
1552
- (function (PracticeConfigKind) {
1553
- PracticeConfigKind["PractitionerConsultList"] = "PractitionerConsultList";
1554
- PracticeConfigKind["PractitionerChatbox"] = "PractitionerChatbox";
1555
- PracticeConfigKind["PracticeTheme"] = "PracticeTheme";
1556
- PracticeConfigKind["PracticeLocaleSwitcher"] = "PracticeLocaleSwitcher";
1557
- PracticeConfigKind["PracticeCookieBanner"] = "PracticeCookieBanner";
1558
- })(exports.PracticeConfigKind || (exports.PracticeConfigKind = {}));
1559
-
1560
- (function (StripePriceType) {
1561
- StripePriceType["Default"] = "Default";
1562
- StripePriceType["Discount"] = "Discount";
1563
- })(exports.StripePriceType || (exports.StripePriceType = {}));
1564
-
1565
- (function (IndexKey) {
1566
- IndexKey["Consultation"] = "Consultation";
1567
- IndexKey["IndexSnapshot"] = "IndexSnapshot";
1568
- IndexKey["ConsultationLockbox"] = "ConsultationLockbox";
1569
- })(exports.IndexKey || (exports.IndexKey = {}));
1570
-
1571
- (function (DocumentType) {
1572
- DocumentType["Message"] = "Message";
1573
- DocumentType["Note"] = "Note";
1574
- DocumentType["DoctorsNote"] = "DoctorsNote";
1575
- DocumentType["Prescription"] = "Prescription";
1576
- DocumentType["ExamRequest"] = "ExamRequest";
1577
- DocumentType["Result"] = "Result";
1578
- DocumentType["Attachment"] = "Attachment";
1579
- DocumentType["BigFile"] = "BigFile";
1580
- DocumentType["MeetingRequest"] = "MeetingRequest";
1581
- DocumentType["AudioNote"] = "AudioNote";
1582
- DocumentType["VideoNote"] = "VideoNote";
1583
- DocumentType["PopulatedWorkflowData"] = "PopulatedWorkflowData";
1584
- DocumentType["TreatmentPlan"] = "TreatmentPlan";
1585
- DocumentType["ImageAlias"] = "ImageAlias";
1586
- })(exports.DocumentType || (exports.DocumentType = {}));
1587
-
1588
- (function (MetadataCategory) {
1589
- MetadataCategory["ChildPersonal"] = "ChildPersonal";
1590
- MetadataCategory["Consultation"] = "Consultation";
1591
- MetadataCategory["DataRetrieval"] = "DataRetrieval";
1592
- MetadataCategory["Followup"] = "Followup";
1593
- MetadataCategory["Recovery"] = "Recovery";
1594
- MetadataCategory["Medical"] = "Medical";
1595
- MetadataCategory["OtherPersonal"] = "OtherPersonal";
1596
- MetadataCategory["Personal"] = "Personal";
1597
- MetadataCategory["Preference"] = "Preference";
1598
- MetadataCategory["Prescription"] = "Prescription";
1599
- MetadataCategory["Raw"] = "Raw";
1600
- })(exports.MetadataCategory || (exports.MetadataCategory = {}));
1601
-
1602
- var ConsultService = /*#__PURE__*/function () {
1603
- function ConsultService(api, baseURL) {
1604
- this.api = api;
1605
- this.baseURL = baseURL;
1606
- }
1607
-
1608
- var _proto = ConsultService.prototype;
1609
-
1610
- _proto.consultCreate = function consultCreate(c) {
1611
- return this.api.post(this.baseURL + "/v1/consults", c);
1612
- }
1613
- /**
1614
- * This function returns the number of consults using parameters
1615
- * @param uuidPractice the practice uuid
1616
- * @param uuidRequester the requester uuid
1617
- * @param statusesMedical an array containing MedicalStatus to include
1618
- * @param statusesExclude an array containing MedicalStatus to exclude
1619
- * @param shortId a shortId matcher (will match all consult with a shortId starting with this `shortId`)
1620
- * @param columnToSortTo the list of columns separated by commas, to sort to (in order of sorting)
1621
- * @param orderToSortTo the type of sorting to do ('asc' for ascending or 'desc' for descending)
1622
- * @param perPage the number of item to retrieve per "page"
1623
- * @param indexPage the actual index of the page to retrieve (0 based: 0 is the first items)
1624
- * @param filterAssignedDoctor the uuid of the doctor for which to filter with
1625
- * @param filterCurrentPractitioner the uuid of the current assistant assigned to filter with
1626
- * @param filterIsoLocality the of isoLocality to filter with
1627
- * @returns a number of consult
1628
- */
1629
- ;
1630
-
1631
- _proto.countConsults = function countConsults(uuidPractice, uuidRequester, statusesMedical, statusesExclude, shortId, columnToSortTo, orderToSortTo, perPage, indexPage, filterAssignedDoctor, filterCurrentPractitioner, filterIsoLocality) {
1632
- return this.api.head(this.baseURL + "/v1/consults", {
1633
- params: {
1634
- uuidPractice: uuidPractice,
1635
- uuidRequester: uuidRequester,
1636
- statusesMedical: statusesMedical,
1637
- statusesExclude: statusesExclude,
1638
- shortId: shortId,
1639
- perPage: perPage,
1640
- page: indexPage,
1641
- sortColumns: columnToSortTo,
1642
- orderColumns: orderToSortTo,
1643
- filterAssignedDoctor: filterAssignedDoctor,
1644
- filterCurrentPractitioner: filterCurrentPractitioner,
1645
- filterIsoLocality: filterIsoLocality
1646
- }
1647
- }, 'Content-Range').then(function (resContentRange) {
1648
- if (!resContentRange || typeof resContentRange !== 'string' && typeof resContentRange !== 'number') {
1649
- return 0;
1650
- }
1651
-
1652
- if (typeof resContentRange === 'number') {
1653
- return resContentRange;
1654
- }
1655
-
1656
- return parseInt(resContentRange);
1657
- });
1658
- }
1659
- /**
1660
- * This function get consults using parameters
1661
- * @param uuidPractice the practice uuid
1662
- * @param uuidRequester the requester uuid
1663
- * @param statusesMedical an array containing MedicalStatus to include
1664
- * @param statusesExclude an array containing MedicalStatus to exclude
1665
- * @param shortId a shortId matcher (will match all consult with a shortId starting with this `shortId`)
1666
- * @param columnToSortTo the list of columns separated by commas, to sort to (in order of sorting)
1667
- * @param orderToSortTo the type of sorting to do ('asc' for ascending or 'desc' for descending)
1668
- * @param perPage the number of item to retrieve per "page"
1669
- * @param indexPage the actual index of the page to retrieve (0 based: 0 is the first items)
1670
- * @param filterAssignedDoctor the uuid of the doctor for which to filter with
1671
- * @param filterCurrentPractitioner the uuid of the current assistant assigned to filter with
1672
- * @param filterIsoLocality the of isoLocality to filter with
1673
- * @returns a list of consult
1674
- */
1675
- ;
1676
-
1677
- _proto.getConsults = function getConsults(uuidPractice, uuidRequester, statusesMedical, statusesExclude, shortId, columnToSortTo, orderToSortTo, perPage, indexPage, filterAssignedDoctor, filterCurrentPractitioner, filterIsoLocality) {
1678
- return this.api.get(this.baseURL + "/v1/consults", {
1679
- params: {
1680
- uuidPractice: uuidPractice,
1681
- uuidRequester: uuidRequester,
1682
- statusesMedical: statusesMedical,
1683
- statusesExclude: statusesExclude,
1684
- shortId: shortId,
1685
- perPage: perPage,
1686
- page: indexPage,
1687
- sortColumns: columnToSortTo,
1688
- orderColumns: orderToSortTo,
1689
- filterAssignedDoctor: filterAssignedDoctor,
1690
- filterCurrentPractitioner: filterCurrentPractitioner,
1691
- filterIsoLocality: filterIsoLocality
1692
- }
1693
- });
1694
- };
1695
-
1696
- _proto.getConsultByUUID = function getConsultByUUID(uuidConsult, uuidPractice) {
1697
- return this.api.get(this.baseURL + "/v1/consults/" + uuidConsult, {
1698
- params: {
1699
- uuidPractice: uuidPractice
1700
- }
1701
- });
1702
- };
1703
-
1704
- _proto.updateConsultByUUID = function updateConsultByUUID(uuidConsult, consult, uuidPractice, uuidRequester) {
1705
- return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult, consult, {
1706
- params: {
1707
- uuidPractice: uuidPractice,
1708
- uuidRequester: uuidRequester
1709
- }
1710
- });
1711
- };
1712
-
1713
- _proto.getConsultFaxStatuses = function getConsultFaxStatuses(uuidConsult) {
1714
- return this.api.get(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions", {
1715
- params: {
1716
- kind: exports.TransmissionKind.Fax
1717
- }
1718
- });
1719
- };
1720
-
1721
- _proto.postConsultTransmission = function postConsultTransmission(uuidConsult, nameDriver, addressOrPhoneToSendTo, file, nameReceiver, txtTransmissionTitle, txtTransmissionNotes // numTry ?: number,
1722
- // delay ?: number,
1723
- ) {
1724
- if (nameDriver === void 0) {
1725
- nameDriver = 'Documo';
1726
- }
1727
-
1728
- var data = new FormData();
1729
- data.append('nameDriverReceiver', nameDriver);
1730
-
1731
- if (addressOrPhoneToSendTo) {
1732
- data.append('addressReceiver', addressOrPhoneToSendTo);
1733
- }
1734
-
1735
- if (file) {
1736
- data.append('file', file);
1737
- }
1738
-
1739
- if (nameReceiver) {
1740
- data.append('nameReceiver', nameReceiver);
1741
- }
1742
-
1743
- if (txtTransmissionTitle) {
1744
- data.append('txtTransmissionTitle', txtTransmissionTitle);
1745
- }
1746
-
1747
- if (txtTransmissionNotes) {
1748
- data.append('txtTransmissionNotes', txtTransmissionNotes);
1749
- }
1750
-
1751
- return this.api.post(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions", data, {
1752
- headers: {
1753
- 'Content-Type': 'multipart/form-data;'
1754
- }
1755
- });
1756
- };
1757
-
1758
- _proto.postConsultFax = function postConsultFax(uuidConsult, addressReceiver, file) {
1759
- return this.postConsultTransmission(uuidConsult, 'Documo', addressReceiver, file);
1760
- };
1761
-
1762
- _proto.postConsultEmail = function postConsultEmail(uuidConsult, file) {
1763
- return this.postConsultTransmission(uuidConsult, 'Pharmacierge', undefined, file);
1764
- };
1765
-
1766
- _proto.retryConsultFax = function retryConsultFax(uuidConsult, transmissionId) {
1767
- return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions/" + transmissionId, {
1768
- status: exports.TransmissionStatus.Retrying
1769
- });
1770
- };
1771
-
1772
- _proto.updateConsultTransmissionStatus = function updateConsultTransmissionStatus(transmissionId, uuidConsult, newStatus) {
1773
- return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions/" + transmissionId, {
1774
- status: newStatus
1775
- });
1776
- };
1777
-
1778
- return ConsultService;
1779
- }();
1780
-
1781
- var DiagnosisService = /*#__PURE__*/function () {
1782
- function DiagnosisService(api, baseURL) {
1783
- this.api = api;
1784
- this.baseURL = baseURL;
1785
- }
1786
-
1787
- var _proto = DiagnosisService.prototype;
1788
-
1789
- _proto.getDiagnoses = function getDiagnoses() {
1790
- return this.api.get(this.baseURL + "/v1/diagnoses");
1791
- }
1792
- /**
1793
- * Get a diagnosis by uuid that belongs to your practice
1794
- * @param uuidDiagnosis the uuid of the diagnosis
1795
- * @returns a diagnosis
1796
- */
1797
- ;
1798
-
1799
- _proto.getDiagnosisByUuid = function getDiagnosisByUuid(uuidDiagnosis) {
1800
- return this.api.get(this.baseURL + "/v1/diagnoses/" + uuidDiagnosis);
1801
- };
1802
-
1803
- _proto.createDiagnosis = function createDiagnosis(diagnosis) {
1804
- return this.api.post(this.baseURL + "/v1/diagnoses", diagnosis);
1805
- };
1806
-
1807
- _proto.updateDiagnosis = function updateDiagnosis(uuid, diagnosis) {
1808
- return this.api.put(this.baseURL + "/v1/diagnoses/" + uuid, diagnosis);
1809
- };
1810
-
1811
- _proto.getTreatmentsFromDiagnosisUuid = function getTreatmentsFromDiagnosisUuid(diagnosisUuid) {
1812
- return this.api.get(this.baseURL + "/v1/diagnoses/" + diagnosisUuid + "/treatments");
1813
- }
1814
- /**
1815
- * This function returns treatment plans associated to a consult
1816
- * @param uuidConsult the consult uuid to fetch
1817
- * @returns an array of TreatmentPlan
1818
- */
1819
- ;
1820
-
1821
- _proto.getTreatmentPlansFromConsultUuid = function getTreatmentPlansFromConsultUuid(uuidConsult) {
1822
- return this.api.get(this.baseURL + "/v1/treatment-plans/", {
1823
- params: {
1824
- uuidConsult: uuidConsult
1825
- }
1826
- });
1827
- }
1828
- /**
1829
- * creates a new treatment for the specified diagnosis
1830
- * @param diagnosisUuid uuid of the diagnosis that the treatment is linked to
1831
- * @param treatmentRequest the treatment to be inserted
1832
- */
1833
- ;
1834
-
1835
- _proto.createTreatment = function createTreatment(diagnosisUuid, treatmentRequest) {
1836
- return this.api.post(this.baseURL + "/v1/diagnoses/" + diagnosisUuid + "/treatments", treatmentRequest);
1837
- }
1838
- /**
1839
- * This function returns populated treatment plans associated to a consult
1840
- * @param uuidConsult the consult uuid to fetch
1841
- * @returns a TreatmentPlans object
1842
- */
1843
- ;
1844
-
1845
- _proto.getTreatmentPlansPopulatedFromConsultUuid = function getTreatmentPlansPopulatedFromConsultUuid(uuidConsult) {
1846
- return this.api.get(this.baseURL + "/v1/treatment-plans/", {
1847
- params: {
1848
- uuidConsult: uuidConsult,
1849
- populated: true
1850
- }
1851
- });
1852
- };
1853
-
1854
- _proto.postPlans = function postPlans(plans) {
1855
- return this.api.post(this.baseURL + "/v1/treatment-plans", plans);
1856
- };
1857
-
1858
- _proto.updateTreatmentPlan = function updateTreatmentPlan(uuidPlan, uuidConsult, diagnosisRequest, plan) {
1859
- return this.api.put(this.baseURL + "/v1/treatment-plans/" + uuidPlan, {
1860
- uuidConsult: uuidConsult,
1861
- diagnosis: diagnosisRequest,
1862
- plan: plan
1863
- });
1864
- };
1865
-
1866
- _proto.acceptTreatmentPlan = function acceptTreatmentPlan(uuidPlan, uuidConsult) {
1867
- return this.api.put(this.baseURL + "/v1/treatment-plans/" + uuidPlan + "/accept", {
1868
- uuidConsult: uuidConsult
1869
- });
1870
- }
1871
- /**
1872
- * retrieves all the drugs of the specified practice
1873
- * @param uuidPractice
1874
- */
1875
- ;
1876
-
1877
- _proto.getAllDrugs =
1878
- /*#__PURE__*/
1879
- function () {
1880
- var _getAllDrugs = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(uuidPractice) {
1881
- var res;
1882
- return runtime_1.wrap(function _callee$(_context) {
1883
- while (1) {
1884
- switch (_context.prev = _context.next) {
1885
- case 0:
1886
- _context.next = 2;
1887
- return this.api.get(this.baseURL + "/v1/drugs/practice/" + uuidPractice);
1888
-
1889
- case 2:
1890
- res = _context.sent;
1891
-
1892
- if (!(res && res.foundDrugs)) {
1893
- _context.next = 5;
1894
- break;
1895
- }
1896
-
1897
- return _context.abrupt("return", res.foundDrugs);
1898
-
1899
- case 5:
1900
- return _context.abrupt("return", undefined);
1901
-
1902
- case 6:
1903
- case "end":
1904
- return _context.stop();
1905
- }
1906
- }
1907
- }, _callee, this);
1908
- }));
1909
-
1910
- function getAllDrugs(_x) {
1911
- return _getAllDrugs.apply(this, arguments);
1912
- }
1913
-
1914
- return getAllDrugs;
1915
- }();
1916
-
1917
- return DiagnosisService;
1918
- }();
1919
-
1920
- var GuardService = /*#__PURE__*/function () {
1921
- function GuardService(api, baseURL) {
1922
- this.api = api;
1923
- this.baseURL = baseURL;
1924
- this.api.setAuthRefreshFn(this.authRefresh.bind(this));
1925
- this.identityCache = {};
1926
- this.whoAmICache = {};
1927
- }
1928
- /**
1929
- * Will replace access and refresh tokens with `tokens`
1930
- *
1931
- * Note:
1932
- * ```typescript
1933
- * setTokens({accessToken: undefined, refreshToken: 'aTokenValue'}) // will erase accessToken and set refreshToken with 'aTokenValue'
1934
- * setTokens({refreshToken: 'aTokenValue'}) // will keep actual value of accessToken and set refreshToken with 'aTokenValue'
1935
- *
1936
- * ```
1937
- * @param tokens
1938
- */
1939
-
1940
-
1941
- var _proto = GuardService.prototype;
1942
-
1943
- _proto.setTokens = function setTokens(tokens) {
1944
- this.api.setTokens(_extends({}, this.api.getTokens(), tokens));
1945
- }
1946
- /**
1947
- * Allow to retrieve an access token and a refresh token in order
1948
- * to do authenticated request afterward
1949
- *
1950
- * @param req The credentials required to get an access token
1951
- * @returns AuthTokenResponse
1952
- */
1953
- ;
1954
-
1955
- _proto.authToken =
1956
- /*#__PURE__*/
1957
- function () {
1958
- var _authToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(req) {
1959
- var resp, config, _e$response, code;
1960
-
1961
- return runtime_1.wrap(function _callee$(_context) {
1962
- while (1) {
1963
- switch (_context.prev = _context.next) {
1964
- case 0:
1965
- _context.prev = 0;
1966
- config = {
1967
- skipAuthRefresh: true
1968
- };
1969
- _context.next = 4;
1970
- return this.api.post(this.baseURL + "/v1/auth/token", req, config);
1971
-
1972
- case 4:
1973
- resp = _context.sent;
1974
- this.api.setTokens({
1975
- accessToken: resp.accessToken,
1976
- refreshToken: resp.refreshToken
1977
- });
1978
- _context.next = 19;
1979
- break;
1980
-
1981
- case 8:
1982
- _context.prev = 8;
1983
- _context.t0 = _context["catch"](0);
1984
-
1985
- if (!_context.t0.isAxiosError) {
1986
- _context.next = 18;
1987
- break;
1988
- }
1989
-
1990
- code = (_e$response = _context.t0.response) == null ? void 0 : _e$response.status;
1991
- _context.t1 = code;
1992
- _context.next = _context.t1 === 400 ? 15 : _context.t1 === 500 ? 16 : _context.t1 === 401 ? 17 : 17;
1993
- break;
1994
-
1995
- case 15:
1996
- throw new AuthenticationBadRequest();
1997
-
1998
- case 16:
1999
- throw new AuthenticationServerError();
2000
-
2001
- case 17:
2002
- throw new AuthenticationFailed();
2003
-
2004
- case 18:
2005
- throw new AuthenticationFailed();
2006
-
2007
- case 19:
2008
- return _context.abrupt("return", resp);
2009
-
2010
- case 20:
2011
- case "end":
2012
- return _context.stop();
2013
- }
2014
- }
2015
- }, _callee, this, [[0, 8]]);
2016
- }));
2017
-
2018
- function authToken(_x) {
2019
- return _authToken.apply(this, arguments);
2020
- }
2021
-
2022
- return authToken;
2023
- }()
2024
- /**
2025
- * Get new access and refresh token
2026
- *
2027
- * @returns AuthTokenResponse
2028
- */
2029
- ;
2030
-
2031
- _proto.authRefresh =
2032
- /*#__PURE__*/
2033
- function () {
2034
- var _authRefresh = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(refreshToken) {
2035
- var config;
2036
- return runtime_1.wrap(function _callee2$(_context2) {
2037
- while (1) {
2038
- switch (_context2.prev = _context2.next) {
2039
- case 0:
2040
- config = {
2041
- skipAuthRefresh: true,
2042
- useRefreshToken: true
2043
- };
2044
- return _context2.abrupt("return", this.api.put(this.baseURL + "/v1/auth/token", null, config));
2045
-
2046
- case 2:
2047
- case "end":
2048
- return _context2.stop();
2049
- }
2050
- }
2051
- }, _callee2, this);
2052
- }));
2053
-
2054
- function authRefresh(_x2) {
2055
- return _authRefresh.apply(this, arguments);
2056
- }
2057
-
2058
- return authRefresh;
2059
- }()
2060
- /**
2061
- * Call guard to overwrite existing refresh token cookie
2062
- *
2063
- * @returns void
2064
- */
2065
- ;
2066
-
2067
- _proto.authLogout =
2068
- /*#__PURE__*/
2069
- function () {
2070
- var _authLogout = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
2071
- return runtime_1.wrap(function _callee3$(_context3) {
2072
- while (1) {
2073
- switch (_context3.prev = _context3.next) {
2074
- case 0:
2075
- return _context3.abrupt("return", this.api.get(this.baseURL + "/v1/auth/logout"));
2076
-
2077
- case 1:
2078
- case "end":
2079
- return _context3.stop();
2080
- }
2081
- }
2082
- }, _callee3, this);
2083
- }));
2084
-
2085
- function authLogout() {
2086
- return _authLogout.apply(this, arguments);
2087
- }
2088
-
2089
- return authLogout;
2090
- }()
2091
- /**
2092
- * Call guard to attempt account recovery
2093
- *
2094
- * @param req The email address / practice of the account to recover
2095
- * @returns void
2096
- */
2097
- ;
2098
-
2099
- _proto.authRecover =
2100
- /*#__PURE__*/
2101
- function () {
2102
- var _authRecover = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(req) {
2103
- return runtime_1.wrap(function _callee4$(_context4) {
2104
- while (1) {
2105
- switch (_context4.prev = _context4.next) {
2106
- case 0:
2107
- return _context4.abrupt("return", this.api.post(this.baseURL + "/v1/auth/recover", req));
2108
-
2109
- case 1:
2110
- case "end":
2111
- return _context4.stop();
2112
- }
2113
- }
2114
- }, _callee4, this);
2115
- }));
2116
-
2117
- function authRecover(_x3) {
2118
- return _authRecover.apply(this, arguments);
2119
- }
2120
-
2121
- return authRecover;
2122
- }()
2123
- /**
2124
- * Allow to create a new identity. The identity will then need to be confirmed
2125
- * via an email link
2126
- *
2127
- * @param req the information about the new identity to create
2128
- * @returns IdentityResponse
2129
- */
2130
- ;
2131
-
2132
- _proto.identityCreate =
2133
- /*#__PURE__*/
2134
- function () {
2135
- var _identityCreate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(req) {
2136
- var resp, _e$response2, code;
2137
-
2138
- return runtime_1.wrap(function _callee5$(_context5) {
2139
- while (1) {
2140
- switch (_context5.prev = _context5.next) {
2141
- case 0:
2142
- _context5.prev = 0;
2143
- _context5.next = 3;
2144
- return this.api.post(this.baseURL + "/v1/identities", req);
2145
-
2146
- case 3:
2147
- resp = _context5.sent;
2148
- this.api.setTokens({
2149
- refreshToken: resp.refreshToken
2150
- });
2151
- _context5.next = 18;
2152
- break;
2153
-
2154
- case 7:
2155
- _context5.prev = 7;
2156
- _context5.t0 = _context5["catch"](0);
2157
-
2158
- if (!_context5.t0.isAxiosError) {
2159
- _context5.next = 17;
2160
- break;
2161
- }
2162
-
2163
- code = (_e$response2 = _context5.t0.response) == null ? void 0 : _e$response2.status;
2164
- _context5.t1 = code;
2165
- _context5.next = _context5.t1 === 400 ? 14 : _context5.t1 === 409 ? 15 : _context5.t1 === 500 ? 16 : 16;
2166
- break;
2167
-
2168
- case 14:
2169
- throw new IdentityCreationBadRequest();
2170
-
2171
- case 15:
2172
- throw new IdentityCreationConflict();
2173
-
2174
- case 16:
2175
- throw new IdentityCreationFailed();
2176
-
2177
- case 17:
2178
- throw new IdentityCreationFailed();
2179
-
2180
- case 18:
2181
- return _context5.abrupt("return", resp);
2182
-
2183
- case 19:
2184
- case "end":
2185
- return _context5.stop();
2186
- }
2187
- }
2188
- }, _callee5, this, [[0, 7]]);
2189
- }));
2190
-
2191
- function identityCreate(_x4) {
2192
- return _identityCreate.apply(this, arguments);
2193
- }
2194
-
2195
- return identityCreate;
2196
- }()
2197
- /**
2198
- * Retrieve an identity. Will return public fields only when requested
2199
- * without authentication
2200
- *
2201
- * @param identityID Unique id of the identity to retrieve
2202
- * @returns IdentityResponse
2203
- */
2204
- ;
2205
-
2206
- _proto.identityGet =
2207
- /*#__PURE__*/
2208
- function () {
2209
- var _identityGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(identityID) {
2210
- var _tokens$accessToken, _tokens$refreshToken;
2211
-
2212
- var tokens, cacheKey;
2213
- return runtime_1.wrap(function _callee6$(_context6) {
2214
- while (1) {
2215
- switch (_context6.prev = _context6.next) {
2216
- case 0:
2217
- tokens = this.api.getTokens();
2218
- cacheKey = ((_tokens$accessToken = tokens.accessToken) != null ? _tokens$accessToken : '') + ((_tokens$refreshToken = tokens.refreshToken) != null ? _tokens$refreshToken : '') + identityID;
2219
-
2220
- if (!(!tokens.accessToken || !this.identityCache[cacheKey])) {
2221
- _context6.next = 6;
2222
- break;
2223
- }
2224
-
2225
- _context6.next = 5;
2226
- return this.api.get(this.baseURL + "/v1/identities/" + identityID);
2227
-
2228
- case 5:
2229
- this.identityCache[cacheKey] = _context6.sent;
2230
-
2231
- case 6:
2232
- return _context6.abrupt("return", this.identityCache[cacheKey]);
2233
-
2234
- case 7:
2235
- case "end":
2236
- return _context6.stop();
2237
- }
2238
- }
2239
- }, _callee6, this);
2240
- }));
2241
-
2242
- function identityGet(_x5) {
2243
- return _identityGet.apply(this, arguments);
2244
- }
2245
-
2246
- return identityGet;
2247
- }()
2248
- /**
2249
- * Get information about the current authenticated user
2250
- *
2251
- * @param refreshCache if true it will refresh the whoAmI cache (default: false)
2252
- * @returns WhoAmIResponse
2253
- */
2254
- ;
2255
-
2256
- _proto.whoAmI =
2257
- /*#__PURE__*/
2258
- function () {
2259
- var _whoAmI = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(refreshCache) {
2260
- var _this$api$getTokens$a;
2261
-
2262
- var cacheKey;
2263
- return runtime_1.wrap(function _callee7$(_context7) {
2264
- while (1) {
2265
- switch (_context7.prev = _context7.next) {
2266
- case 0:
2267
- if (refreshCache === void 0) {
2268
- refreshCache = false;
2269
- }
2270
-
2271
- cacheKey = (_this$api$getTokens$a = this.api.getTokens().accessToken) != null ? _this$api$getTokens$a : '';
2272
-
2273
- if (!(!this.whoAmICache[cacheKey] || refreshCache)) {
2274
- _context7.next = 6;
2275
- break;
2276
- }
2277
-
2278
- _context7.next = 5;
2279
- return this.api.get(this.baseURL + "/v1/auth/whoami");
2280
-
2281
- case 5:
2282
- this.whoAmICache[cacheKey] = _context7.sent;
2283
-
2284
- case 6:
2285
- return _context7.abrupt("return", this.whoAmICache[cacheKey]);
2286
-
2287
- case 7:
2288
- case "end":
2289
- return _context7.stop();
2290
- }
2291
- }
2292
- }, _callee7, this);
2293
- }));
2294
-
2295
- function whoAmI(_x6) {
2296
- return _whoAmI.apply(this, arguments);
2297
- }
2298
-
2299
- return whoAmI;
2300
- }()
2301
- /**
2302
- * Update an existing identity
2303
- *
2304
- * @param identityID unique id of identity to update
2305
- * @param req update request
2306
- * @returns IdentityResponse
2307
- */
2308
- ;
2309
-
2310
- _proto.identityUpdate =
2311
- /*#__PURE__*/
2312
- function () {
2313
- var _identityUpdate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(identityID, req) {
2314
- return runtime_1.wrap(function _callee8$(_context8) {
2315
- while (1) {
2316
- switch (_context8.prev = _context8.next) {
2317
- case 0:
2318
- return _context8.abrupt("return", this.api.put(this.baseURL + "/v1/identities/" + identityID, req));
2319
-
2320
- case 1:
2321
- case "end":
2322
- return _context8.stop();
2323
- }
2324
- }
2325
- }, _callee8, this);
2326
- }));
2327
-
2328
- function identityUpdate(_x7, _x8) {
2329
- return _identityUpdate.apply(this, arguments);
2330
- }
2331
-
2332
- return identityUpdate;
2333
- }()
2334
- /**
2335
- * Return base64 data representing a QR code that the
2336
- * current identity need in order to use MFA
2337
- *
2338
- * @param identityID unique id of the identity
2339
- * @param password the identity password (already hashed and in base64)
2340
- * @returns QRCodeResponse
2341
- */
2342
- ;
2343
-
2344
- _proto.identityMFAQRCode =
2345
- /*#__PURE__*/
2346
- function () {
2347
- var _identityMFAQRCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(identityID, password) {
2348
- var req;
2349
- return runtime_1.wrap(function _callee9$(_context9) {
2350
- while (1) {
2351
- switch (_context9.prev = _context9.next) {
2352
- case 0:
2353
- req = {
2354
- password: password
2355
- };
2356
- return _context9.abrupt("return", this.api.post(this.baseURL + "/v1/identities/" + identityID + "/mfa", req, {
2357
- headers: {
2358
- 'Accept': 'application/json'
2359
- }
2360
- }));
2361
-
2362
- case 2:
2363
- case "end":
2364
- return _context9.stop();
2365
- }
2366
- }
2367
- }, _callee9, this);
2368
- }));
2369
-
2370
- function identityMFAQRCode(_x9, _x10) {
2371
- return _identityMFAQRCode.apply(this, arguments);
2372
- }
2373
-
2374
- return identityMFAQRCode;
2375
- }();
2376
-
2377
- return GuardService;
2378
- }();
2379
-
2380
- var PracticeService = /*#__PURE__*/function () {
2381
- function PracticeService(toolbox, api, baseURL) {
2382
- this.toolbox = toolbox;
2383
- this.api = api;
2384
- this.baseURL = baseURL;
2385
- }
2386
- /**
2387
- * This function get the practice from the URL of a practice
2388
- * It is the entry point of our web apps
2389
- * @param practiceURL URL of the practice to search
2390
- * @param hydratePracticeConfigs (optional) if set true it the Practice field configs will be set
2391
- * @param accounts (optional) if set true it the Practice field accounts will be set
2392
- * @returns the found practice or undefined
2393
- */
2394
-
2395
-
2396
- var _proto = PracticeService.prototype;
2397
-
2398
- _proto.practiceGetFromURL = function practiceGetFromURL(practiceURL, params) {
2399
- return this.api.get(this.baseURL + "/v1/practices", {
2400
- params: _extends({
2401
- url_practice: practiceURL
2402
- }, params)
2403
- });
2404
- };
2405
-
2406
- _proto.practiceGetFromUuid = function practiceGetFromUuid(practiceUuid, locale, withAccounts) {
2407
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid, {
2408
- params: {
2409
- locale: locale,
2410
- accounts: withAccounts
2411
- }
2412
- });
2413
- } /// Practice Configs
2414
-
2415
- /**
2416
- * This function retrieves all configs of a specific practice
2417
- * @param practiceUuid uuid of the practice
2418
- * @returns the practice configs
2419
- */
2420
- ;
2421
-
2422
- _proto.practiceConfigGetFromPracticeUuid = function practiceConfigGetFromPracticeUuid(practiceUuid) {
2423
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/configs");
2424
- }
2425
- /**
2426
- * This function retrieves a specific config of a practice
2427
- * @param practiceUuid uuid of the practice
2428
- * @param kind of the config
2429
- * @returns the practice config
2430
- */
2431
- ;
2432
-
2433
- _proto.practiceConfigGetByKindForPracticeUuid = function practiceConfigGetByKindForPracticeUuid(practiceUuid, kind) {
2434
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/configs/" + kind);
2435
- }
2436
- /**
2437
- * This function creates a config for a specific practice
2438
- * @param practiceUuid uuid of the practice
2439
- * @param config the config to add to the practice
2440
- * @returns the created practice config
2441
- */
2442
- ;
2443
-
2444
- _proto.practiceConfigCreateForPracticeUuid = function practiceConfigCreateForPracticeUuid(practiceUuid, config) {
2445
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/configs", config);
2446
- }
2447
- /**
2448
- * This function updates a specific config of a practice
2449
- * @param practiceUuid uuid of the practice
2450
- * @param config the config to update
2451
- * @returns the practice config
2452
- */
2453
- ;
2454
-
2455
- _proto.practiceConfigUpdate = function practiceConfigUpdate(config) {
2456
- return this.api.put(this.baseURL + "/v1/practices/" + config.uuidPractice + "/configs/" + config.kind, config);
2457
- } /// Accounts
2458
- ;
2459
-
2460
- _proto.practiceGetAccounts = function practiceGetAccounts(practiceUuid) {
2461
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/accounts");
2462
- };
2463
-
2464
- _proto.practiceGetAccount = function practiceGetAccount(practiceUuid, accountUuid) {
2465
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/accounts/" + accountUuid);
2466
- } /// Workflows
2467
- ;
2468
-
2469
- _proto.practiceGetWorkflows = function practiceGetWorkflows(practiceUuid) {
2470
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/workflows");
2471
- };
2472
-
2473
- _proto.practiceGetWorkflow = function practiceGetWorkflow(practiceUuid, workflowType) {
2474
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/workflows/" + workflowType);
2475
- } /// Plans
2476
- ;
2477
-
2478
- _proto.practiceGetPlans = function practiceGetPlans(practiceUuid, planType) {
2479
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans", {
2480
- params: {
2481
- kind: planType
2482
- }
2483
- });
2484
- };
2485
-
2486
- _proto.practiceGetPlan = function practiceGetPlan(practiceUuid, planId) {
2487
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans/" + planId);
2488
- };
2489
-
2490
- _proto.practiceGetPlanPrices = function practiceGetPlanPrices(practiceUuid, planId) {
2491
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans/" + planId + "/prices");
2492
- } // Payments
2493
- ;
2494
-
2495
- _proto.practiceGetPayments = function practiceGetPayments(practiceUuid, planType) {
2496
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments", {
2497
- params: {
2498
- kind: planType
2499
- }
2500
- });
2501
- };
2502
-
2503
- _proto.practiceGetPayment = function practiceGetPayment(practiceUuid, idStripeInvoiceOrPaymentIntent) {
2504
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/" + idStripeInvoiceOrPaymentIntent);
2505
- };
2506
-
2507
- _proto.practiceGetPaymentForStripePaymentIntentWithID = function practiceGetPaymentForStripePaymentIntentWithID(practiceUuid, stripePaymentIntentId) {
2508
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/" + stripePaymentIntentId);
2509
- } // Payments Intent
2510
- ;
2511
-
2512
- _proto.practiceGetPaymentsIntents = function practiceGetPaymentsIntents(practiceUuid, planType) {
2513
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents", {
2514
- params: {
2515
- kind: planType
2516
- }
2517
- });
2518
- }
2519
- /**
2520
- * This function return the user hased email to be use for creating payment intent
2521
- * @param email the email to hash
2522
- * @returns a hashed email
2523
- */
2524
- ;
2525
-
2526
- _proto.getPaymentIntentHashedEmail = function getPaymentIntentHashedEmail(email) {
2527
- return this.toolbox.hashStringToBase64(email.toLowerCase());
2528
- };
2529
-
2530
- _proto.practiceCreatePaymentsIntent = function practiceCreatePaymentsIntent(practiceUuid, planId, userEmail, isoLocality, url_subdomain, promotionCode) {
2531
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/", {
2532
- idPlan: planId,
2533
- hashUserEmail: userEmail ? this.getPaymentIntentHashedEmail(userEmail) : undefined,
2534
- isoLocality: isoLocality
2535
- }, {
2536
- params: {
2537
- url_subdomain: url_subdomain,
2538
- promotionCode: promotionCode
2539
- }
2540
- });
2541
- };
2542
-
2543
- _proto.practiceGetPaymentsIntent = function practiceGetPaymentsIntent(practiceUuid, paymentIntentId) {
2544
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/" + paymentIntentId);
2545
- };
2546
-
2547
- _proto.practiceUpdatePaymentsIntent = function practiceUpdatePaymentsIntent(practiceUuid, idPraticePaymentIntent, practicePaymentIntent, userEmail, promotionCode) {
2548
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/" + idPraticePaymentIntent, _extends({}, practicePaymentIntent, {
2549
- hashUserEmail: userEmail ? this.getPaymentIntentHashedEmail(userEmail) : undefined
2550
- }), {
2551
- params: {
2552
- promotionCode: promotionCode
2553
- }
2554
- });
2555
- } // Practitioner
2556
- ;
2557
-
2558
- _proto.practiceGetPractitioners = function practiceGetPractitioners(practiceUuid) {
2559
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners");
2560
- };
2561
-
2562
- _proto.practiceUpdatePractitioner = function practiceUpdatePractitioner(practiceUuid, practitionerUuid, requestBody) {
2563
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid, requestBody);
2564
- };
2565
-
2566
- _proto.practiceGetPractitioner = function practiceGetPractitioner(practiceUuid, practitionerUuid) {
2567
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid);
2568
- } // Practitioner Licenses
2569
- ;
2570
-
2571
- _proto.practiceGetPractitionerLicenses = function practiceGetPractitionerLicenses(practiceUuid, practitionerUuid) {
2572
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses");
2573
- };
2574
-
2575
- _proto.practiceCreatePractitionerLicense = function practiceCreatePractitionerLicense(practiceUuid, practitionerUuid, requestBody) {
2576
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses", requestBody);
2577
- };
2578
-
2579
- _proto.practiceUpdatePractitionerLicense = function practiceUpdatePractitionerLicense(practiceUuid, practitionerUuid, licenseId, requestBody) {
2580
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses/" + licenseId, requestBody);
2581
- };
2582
-
2583
- _proto.practiceGetPractitionerLicense = function practiceGetPractitionerLicense(practiceUuid, practitionerUuid, licenseId) {
2584
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses/" + licenseId);
2585
- } // Practitioner Preferences
2586
- ;
2587
-
2588
- _proto.practiceGetPractitionerPreferences = function practiceGetPractitionerPreferences(practiceUuid, practitionerUuid) {
2589
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences");
2590
- };
2591
-
2592
- _proto.practiceCreatePractitionerPreference = function practiceCreatePractitionerPreference(practiceUuid, practitionerUuid, requestBody) {
2593
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences", requestBody);
2594
- };
2595
-
2596
- _proto.practiceUpdatePractitionerPreference = function practiceUpdatePractitionerPreference(practiceUuid, practitionerUuid, preferenceId, requestBody) {
2597
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences/" + preferenceId, requestBody);
2598
- };
2599
-
2600
- _proto.practiceGetPractitionerPreference = function practiceGetPractitionerPreference(practiceUuid, practitionerUuid, preferenceId) {
2601
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences/" + preferenceId);
2602
- } // Practitioner Roles
2603
- ;
2604
-
2605
- _proto.practiceGetPractitionerRoles = function practiceGetPractitionerRoles(practiceUuid, practitionerUuid) {
2606
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles");
2607
- };
2608
-
2609
- _proto.practiceCreatePractitionerRole = function practiceCreatePractitionerRole(practiceUuid, practitionerUuid, requestBody) {
2610
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles", requestBody);
2611
- };
2612
-
2613
- _proto.practiceDeletePractitionerRoles = function practiceDeletePractitionerRoles(practiceUuid, practitionerUuid) {
2614
- return this.api.deleteRequest(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles");
2615
- };
2616
-
2617
- _proto.practiceUpdatePractitionerRole = function practiceUpdatePractitionerRole(practiceUuid, practitionerUuid, roleId, requestBody) {
2618
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId, requestBody);
2619
- };
2620
-
2621
- _proto.practiceGetPractitionerRole = function practiceGetPractitionerRole(practiceUuid, practitionerUuid, roleId) {
2622
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId);
2623
- };
2624
-
2625
- _proto.practiceDeletePractitionerRole = function practiceDeletePractitionerRole(practiceUuid, practitionerUuid, roleId) {
2626
- return this.api.deleteRequest(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId);
2627
- } // Practitioner signature
2628
-
2629
- /**
2630
- * This function returns the practitioner's signature as a Blob
2631
- * @param practiceUuid the practice uuid of the practitioner
2632
- * @param practitionerUuid the practitioner uuid
2633
- * @returns a blob representing the signature
2634
- */
2635
- ;
2636
-
2637
- _proto.practiceGetPractitionerSignature = function practiceGetPractitionerSignature(practiceUuid, practitionerUuid) {
2638
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/signature", {
2639
- responseType: 'blob'
2640
- });
2641
- } // Assignments
2642
- ;
2643
-
2644
- _proto.practiceGetAssignments = function practiceGetAssignments(practiceUuid) {
2645
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments");
2646
- };
2647
-
2648
- _proto.practiceCreateAssignment = function practiceCreateAssignment(practiceUuid, requestBody) {
2649
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments", requestBody);
2650
- };
2651
-
2652
- _proto.practiceUpdateAssignment = function practiceUpdateAssignment(practiceUuid, assignmentId, requestBody) {
2653
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments/" + assignmentId, requestBody);
2654
- };
2655
-
2656
- _proto.practiceGetAssignment = function practiceGetAssignment(practiceUuid, assignmentId) {
2657
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments/" + assignmentId);
2658
- } // Quotas
2659
- ;
2660
-
2661
- _proto.practiceGetQuotas = function practiceGetQuotas(practiceUuid) {
2662
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/quotas");
2663
- };
2664
-
2665
- _proto.practiceGetQuota = function practiceGetQuota(practiceUuid, quotaId) {
2666
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/quotas/" + quotaId);
2667
- };
2668
-
2669
- return PracticeService;
2670
- }();
2671
-
2672
- var TellerService = /*#__PURE__*/function () {
2673
- function TellerService(api, baseURL) {
2674
- this.api = api;
2675
- this.baseURL = baseURL;
2676
- }
2677
-
2678
- var _proto = TellerService.prototype;
2679
-
2680
- _proto.lockboxDataStore = /*#__PURE__*/function () {
2681
- var _lockboxDataStore = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(lockboxUuid, req, lockboxOwnerUuid, previousDataUuid) {
2682
- return runtime_1.wrap(function _callee$(_context) {
2683
- while (1) {
2684
- switch (_context.prev = _context.next) {
2685
- case 0:
2686
- return _context.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data", req, {
2687
- params: {
2688
- lockbox_owner_uuid: lockboxOwnerUuid,
2689
- data_uuid: previousDataUuid
2690
- }
2691
- }));
2692
-
2693
- case 1:
2694
- case "end":
2695
- return _context.stop();
2696
- }
2697
- }
2698
- }, _callee, this);
2699
- }));
2700
-
2701
- function lockboxDataStore(_x, _x2, _x3, _x4) {
2702
- return _lockboxDataStore.apply(this, arguments);
2703
- }
2704
-
2705
- return lockboxDataStore;
2706
- }();
2707
-
2708
- _proto.updateConsultByUUID = function updateConsultByUUID(patientUuid, uuidConsult, statusMedical, neverExpires) {
2709
- return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult, {
2710
- patientUuid: patientUuid,
2711
- statusMedical: statusMedical,
2712
- neverExpires: neverExpires
2713
- });
2714
- };
2715
-
2716
- return TellerService;
2717
- }();
2718
-
2719
- var VaultService = /*#__PURE__*/function () {
2720
- function VaultService(api, baseURL) {
2721
- this.api = api;
2722
- this.baseURL = baseURL;
2723
- }
2724
-
2725
- var _proto = VaultService.prototype;
2726
-
2727
- _proto.lockboxCreate = /*#__PURE__*/function () {
2728
- var _lockboxCreate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(lockboxMetadata) {
2729
- return runtime_1.wrap(function _callee$(_context) {
2730
- while (1) {
2731
- switch (_context.prev = _context.next) {
2732
- case 0:
2733
- return _context.abrupt("return", this.api.post(this.baseURL + "/v1/lockbox", lockboxMetadata));
2734
-
2735
- case 1:
2736
- case "end":
2737
- return _context.stop();
2738
- }
2739
- }
2740
- }, _callee, this);
2741
- }));
2742
-
2743
- function lockboxCreate(_x) {
2744
- return _lockboxCreate.apply(this, arguments);
2745
- }
2746
-
2747
- return lockboxCreate;
2748
- }();
2749
-
2750
- _proto.lockboxMetadataAdd = /*#__PURE__*/function () {
2751
- var _lockboxMetadataAdd = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(lockboxUuid, lockboxMetadata, lockboxOwnerUuid) {
2752
- return runtime_1.wrap(function _callee2$(_context2) {
2753
- while (1) {
2754
- switch (_context2.prev = _context2.next) {
2755
- case 0:
2756
- return _context2.abrupt("return", this.api.put(this.baseURL + "/v1/lockbox/" + lockboxUuid, lockboxMetadata, {
2757
- params: {
2758
- lockbox_owner_uuid: lockboxOwnerUuid
2759
- }
2760
- }));
2761
-
2762
- case 1:
2763
- case "end":
2764
- return _context2.stop();
2765
- }
2766
- }
2767
- }, _callee2, this);
2768
- }));
2769
-
2770
- function lockboxMetadataAdd(_x2, _x3, _x4) {
2771
- return _lockboxMetadataAdd.apply(this, arguments);
2772
- }
2773
-
2774
- return lockboxMetadataAdd;
2775
- }();
2776
-
2777
- _proto.lockboxSecretGet = /*#__PURE__*/function () {
2778
- var _lockboxSecretGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(lockboxUuid, lockboxOwnerUuid) {
2779
- return runtime_1.wrap(function _callee3$(_context3) {
2780
- while (1) {
2781
- switch (_context3.prev = _context3.next) {
2782
- case 0:
2783
- return _context3.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/secret", {
2784
- params: {
2785
- lockbox_owner_uuid: lockboxOwnerUuid
2786
- }
2787
- }));
2788
-
2789
- case 1:
2790
- case "end":
2791
- return _context3.stop();
2792
- }
2793
- }
2794
- }, _callee3, this);
2795
- }));
2796
-
2797
- function lockboxSecretGet(_x5, _x6) {
2798
- return _lockboxSecretGet.apply(this, arguments);
2799
- }
2800
-
2801
- return lockboxSecretGet;
2802
- }();
2803
-
2804
- _proto.lockboxGrant = /*#__PURE__*/function () {
2805
- var _lockboxGrant = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(lockboxUuid, req, lockboxOwnerUuid) {
2806
- return runtime_1.wrap(function _callee4$(_context4) {
2807
- while (1) {
2808
- switch (_context4.prev = _context4.next) {
2809
- case 0:
2810
- return _context4.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/grant", req, {
2811
- params: {
2812
- lockbox_owner_uuid: lockboxOwnerUuid
2813
- }
2814
- }));
2815
-
2816
- case 1:
2817
- case "end":
2818
- return _context4.stop();
2819
- }
2820
- }
2821
- }, _callee4, this);
2822
- }));
2823
-
2824
- function lockboxGrant(_x7, _x8, _x9) {
2825
- return _lockboxGrant.apply(this, arguments);
2826
- }
2827
-
2828
- return lockboxGrant;
2829
- }()
2830
- /**
2831
- * Get all lockboxes granted to user
2832
- * @param filter filter of lockbox metadata
2833
- * @returns decrypted lockboxes granted to user
2834
- */
2835
- ;
2836
-
2837
- _proto.grantsGet =
2838
- /*#__PURE__*/
2839
- function () {
2840
- var _grantsGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
2841
- return runtime_1.wrap(function _callee5$(_context5) {
2842
- while (1) {
2843
- switch (_context5.prev = _context5.next) {
2844
- case 0:
2845
- return _context5.abrupt("return", this.api.get(this.baseURL + "/v1/grants"));
2846
-
2847
- case 1:
2848
- case "end":
2849
- return _context5.stop();
2850
- }
2851
- }
2852
- }, _callee5, this);
2853
- }));
2854
-
2855
- function grantsGet() {
2856
- return _grantsGet.apply(this, arguments);
2857
- }
2858
-
2859
- return grantsGet;
2860
- }()
2861
- /**
2862
- * This function create or update a data into the vault.
2863
- * @note At creation it is necessary to have all `req` filled
2864
- * @note When setting `previousDataUuid` you are updating the data. `req` metadata fields are optional.
2865
- * @param lockboxUuid The lockbox uuid the data will be stored in
2866
- * @param req The request (please see notes)
2867
- * @param lockboxOwnerUuid The uuid of the owner of the lockbox (@deprecated)
2868
- * @param previousDataUuid The data uuid of the data you want to update
2869
- * @returns
2870
- */
2871
- ;
2872
-
2873
- _proto.lockboxDataStore =
2874
- /*#__PURE__*/
2875
- function () {
2876
- var _lockboxDataStore = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(lockboxUuid, req, lockboxOwnerUuid, previousDataUuid) {
2877
- return runtime_1.wrap(function _callee6$(_context6) {
2878
- while (1) {
2879
- switch (_context6.prev = _context6.next) {
2880
- case 0:
2881
- return _context6.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data", req, {
2882
- params: {
2883
- lockbox_owner_uuid: lockboxOwnerUuid,
2884
- data_uuid: previousDataUuid
2885
- }
2886
- }));
2887
-
2888
- case 1:
2889
- case "end":
2890
- return _context6.stop();
2891
- }
2892
- }
2893
- }, _callee6, this);
2894
- }));
2895
-
2896
- function lockboxDataStore(_x10, _x11, _x12, _x13) {
2897
- return _lockboxDataStore.apply(this, arguments);
2898
- }
2899
-
2900
- return lockboxDataStore;
2901
- }();
2902
-
2903
- _proto.lockboxDataGet = /*#__PURE__*/function () {
2904
- var _lockboxDataGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(lockboxUuid, dataUuid, lockboxOwnerUuid, stream) {
2905
- var data;
2906
- return runtime_1.wrap(function _callee7$(_context7) {
2907
- while (1) {
2908
- switch (_context7.prev = _context7.next) {
2909
- case 0:
2910
- if (stream === void 0) {
2911
- stream = true;
2912
- }
2913
-
2914
- _context7.next = 3;
2915
- return this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data/" + dataUuid, {
2916
- params: {
2917
- lockbox_owner_uuid: lockboxOwnerUuid,
2918
- stream: stream
2919
- }
2920
- });
2921
-
2922
- case 3:
2923
- data = _context7.sent;
2924
-
2925
- if (!stream) {
2926
- _context7.next = 6;
2927
- break;
2928
- }
2929
-
2930
- return _context7.abrupt("return", {
2931
- data: data
2932
- });
2933
-
2934
- case 6:
2935
- return _context7.abrupt("return", data);
2936
-
2937
- case 7:
2938
- case "end":
2939
- return _context7.stop();
2940
- }
2941
- }
2942
- }, _callee7, this);
2943
- }));
2944
-
2945
- function lockboxDataGet(_x14, _x15, _x16, _x17) {
2946
- return _lockboxDataGet.apply(this, arguments);
2947
- }
2948
-
2949
- return lockboxDataGet;
2950
- }();
2951
-
2952
- _proto.lockboxManifestGet = /*#__PURE__*/function () {
2953
- var _lockboxManifestGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(lockboxUuid, filter, lockboxOwnerUuid) {
2954
- return runtime_1.wrap(function _callee8$(_context8) {
2955
- while (1) {
2956
- switch (_context8.prev = _context8.next) {
2957
- case 0:
2958
- return _context8.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid, {
2959
- params: {
2960
- lockbox_owner_uuid: lockboxOwnerUuid,
2961
- filter: filter
2962
- }
2963
- }));
2964
-
2965
- case 1:
2966
- case "end":
2967
- return _context8.stop();
2968
- }
2969
- }
2970
- }, _callee8, this);
2971
- }));
2972
-
2973
- function lockboxManifestGet(_x18, _x19, _x20) {
2974
- return _lockboxManifestGet.apply(this, arguments);
2975
- }
2976
-
2977
- return lockboxManifestGet;
2978
- }();
2979
-
2980
- _proto.lockboxMetadataGet = /*#__PURE__*/function () {
2981
- var _lockboxMetadataGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(lockboxUuid, fields, groupby, filter, lockboxOwnerUuid) {
2982
- return runtime_1.wrap(function _callee9$(_context9) {
2983
- while (1) {
2984
- switch (_context9.prev = _context9.next) {
2985
- case 0:
2986
- return _context9.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/metadata", {
2987
- params: {
2988
- lockbox_owner_uuid: lockboxOwnerUuid,
2989
- fields: fields,
2990
- groupby: groupby,
2991
- filter: filter
2992
- }
2993
- }));
2994
-
2995
- case 1:
2996
- case "end":
2997
- return _context9.stop();
2998
- }
2999
- }
3000
- }, _callee9, this);
3001
- }));
3002
-
3003
- function lockboxMetadataGet(_x21, _x22, _x23, _x24, _x25) {
3004
- return _lockboxMetadataGet.apply(this, arguments);
3005
- }
3006
-
3007
- return lockboxMetadataGet;
3008
- }()
3009
- /**
3010
- * inserts or updates encrypted index entries
3011
- * @note if the index data is being inserted for a user other than the requester, use `indexOwnerUuid`
3012
- * @note if a uuid for an entry is provided, the service will perform an update
3013
- * @param entries the encrypted index data
3014
- * @param indexOwnerUuid
3015
- */
3016
- ;
3017
-
3018
- _proto.vaultIndexPut =
3019
- /*#__PURE__*/
3020
- function () {
3021
- var _vaultIndexPut = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(entries, indexOwnerUuid) {
3022
- return runtime_1.wrap(function _callee10$(_context10) {
3023
- while (1) {
3024
- switch (_context10.prev = _context10.next) {
3025
- case 0:
3026
- return _context10.abrupt("return", this.api.put(this.baseURL + "/v1/index", entries, {
3027
- params: {
3028
- index_owner_uuid: indexOwnerUuid
3029
- }
3030
- }));
3031
-
3032
- case 1:
3033
- case "end":
3034
- return _context10.stop();
3035
- }
3036
- }
3037
- }, _callee10, this);
3038
- }));
3039
-
3040
- function vaultIndexPut(_x26, _x27) {
3041
- return _vaultIndexPut.apply(this, arguments);
3042
- }
3043
-
3044
- return vaultIndexPut;
3045
- }()
3046
- /**
3047
- * inserts or updates index snapshot for the provided index owner
3048
- * @note if the index data is being inserted for a user other than the requester, use `indexOwnerUuid`
3049
- * @param entry the encrypted index snapshot
3050
- */
3051
- ;
3052
-
3053
- _proto.vaultIndexSnapshotPut =
3054
- /*#__PURE__*/
3055
- function () {
3056
- var _vaultIndexSnapshotPut = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(entry) {
3057
- return runtime_1.wrap(function _callee11$(_context11) {
3058
- while (1) {
3059
- switch (_context11.prev = _context11.next) {
3060
- case 0:
3061
- return _context11.abrupt("return", this.api.put(this.baseURL + "/v1/index-snapshot", entry));
3062
-
3063
- case 1:
3064
- case "end":
3065
- return _context11.stop();
3066
- }
3067
- }
3068
- }, _callee11, this);
3069
- }));
3070
-
3071
- function vaultIndexSnapshotPut(_x28) {
3072
- return _vaultIndexSnapshotPut.apply(this, arguments);
3073
- }
3074
-
3075
- return vaultIndexSnapshotPut;
3076
- }()
3077
- /**
3078
- * Retrieves the encrypted index from the vault for the requesting user
3079
- * @note index keys can be specified to narrow the scope of index being requested
3080
- * @param indexKeys accepted index fields determined by vault
3081
- * @param identifiers: an array of unique_hashes or consultation uuids used to identify an index entry
3082
- * @param timestamp the minimum timestamp that index entries were created
3083
- * @returns the encrypted index
3084
- */
3085
- ;
3086
-
3087
- _proto.vaultIndexGet =
3088
- /*#__PURE__*/
3089
- function () {
3090
- var _vaultIndexGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(indexKeys, identifiers, timestamp) {
3091
- return runtime_1.wrap(function _callee12$(_context12) {
3092
- while (1) {
3093
- switch (_context12.prev = _context12.next) {
3094
- case 0:
3095
- return _context12.abrupt("return", this.api.get(this.baseURL + "/v1/index", {
3096
- params: {
3097
- index_keys: indexKeys,
3098
- identifiers: identifiers,
3099
- timestamp: timestamp
3100
- }
3101
- }));
3102
-
3103
- case 1:
3104
- case "end":
3105
- return _context12.stop();
3106
- }
3107
- }
3108
- }, _callee12, this);
3109
- }));
3110
-
3111
- function vaultIndexGet(_x29, _x30, _x31) {
3112
- return _vaultIndexGet.apply(this, arguments);
3113
- }
3114
-
3115
- return vaultIndexGet;
3116
- }();
3117
-
3118
- return VaultService;
3119
- }();
3120
-
3121
- var WorkflowService = /*#__PURE__*/function () {
3122
- function WorkflowService(api, url) {
3123
- this.api = api;
3124
- this.v1Url = url + "/v1";
3125
- }
3126
- /**
3127
- * This function returns all workflows
3128
- * @returns desired workflow
3129
- */
3130
-
3131
-
3132
- var _proto = WorkflowService.prototype;
913
+ if (finallyEntry &&
914
+ (type === "break" ||
915
+ type === "continue") &&
916
+ finallyEntry.tryLoc <= arg &&
917
+ arg <= finallyEntry.finallyLoc) {
918
+ // Ignore the finally entry if control is not jumping to a
919
+ // location outside the try/catch block.
920
+ finallyEntry = null;
921
+ }
3133
922
 
3134
- _proto.getWorkflows = function getWorkflows() {
3135
- return this.api.get(this.v1Url + "/workflows");
3136
- }
3137
- /**
3138
- * This function retrieves a workflow. If `locale` is not found, it will try to find 'en' version of it.
3139
- * By default, will return most recent workflow of a specific `id`. `createdAt` can be used to select older version.
3140
- * @param id The uuid of the workflow
3141
- * @param locale (optional) The desired locale of the workflow (default: 'en')
3142
- * @param createdAt (optional) The creation date of the workflow (also used for versionning)
3143
- * @returns desired workflow
3144
- */
3145
- ;
923
+ var record = finallyEntry ? finallyEntry.completion : {};
924
+ record.type = type;
925
+ record.arg = arg;
3146
926
 
3147
- _proto.getWorkflow = function getWorkflow(id, locale, createdAt) {
3148
- return this.api.get(this.v1Url + "/workflows/" + id, {
3149
- params: {
3150
- locale: locale,
3151
- createdAt: createdAt
927
+ if (finallyEntry) {
928
+ this.method = "next";
929
+ this.next = finallyEntry.finallyLoc;
930
+ return ContinueSentinel;
3152
931
  }
3153
- });
3154
- };
3155
932
 
3156
- return WorkflowService;
3157
- }();
933
+ return this.complete(record);
934
+ },
3158
935
 
3159
- var _excluded = ["locale"],
3160
- _excluded2 = ["locale"];
3161
- var CliniaService = /*#__PURE__*/function () {
3162
- function CliniaService(url, apiKey, locale) {
3163
- this.url = url;
3164
- this.locale = locale;
3165
- this.api = new AxiosService({
3166
- headers: {
3167
- 'X-Clinia-API-Key': apiKey
936
+ complete: function(record, afterLoc) {
937
+ if (record.type === "throw") {
938
+ throw record.arg;
3168
939
  }
3169
- });
3170
- }
3171
940
 
3172
- var _proto = CliniaService.prototype;
941
+ if (record.type === "break" ||
942
+ record.type === "continue") {
943
+ this.next = record.arg;
944
+ } else if (record.type === "return") {
945
+ this.rval = this.arg = record.arg;
946
+ this.method = "return";
947
+ this.next = "end";
948
+ } else if (record.type === "normal" && afterLoc) {
949
+ this.next = afterLoc;
950
+ }
3173
951
 
3174
- _proto.placeSearch = function placeSearch(searchOptions) {
3175
- var locale = searchOptions.locale,
3176
- data = _objectWithoutPropertiesLoose(searchOptions, _excluded);
952
+ return ContinueSentinel;
953
+ },
3177
954
 
3178
- return this.api.post(this.url + "/search/v1/indexes/health_facility/query", data, {
3179
- params: {
3180
- locale: locale != null ? locale : this.locale
955
+ finish: function(finallyLoc) {
956
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
957
+ var entry = this.tryEntries[i];
958
+ if (entry.finallyLoc === finallyLoc) {
959
+ this.complete(entry.completion, entry.afterLoc);
960
+ resetTryEntry(entry);
961
+ return ContinueSentinel;
962
+ }
3181
963
  }
3182
- });
3183
- };
964
+ },
3184
965
 
3185
- _proto.placeMatch = function placeMatch(searchOptions, type) {
3186
- var locale = searchOptions.locale,
3187
- data = _objectWithoutPropertiesLoose(searchOptions, _excluded2);
966
+ "catch": function(tryLoc) {
967
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
968
+ var entry = this.tryEntries[i];
969
+ if (entry.tryLoc === tryLoc) {
970
+ var record = entry.completion;
971
+ if (record.type === "throw") {
972
+ var thrown = record.arg;
973
+ resetTryEntry(entry);
974
+ }
975
+ return thrown;
976
+ }
977
+ }
3188
978
 
3189
- var request = this.api.post(this.url + "/search/v1/matches", data, {
3190
- params: {
3191
- locale: locale != null ? locale : this.locale
979
+ // The context.catch method must only be called with a location
980
+ // argument that corresponds to a known catch block.
981
+ throw new Error("illegal catch attempt");
982
+ },
983
+
984
+ delegateYield: function(iterable, resultName, nextLoc) {
985
+ this.delegate = {
986
+ iterator: values(iterable),
987
+ resultName: resultName,
988
+ nextLoc: nextLoc
989
+ };
990
+
991
+ if (this.method === "next") {
992
+ // Deliberately forget the last sent value so that we don't
993
+ // accidentally pass it on to the delegate.
994
+ this.arg = undefined$1;
3192
995
  }
3193
- });
3194
996
 
3195
- if (type) {
3196
- request = request.then(function (places) {
3197
- return places.filter(function (place) {
3198
- return place.type === type;
3199
- });
3200
- });
997
+ return ContinueSentinel;
3201
998
  }
3202
-
3203
- return request;
3204
999
  };
3205
1000
 
3206
- return CliniaService;
3207
- }();
1001
+ // Regardless of whether this script is executing as a CommonJS module
1002
+ // or not, return the runtime object so that we can declare the variable
1003
+ // regeneratorRuntime in the outer scope, which allows this module to be
1004
+ // injected easily by `bin/regenerator --include-runtime script.js`.
1005
+ return exports;
1006
+
1007
+ }(
1008
+ // If this script is executing as a CommonJS module, use module.exports
1009
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
1010
+ // object. Either way, the resulting object will be used to initialize
1011
+ // the regeneratorRuntime variable at the top of this file.
1012
+ module.exports
1013
+ ));
1014
+
1015
+ try {
1016
+ regeneratorRuntime = runtime;
1017
+ } catch (accidentalStrictMode) {
1018
+ // This module should not be running in strict mode, so the above
1019
+ // assignment should always work unless something is misconfigured. Just
1020
+ // in case runtime.js accidentally runs in strict mode, in modern engines
1021
+ // we can explicitly access globalThis. In older engines we can escape
1022
+ // strict mode using a global Function call. This could conceivably fail
1023
+ // if a Content Security Policy forbids using Function, but in that case
1024
+ // the proper solution is to fix the accidental strict mode problem. If
1025
+ // you've misconfigured your bundler to force strict mode and applied a
1026
+ // CSP to forbid Function, and you're not willing to fix either of those
1027
+ // problems, please detail your unique predicament in a GitHub issue.
1028
+ if (typeof globalThis === "object") {
1029
+ globalThis.regeneratorRuntime = runtime;
1030
+ } else {
1031
+ Function("r", "regeneratorRuntime = r")(runtime);
1032
+ }
1033
+ }
1034
+ });
3208
1035
 
3209
1036
  var _personalMetaToPrefix;
3210
- var personalMetaToPrefix = (_personalMetaToPrefix = {}, _personalMetaToPrefix[exports.MetadataCategory.Personal] = 'you', _personalMetaToPrefix[exports.MetadataCategory.ChildPersonal] = 'child', _personalMetaToPrefix[exports.MetadataCategory.OtherPersonal] = 'other', _personalMetaToPrefix);
1037
+ var personalMetaToPrefix = (_personalMetaToPrefix = {}, _personalMetaToPrefix[initApis.MetadataCategory.Personal] = 'you', _personalMetaToPrefix[initApis.MetadataCategory.ChildPersonal] = 'child', _personalMetaToPrefix[initApis.MetadataCategory.OtherPersonal] = 'other', _personalMetaToPrefix);
3211
1038
  /**
3212
1039
  * This function extract PersonalInformations from data input object coming from workflow
3213
1040
  * @param data extracted from WorkflowData
@@ -3356,6 +1183,61 @@ function sessionStorePrivateKeyName(id) {
3356
1183
  return sessionPrivateKeyPrefix + id;
3357
1184
  }
3358
1185
 
1186
+ var IncompleteAuthentication = /*#__PURE__*/function (_Error) {
1187
+ _inheritsLoose(IncompleteAuthentication, _Error);
1188
+
1189
+ function IncompleteAuthentication() {
1190
+ return _Error.apply(this, arguments) || this;
1191
+ }
1192
+
1193
+ return IncompleteAuthentication;
1194
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1195
+ var MissingGrant = /*#__PURE__*/function (_Error2) {
1196
+ _inheritsLoose(MissingGrant, _Error2);
1197
+
1198
+ function MissingGrant() {
1199
+ return _Error2.apply(this, arguments) || this;
1200
+ }
1201
+
1202
+ return MissingGrant;
1203
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1204
+ var MissingLockbox = /*#__PURE__*/function (_Error3) {
1205
+ _inheritsLoose(MissingLockbox, _Error3);
1206
+
1207
+ function MissingLockbox() {
1208
+ return _Error3.apply(this, arguments) || this;
1209
+ }
1210
+
1211
+ return MissingLockbox;
1212
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1213
+ var MissingLockboxOwner = /*#__PURE__*/function (_Error4) {
1214
+ _inheritsLoose(MissingLockboxOwner, _Error4);
1215
+
1216
+ function MissingLockboxOwner() {
1217
+ return _Error4.apply(this, arguments) || this;
1218
+ }
1219
+
1220
+ return MissingLockboxOwner;
1221
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1222
+ var AssociatedLockboxNotFound = /*#__PURE__*/function (_Error5) {
1223
+ _inheritsLoose(AssociatedLockboxNotFound, _Error5);
1224
+
1225
+ function AssociatedLockboxNotFound() {
1226
+ return _Error5.apply(this, arguments) || this;
1227
+ }
1228
+
1229
+ return AssociatedLockboxNotFound;
1230
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1231
+ var WorkflowAnswersMissingError = /*#__PURE__*/function (_Error6) {
1232
+ _inheritsLoose(WorkflowAnswersMissingError, _Error6);
1233
+
1234
+ function WorkflowAnswersMissingError() {
1235
+ return _Error6.apply(this, arguments) || this;
1236
+ }
1237
+
1238
+ return WorkflowAnswersMissingError;
1239
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1240
+
3359
1241
  function filterTriggeredAnsweredWithKind(_x, _x2) {
3360
1242
  return _filterTriggeredAnsweredWithKind.apply(this, arguments);
3361
1243
  }
@@ -3798,7 +1680,7 @@ function _registerPatient() {
3798
1680
 
3799
1681
  case 25:
3800
1682
  // the index will identify in which lockbox a consultation live
3801
- consultIndex = (_consultIndex = {}, _consultIndex[exports.IndexKey.ConsultationLockbox] = [{
1683
+ consultIndex = (_consultIndex = {}, _consultIndex[initApis.IndexKey.ConsultationLockbox] = [{
3802
1684
  grant: {
3803
1685
  lockboxUuid: lockboxUuid,
3804
1686
  lockboxOwnerUuid: patientUuid
@@ -3831,7 +1713,7 @@ function _registerPatient() {
3831
1713
  };
3832
1714
  }()); //DEPRECATED: REMOVE ME : BEGIN /////////////////////////////////////////
3833
1715
 
3834
- deprecatedConsultIndex = (_deprecatedConsultInd = {}, _deprecatedConsultInd[exports.IndexKey.Consultation] = [{
1716
+ deprecatedConsultIndex = (_deprecatedConsultInd = {}, _deprecatedConsultInd[initApis.IndexKey.Consultation] = [{
3835
1717
  grant: {
3836
1718
  lockboxUuid: lockboxUuid,
3837
1719
  lockboxOwnerUuid: patientUuid
@@ -3906,7 +1788,7 @@ function _registerPatient() {
3906
1788
  case 40:
3907
1789
  _context4.next = 42;
3908
1790
  return oroClient.consultClient.updateConsultByUUID(consult.uuid, {
3909
- statusMedical: exports.MedicalStatus.New
1791
+ statusMedical: initApis.MedicalStatus.New
3910
1792
  });
3911
1793
 
3912
1794
  case 42:
@@ -3995,8 +1877,8 @@ function _patientConsultExists() {
3995
1877
  switch (_context6.prev = _context6.next) {
3996
1878
  case 0:
3997
1879
  publicMetadata = {
3998
- category: exports.MetadataCategory.Consultation,
3999
- documentType: exports.DocumentType.PopulatedWorkflowData
1880
+ category: initApis.MetadataCategory.Consultation,
1881
+ documentType: initApis.DocumentType.PopulatedWorkflowData
4000
1882
  };
4001
1883
  _context6.next = 3;
4002
1884
  return oroClient.vaultClient.lockboxMetadataGet(lockboxUuid, ['consultationId'], [], publicMetadata);
@@ -4139,27 +2021,27 @@ function _storePatientData() {
4139
2021
  console.error('[SDK] Some errors happened during image upload', err);
4140
2022
  }), // Storing Raw data first
4141
2023
  oroClient.getOrInsertJsonData(lockboxUuid, workflow, {
4142
- category: exports.MetadataCategory.Raw,
2024
+ category: initApis.MetadataCategory.Raw,
4143
2025
  contentType: 'application/json',
4144
2026
  consultationId: consultationId
4145
- }, {}), getWorkflowDataByCategory(workflow, exports.MetadataCategory.Consultation).then(function (data) {
2027
+ }, {}), getWorkflowDataByCategory(workflow, initApis.MetadataCategory.Consultation).then(function (data) {
4146
2028
  return oroClient.getOrInsertJsonData(lockboxUuid, data, {
4147
- category: exports.MetadataCategory.Consultation,
4148
- documentType: exports.DocumentType.PopulatedWorkflowData,
2029
+ category: initApis.MetadataCategory.Consultation,
2030
+ documentType: initApis.DocumentType.PopulatedWorkflowData,
4149
2031
  consultationId: consultationId
4150
2032
  }, {
4151
2033
  consultationId: consultationId
4152
2034
  });
4153
- }), getWorkflowDataByCategory(workflow, exports.MetadataCategory.Medical).then(function (data) {
2035
+ }), getWorkflowDataByCategory(workflow, initApis.MetadataCategory.Medical).then(function (data) {
4154
2036
  return oroClient.getOrInsertJsonData(lockboxUuid, data, {
4155
- category: exports.MetadataCategory.Medical,
4156
- documentType: exports.DocumentType.PopulatedWorkflowData,
2037
+ category: initApis.MetadataCategory.Medical,
2038
+ documentType: initApis.DocumentType.PopulatedWorkflowData,
4157
2039
  consultationIds: [consultationId]
4158
2040
  }, {});
4159
- }), extractAndStorePersonalWorkflowData(workflow, lockboxUuid, consultationId, exports.MetadataCategory.Personal, oroClient), extractAndStorePersonalWorkflowData(workflow, lockboxUuid, consultationId, exports.MetadataCategory.ChildPersonal, oroClient), extractAndStorePersonalWorkflowData(workflow, lockboxUuid, consultationId, exports.MetadataCategory.OtherPersonal, oroClient), oroClient.getOrInsertJsonData(lockboxUuid, {
2041
+ }), extractAndStorePersonalWorkflowData(workflow, lockboxUuid, consultationId, initApis.MetadataCategory.Personal, oroClient), extractAndStorePersonalWorkflowData(workflow, lockboxUuid, consultationId, initApis.MetadataCategory.ChildPersonal, oroClient), extractAndStorePersonalWorkflowData(workflow, lockboxUuid, consultationId, initApis.MetadataCategory.OtherPersonal, oroClient), oroClient.getOrInsertJsonData(lockboxUuid, {
4160
2042
  isoLanguage: isoLanguage
4161
2043
  }, {
4162
- category: exports.MetadataCategory.Preference,
2044
+ category: initApis.MetadataCategory.Preference,
4163
2045
  contentType: 'application/json'
4164
2046
  }, {})]).then(function (dataUuids) {
4165
2047
  return dataUuids.flat();
@@ -4217,8 +2099,8 @@ function _storeImageAliases() {
4217
2099
 
4218
2100
  promises = nonNullImages.map(function (image) {
4219
2101
  return oroClient.getOrInsertJsonData(lockboxUuid, image, {
4220
- category: exports.MetadataCategory.Consultation,
4221
- documentType: exports.DocumentType.ImageAlias,
2102
+ category: initApis.MetadataCategory.Consultation,
2103
+ documentType: initApis.DocumentType.ImageAlias,
4222
2104
  consultationId: consultationId,
4223
2105
  idbId: image.idbId
4224
2106
  }, {});
@@ -4249,7 +2131,7 @@ function _extractAndStorePersonalWorkflowData() {
4249
2131
  if (Object.keys(data.fields).length === 0) return;
4250
2132
  return oroClient.getOrInsertJsonData(lockboxUuid, data, {
4251
2133
  category: category,
4252
- documentType: exports.DocumentType.PopulatedWorkflowData,
2134
+ documentType: initApis.DocumentType.PopulatedWorkflowData,
4253
2135
  consultationIds: [consultationId]
4254
2136
  }, {});
4255
2137
  }));
@@ -4356,12 +2238,12 @@ function _filterGrantsWithLockboxMetadata() {
4356
2238
  vaultIndex = _context.sent;
4357
2239
 
4358
2240
  case 5:
4359
- if (!(vaultIndex[exports.IndexKey.Consultation] && filter)) {
2241
+ if (!(vaultIndex[initApis.IndexKey.Consultation] && filter)) {
4360
2242
  _context.next = 10;
4361
2243
  break;
4362
2244
  }
4363
2245
 
4364
- indexConsults = ((_vaultIndex$IndexKey$ = vaultIndex[exports.IndexKey.Consultation]) != null ? _vaultIndex$IndexKey$ : []).filter(function (consultGrant) {
2246
+ indexConsults = ((_vaultIndex$IndexKey$ = vaultIndex[initApis.IndexKey.Consultation]) != null ? _vaultIndex$IndexKey$ : []).filter(function (consultGrant) {
4365
2247
  return consultGrant.consultationId === filter.consultationId;
4366
2248
  }).map(function (consultGrant) {
4367
2249
  return consultGrant.grant;
@@ -4410,7 +2292,7 @@ function _buildLegacyVaultIndex() {
4410
2292
  grant = _step.value;
4411
2293
  _context2.next = 3;
4412
2294
  return oroClient.vaultClient.lockboxMetadataGet(grant.lockboxUuid, ['consultationId'], [], {
4413
- category: exports.MetadataCategory.Consultation
2295
+ category: initApis.MetadataCategory.Consultation
4414
2296
  });
4415
2297
 
4416
2298
  case 3:
@@ -4446,7 +2328,7 @@ function _buildLegacyVaultIndex() {
4446
2328
  break;
4447
2329
 
4448
2330
  case 10:
4449
- vaultIndex = (_vaultIndex = {}, _vaultIndex[exports.IndexKey.Consultation] = consultGrants, _vaultIndex);
2331
+ vaultIndex = (_vaultIndex = {}, _vaultIndex[initApis.IndexKey.Consultation] = consultGrants, _vaultIndex);
4450
2332
  oroClient.setVaultIndex(vaultIndex);
4451
2333
  console.info('[sdk:index] Successfully Built Vault Index');
4452
2334
  return _context3.abrupt("return", vaultIndex);
@@ -4478,7 +2360,7 @@ var OroClient = /*#__PURE__*/function () {
4478
2360
  }
4479
2361
  /**
4480
2362
  * clears the vaultIndex and cached metadata grants
4481
- */
2363
+ */
4482
2364
 
4483
2365
 
4484
2366
  var _proto = OroClient.prototype;
@@ -4955,7 +2837,7 @@ var OroClient = /*#__PURE__*/function () {
4955
2837
  case 0:
4956
2838
  _context9.next = 2;
4957
2839
  return _this.vaultClient.lockboxMetadataGet(grant.lockboxUuid, ['consultationId'], [], {
4958
- category: exports.MetadataCategory.Consultation
2840
+ category: initApis.MetadataCategory.Consultation
4959
2841
  }, grant.lockboxOwnerUuid).then(function (consults) {
4960
2842
  try {
4961
2843
  return consults[0].map(function (consult) {
@@ -4994,7 +2876,7 @@ var OroClient = /*#__PURE__*/function () {
4994
2876
 
4995
2877
  case 5:
4996
2878
  indexConsultLockbox = _context10.sent;
4997
- this.vaultIndexAdd((_this$vaultIndexAdd = {}, _this$vaultIndexAdd[exports.IndexKey.Consultation] = indexConsultLockbox, _this$vaultIndexAdd)).then(function () {
2879
+ this.vaultIndexAdd((_this$vaultIndexAdd = {}, _this$vaultIndexAdd[initApis.IndexKey.Consultation] = indexConsultLockbox, _this$vaultIndexAdd)).then(function () {
4998
2880
  return alert('The Index was successfully updated!');
4999
2881
  })["catch"](function () {
5000
2882
  return console.error('The index failed to update!');
@@ -5072,7 +2954,7 @@ var OroClient = /*#__PURE__*/function () {
5072
2954
  keyString = _Object$keys[_i];
5073
2955
  key = keyString;
5074
2956
  _context11.t0 = key;
5075
- _context11.next = _context11.t0 === exports.IndexKey.ConsultationLockbox ? 18 : _context11.t0 === exports.IndexKey.Consultation ? 20 : 22;
2957
+ _context11.next = _context11.t0 === initApis.IndexKey.ConsultationLockbox ? 18 : _context11.t0 === initApis.IndexKey.Consultation ? 20 : 22;
5076
2958
  break;
5077
2959
 
5078
2960
  case 18:
@@ -5104,7 +2986,7 @@ var OroClient = /*#__PURE__*/function () {
5104
2986
  }).filter(function (e) {
5105
2987
  var _this2$vaultIndex$Ind;
5106
2988
 
5107
- return !_this2.vaultIndex || !((_this2$vaultIndex$Ind = _this2.vaultIndex[exports.IndexKey.Consultation]) != null && _this2$vaultIndex$Ind.find(function (v) {
2989
+ return !_this2.vaultIndex || !((_this2$vaultIndex$Ind = _this2.vaultIndex[initApis.IndexKey.Consultation]) != null && _this2$vaultIndex$Ind.find(function (v) {
5108
2990
  return v.uniqueHash === e.uniqueHash;
5109
2991
  }));
5110
2992
  }).map(function (e) {
@@ -5169,7 +3051,7 @@ var OroClient = /*#__PURE__*/function () {
5169
3051
 
5170
3052
  case 2:
5171
3053
  rsaPub = this.rsa["public"]();
5172
- cleanedIndex = (_cleanedIndex = {}, _cleanedIndex[exports.IndexKey.Consultation] = (_index$IndexKey$Consu = index[exports.IndexKey.Consultation]) == null ? void 0 : _index$IndexKey$Consu.filter(function (c) {
3054
+ cleanedIndex = (_cleanedIndex = {}, _cleanedIndex[initApis.IndexKey.Consultation] = (_index$IndexKey$Consu = index[initApis.IndexKey.Consultation]) == null ? void 0 : _index$IndexKey$Consu.filter(function (c) {
5173
3055
  return c;
5174
3056
  }).map(function (c) {
5175
3057
  return {
@@ -5308,8 +3190,8 @@ var OroClient = /*#__PURE__*/function () {
5308
3190
  encryptedPrivateMeta = _context14.t0.jsonEncryptToBase64Payload.call(_context14.t0, _context14.t2);
5309
3191
  meta = {
5310
3192
  consultationId: consultationId,
5311
- category: exports.MetadataCategory.Consultation,
5312
- documentType: exports.DocumentType.Message,
3193
+ category: initApis.MetadataCategory.Consultation,
3194
+ documentType: initApis.DocumentType.Message,
5313
3195
  contentType: 'text/plain'
5314
3196
  };
5315
3197
  request = {
@@ -5394,8 +3276,8 @@ var OroClient = /*#__PURE__*/function () {
5394
3276
  encryptedPrivateMeta = _context15.t4.jsonEncryptToBase64Payload.call(_context15.t4, _context15.t9);
5395
3277
  meta = {
5396
3278
  consultationId: consultationId,
5397
- category: exports.MetadataCategory.Consultation,
5398
- documentType: exports.DocumentType.Message,
3279
+ category: initApis.MetadataCategory.Consultation,
3280
+ documentType: initApis.DocumentType.Message,
5399
3281
  contentType: data.type
5400
3282
  };
5401
3283
  request = {
@@ -5459,7 +3341,7 @@ var OroClient = /*#__PURE__*/function () {
5459
3341
  _context16.t4 = new _context16.t2(_context16.t3);
5460
3342
  _context16.t5 = {
5461
3343
  consultationId: consultationId,
5462
- category: exports.MetadataCategory.Consultation,
3344
+ category: initApis.MetadataCategory.Consultation,
5463
3345
  documentType: documentType,
5464
3346
  contentType: data.type
5465
3347
  };
@@ -5819,10 +3701,10 @@ var OroClient = /*#__PURE__*/function () {
5819
3701
 
5820
3702
  case 6:
5821
3703
  _context22.next = 8;
5822
- return this.vaultClient.vaultIndexGet([exports.IndexKey.ConsultationLockbox], [filter == null ? void 0 : filter.consultationId]);
3704
+ return this.vaultClient.vaultIndexGet([initApis.IndexKey.ConsultationLockbox], [filter == null ? void 0 : filter.consultationId]);
5823
3705
 
5824
3706
  case 8:
5825
- _context22.t0 = exports.IndexKey.ConsultationLockbox;
3707
+ _context22.t0 = initApis.IndexKey.ConsultationLockbox;
5826
3708
  grantsByConsultLockbox = _context22.sent[_context22.t0];
5827
3709
  decryptedConsults = decryptConsultLockboxGrants(grantsByConsultLockbox != null ? grantsByConsultLockbox : [], this.rsa);
5828
3710
 
@@ -6006,7 +3888,7 @@ var OroClient = /*#__PURE__*/function () {
6006
3888
  forceRefresh = false;
6007
3889
  }
6008
3890
 
6009
- return _context25.abrupt("return", this.getMetaCategoryFromConsultId(consultationId, exports.MetadataCategory.Medical, forceRefresh));
3891
+ return _context25.abrupt("return", this.getMetaCategoryFromConsultId(consultationId, initApis.MetadataCategory.Medical, forceRefresh));
6010
3892
 
6011
3893
  case 2:
6012
3894
  case "end":
@@ -6055,7 +3937,7 @@ var OroClient = /*#__PURE__*/function () {
6055
3937
  _context27.next = 3;
6056
3938
  return _this3.getLockboxManifest(grant.lockboxUuid, {
6057
3939
  category: category,
6058
- documentType: exports.DocumentType.PopulatedWorkflowData,
3940
+ documentType: initApis.DocumentType.PopulatedWorkflowData,
6059
3941
  consultationIds: [consultationId]
6060
3942
  }, true, grant.lockboxOwnerUuid, forceRefresh);
6061
3943
 
@@ -6070,7 +3952,7 @@ var OroClient = /*#__PURE__*/function () {
6070
3952
  _context27.next = 7;
6071
3953
  return _this3.getLockboxManifest(grant.lockboxUuid, {
6072
3954
  category: category,
6073
- documentType: exports.DocumentType.PopulatedWorkflowData
3955
+ documentType: initApis.DocumentType.PopulatedWorkflowData
6074
3956
  }, true, grant.lockboxOwnerUuid, forceRefresh);
6075
3957
 
6076
3958
  case 7:
@@ -6208,8 +4090,8 @@ var OroClient = /*#__PURE__*/function () {
6208
4090
  case 10:
6209
4091
  _context29.next = 12;
6210
4092
  return this.getLockboxManifest(lockboxUuid, {
6211
- category: exports.MetadataCategory.Personal,
6212
- documentType: exports.DocumentType.PopulatedWorkflowData
4093
+ category: initApis.MetadataCategory.Personal,
4094
+ documentType: initApis.DocumentType.PopulatedWorkflowData
6213
4095
  }, false, userId);
6214
4096
 
6215
4097
  case 12:
@@ -6486,8 +4368,8 @@ var OroClient = /*#__PURE__*/function () {
6486
4368
  }
6487
4369
 
6488
4370
  return _context34.abrupt("return", this.createJsonData(lockboxUuid, data, {
6489
- category: exports.MetadataCategory.Personal,
6490
- documentType: exports.DocumentType.PopulatedWorkflowData
4371
+ category: initApis.MetadataCategory.Personal,
4372
+ documentType: initApis.DocumentType.PopulatedWorkflowData
6491
4373
  }, {}, undefined, dataUuid));
6492
4374
 
6493
4375
  case 13:
@@ -6556,7 +4438,7 @@ var OroClient = /*#__PURE__*/function () {
6556
4438
  }
6557
4439
 
6558
4440
  return _context35.abrupt("return", this.createJsonData(lockboxUuid, preference, {
6559
- category: exports.MetadataCategory.Preference,
4441
+ category: initApis.MetadataCategory.Preference,
6560
4442
  contentType: 'application/json'
6561
4443
  }, {}, undefined, dataUuid));
6562
4444
 
@@ -6676,7 +4558,7 @@ var OroClient = /*#__PURE__*/function () {
6676
4558
 
6677
4559
  case 5:
6678
4560
  return _context37.abrupt("return", this.getDataFromGrant(grant, {
6679
- category: exports.MetadataCategory.Preference,
4561
+ category: initApis.MetadataCategory.Preference,
6680
4562
  contentType: 'application/json'
6681
4563
  }));
6682
4564
 
@@ -6727,7 +4609,7 @@ var OroClient = /*#__PURE__*/function () {
6727
4609
 
6728
4610
  case 5:
6729
4611
  return _context38.abrupt("return", this.getDataFromGrant(grant, {
6730
- category: exports.MetadataCategory.Preference,
4612
+ category: initApis.MetadataCategory.Preference,
6731
4613
  contentType: 'application/json'
6732
4614
  }));
6733
4615
 
@@ -6776,7 +4658,7 @@ var OroClient = /*#__PURE__*/function () {
6776
4658
 
6777
4659
  case 5:
6778
4660
  return _context39.abrupt("return", this.getDataFromGrant(grant, {
6779
- category: exports.MetadataCategory.Recovery,
4661
+ category: initApis.MetadataCategory.Recovery,
6780
4662
  contentType: 'application/json'
6781
4663
  }));
6782
4664
 
@@ -6827,7 +4709,7 @@ var OroClient = /*#__PURE__*/function () {
6827
4709
 
6828
4710
  case 5:
6829
4711
  return _context40.abrupt("return", this.getDataFromGrant(grant, {
6830
- category: exports.MetadataCategory.Recovery,
4712
+ category: initApis.MetadataCategory.Recovery,
6831
4713
  contentType: 'application/json'
6832
4714
  }));
6833
4715
 
@@ -6878,8 +4760,8 @@ var OroClient = /*#__PURE__*/function () {
6878
4760
  case 4:
6879
4761
  _context42.t1 = _context42.sent.map(function (grant) {
6880
4762
  return _this5.getLockboxManifest(grant.lockboxUuid, {
6881
- category: exports.MetadataCategory.Consultation,
6882
- documentType: exports.DocumentType.PopulatedWorkflowData
4763
+ category: initApis.MetadataCategory.Consultation,
4764
+ documentType: initApis.DocumentType.PopulatedWorkflowData
6883
4765
  }, true, undefined, forceRefresh).then(function (manifest) {
6884
4766
  return Promise.all(manifest.map( /*#__PURE__*/function () {
6885
4767
  var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee40(entry) {
@@ -6961,8 +4843,8 @@ var OroClient = /*#__PURE__*/function () {
6961
4843
  case 5:
6962
4844
  _context44.next = 7;
6963
4845
  return this.vaultClient.lockboxMetadataGet(grant.lockboxUuid, ['consultationId'], ['consultationId'], {
6964
- category: exports.MetadataCategory.Consultation,
6965
- documentType: exports.DocumentType.PopulatedWorkflowData
4846
+ category: initApis.MetadataCategory.Consultation,
4847
+ documentType: initApis.DocumentType.PopulatedWorkflowData
6966
4848
  }, grant.lockboxOwnerUuid);
6967
4849
 
6968
4850
  case 7:
@@ -7052,8 +4934,8 @@ var OroClient = /*#__PURE__*/function () {
7052
4934
  case 4:
7053
4935
  _context45.t1 = _context45.sent.map(function (grant) {
7054
4936
  return _this7.getLockboxManifest(grant.lockboxUuid, {
7055
- category: exports.MetadataCategory.Consultation,
7056
- documentType: exports.DocumentType.PopulatedWorkflowData,
4937
+ category: initApis.MetadataCategory.Consultation,
4938
+ documentType: initApis.DocumentType.PopulatedWorkflowData,
7057
4939
  consultationId: consultationId
7058
4940
  }, true, grant.lockboxOwnerUuid, forceRefresh).then(function (manifest) {
7059
4941
  return Promise.all(manifest.map(function (e) {
@@ -7095,8 +4977,8 @@ var OroClient = /*#__PURE__*/function () {
7095
4977
  switch (_context46.prev = _context46.next) {
7096
4978
  case 0:
7097
4979
  return _context46.abrupt("return", this.getPatientDocumentsList({
7098
- category: exports.MetadataCategory.Consultation,
7099
- documentType: exports.DocumentType.Prescription
4980
+ category: initApis.MetadataCategory.Consultation,
4981
+ documentType: initApis.DocumentType.Prescription
7100
4982
  }, true, consultationId));
7101
4983
 
7102
4984
  case 1:
@@ -7129,8 +5011,8 @@ var OroClient = /*#__PURE__*/function () {
7129
5011
  switch (_context47.prev = _context47.next) {
7130
5012
  case 0:
7131
5013
  return _context47.abrupt("return", this.getPatientDocumentsList({
7132
- category: exports.MetadataCategory.Consultation,
7133
- documentType: exports.DocumentType.Result
5014
+ category: initApis.MetadataCategory.Consultation,
5015
+ documentType: initApis.DocumentType.Result
7134
5016
  }, true, consultationId));
7135
5017
 
7136
5018
  case 1:
@@ -7163,8 +5045,8 @@ var OroClient = /*#__PURE__*/function () {
7163
5045
  switch (_context48.prev = _context48.next) {
7164
5046
  case 0:
7165
5047
  return _context48.abrupt("return", this.getPatientDocumentsList({
7166
- category: exports.MetadataCategory.Consultation,
7167
- documentType: exports.DocumentType.TreatmentPlan
5048
+ category: initApis.MetadataCategory.Consultation,
5049
+ documentType: initApis.DocumentType.TreatmentPlan
7168
5050
  }, true, consultationId));
7169
5051
 
7170
5052
  case 1:
@@ -7198,8 +5080,8 @@ var OroClient = /*#__PURE__*/function () {
7198
5080
  switch (_context49.prev = _context49.next) {
7199
5081
  case 0:
7200
5082
  return _context49.abrupt("return", this.getPatientDocumentsList({
7201
- category: exports.MetadataCategory.Consultation,
7202
- documentType: exports.DocumentType.TreatmentPlan,
5083
+ category: initApis.MetadataCategory.Consultation,
5084
+ documentType: initApis.DocumentType.TreatmentPlan,
7203
5085
  treatmentPlanId: treatmentPlanId
7204
5086
  }, true, consultationId));
7205
5087
 
@@ -7599,7 +5481,7 @@ var OroClient = /*#__PURE__*/function () {
7599
5481
  return this.getOrInsertJsonData(lockboxUuid, {
7600
5482
  masterKey: masterKey
7601
5483
  }, {
7602
- category: exports.MetadataCategory.Recovery,
5484
+ category: initApis.MetadataCategory.Recovery,
7603
5485
  contentType: 'application/json'
7604
5486
  }, {}, true);
7605
5487
 
@@ -7624,46 +5506,110 @@ var OroClient = /*#__PURE__*/function () {
7624
5506
  return OroClient;
7625
5507
  }();
7626
5508
 
5509
+ var _excluded = ["locale"],
5510
+ _excluded2 = ["locale"];
5511
+ var CliniaService = /*#__PURE__*/function () {
5512
+ function CliniaService(url, apiKey, locale) {
5513
+ this.url = url;
5514
+ this.locale = locale;
5515
+ this.api = new initApis.AxiosService({
5516
+ headers: {
5517
+ 'X-Clinia-API-Key': apiKey
5518
+ }
5519
+ });
5520
+ }
5521
+
5522
+ var _proto = CliniaService.prototype;
5523
+
5524
+ _proto.placeSearch = function placeSearch(searchOptions) {
5525
+ var locale = searchOptions.locale,
5526
+ data = _objectWithoutPropertiesLoose(searchOptions, _excluded);
5527
+
5528
+ return this.api.post(this.url + "/search/v1/indexes/health_facility/query", data, {
5529
+ params: {
5530
+ locale: locale != null ? locale : this.locale
5531
+ }
5532
+ });
5533
+ };
5534
+
5535
+ _proto.placeMatch = function placeMatch(searchOptions, type) {
5536
+ var locale = searchOptions.locale,
5537
+ data = _objectWithoutPropertiesLoose(searchOptions, _excluded2);
5538
+
5539
+ var request = this.api.post(this.url + "/search/v1/matches", data, {
5540
+ params: {
5541
+ locale: locale != null ? locale : this.locale
5542
+ }
5543
+ });
5544
+
5545
+ if (type) {
5546
+ request = request.then(function (places) {
5547
+ return places.filter(function (place) {
5548
+ return place.type === type;
5549
+ });
5550
+ });
5551
+ }
5552
+
5553
+ return request;
5554
+ };
5555
+
5556
+ return CliniaService;
5557
+ }();
5558
+
7627
5559
  var wasmPath = 'node_modules/oro-toolbox';
5560
+ /**
5561
+ * This function helps you to initialize and OroClient instance
5562
+ * @param toolbox the OroToolbox object
5563
+ * @param tellerBaseURL the teller service base URL
5564
+ * @param vaultBaseURL the vault service base URL
5565
+ * @param guardBaseURL the guard service base URL
5566
+ * @param practiceBaseURL the practice service base URL
5567
+ * @param consultBaseURL the consult service base URL
5568
+ * @param workflowBaseURL the workflow service base URL
5569
+ * @param diagnosisBaseURL the diagnosis service base URL
5570
+ * @param authenticationCallback (optional) authenticationCallback the authentification callback
5571
+ * @returns an instance of OroClient
5572
+ */
5573
+
5574
+ var init = function init(toolbox, tellerBaseURL, vaultBaseURL, guardBaseURL, practiceBaseURL, consultBaseURL, workflowBaseURL, diagnosisBaseURL, authenticationCallback) {
5575
+ var _initApis = initApis__default({
5576
+ tellerBaseURL: tellerBaseURL,
5577
+ vaultBaseURL: vaultBaseURL,
5578
+ guardBaseURL: guardBaseURL,
5579
+ practiceBaseURL: practiceBaseURL,
5580
+ consultBaseURL: consultBaseURL,
5581
+ workflowBaseURL: workflowBaseURL,
5582
+ diagnosisBaseURL: diagnosisBaseURL
5583
+ }, authenticationCallback),
5584
+ tellerService = _initApis.tellerService,
5585
+ practiceService = _initApis.practiceService,
5586
+ consultService = _initApis.consultService,
5587
+ vaultService = _initApis.vaultService,
5588
+ guardService = _initApis.guardService,
5589
+ workflowService = _initApis.workflowService,
5590
+ diagnosisService = _initApis.diagnosisService;
7628
5591
 
7629
- var init = function init(toolbox, tellerBaseURL, vaultBaseURL, guardBaseURL, practiceBaseURL, consultBaseURL, workflowBaseURL, diagnosisBaseUrl, authenticationCallback) {
7630
- var apiService = new APIService(undefined, authenticationCallback);
7631
- var tellerService = new TellerService(apiService, tellerBaseURL);
7632
- var practiceService = new PracticeService(toolbox, apiService, practiceBaseURL);
7633
- var consultService = new ConsultService(apiService, consultBaseURL);
7634
- var vaultService = new VaultService(apiService, vaultBaseURL);
7635
- var guardService = new GuardService(apiService, guardBaseURL);
7636
- var workflowService = new WorkflowService(apiService, workflowBaseURL);
7637
- var diagnosisService = new DiagnosisService(apiService, diagnosisBaseUrl);
7638
5592
  var client = new OroClient(toolbox, tellerService, vaultService, guardService, practiceService, consultService, workflowService, diagnosisService, authenticationCallback);
7639
5593
  return client;
7640
5594
  };
7641
5595
 
5596
+ Object.keys(initApis).forEach(function (k) {
5597
+ if (k !== 'default') Object.defineProperty(exports, k, {
5598
+ enumerable: true,
5599
+ get: function () {
5600
+ return initApis[k];
5601
+ }
5602
+ });
5603
+ });
7642
5604
  exports.OroToolboxNamespace = oroToolbox;
7643
- exports.APIService = APIService;
7644
5605
  exports.AssociatedLockboxNotFound = AssociatedLockboxNotFound;
7645
- exports.AuthenticationBadRequest = AuthenticationBadRequest;
7646
- exports.AuthenticationFailed = AuthenticationFailed;
7647
- exports.AuthenticationServerError = AuthenticationServerError;
7648
- exports.AxiosService = AxiosService;
7649
5606
  exports.CliniaService = CliniaService;
7650
- exports.ConsultService = ConsultService;
7651
- exports.DiagnosisService = DiagnosisService;
7652
- exports.GuardService = GuardService;
7653
- exports.IdentityCreationBadRequest = IdentityCreationBadRequest;
7654
- exports.IdentityCreationConflict = IdentityCreationConflict;
7655
- exports.IdentityCreationFailed = IdentityCreationFailed;
7656
5607
  exports.IncompleteAuthentication = IncompleteAuthentication;
7657
- exports.IndexBuildError = IndexBuildError;
7658
5608
  exports.MissingGrant = MissingGrant;
7659
5609
  exports.MissingLockbox = MissingLockbox;
7660
5610
  exports.MissingLockboxOwner = MissingLockboxOwner;
7661
5611
  exports.OroClient = OroClient;
7662
- exports.PracticeService = PracticeService;
7663
- exports.TellerService = TellerService;
7664
- exports.VaultService = VaultService;
7665
5612
  exports.WorkflowAnswersMissingError = WorkflowAnswersMissingError;
7666
- exports.WorkflowService = WorkflowService;
7667
5613
  exports.decryptConsultLockboxGrants = decryptConsultLockboxGrants;
7668
5614
  exports.decryptGrants = decryptGrants;
7669
5615
  exports.default = init;