oro-sdk 2.1.4 → 2.3.0

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 (64) 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 -2357
  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 -2334
  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/LICENSE +0 -21
  33. package/dist/models/consult.d.ts +0 -102
  34. package/dist/models/diagnosis.d.ts +0 -122
  35. package/dist/models/guard.d.ts +0 -119
  36. package/dist/models/practice.d.ts +0 -353
  37. package/dist/models/shared.d.ts +0 -8
  38. package/dist/models/vault.d.ts +0 -124
  39. package/dist/models/workflow.d.ts +0 -106
  40. package/dist/services/api.d.ts +0 -11
  41. package/dist/services/axios.d.ts +0 -14
  42. package/dist/services/consult.d.ts +0 -54
  43. package/dist/services/diagnosis.d.ts +0 -38
  44. package/dist/services/guard.d.ts +0 -92
  45. package/dist/services/practice.d.ts +0 -100
  46. package/dist/services/teller.d.ts +0 -9
  47. package/dist/services/vault.d.ts +0 -54
  48. package/dist/services/workflow.d.ts +0 -21
  49. package/src/models/consult.ts +0 -110
  50. package/src/models/diagnosis.ts +0 -141
  51. package/src/models/guard.ts +0 -136
  52. package/src/models/practice.ts +0 -411
  53. package/src/models/shared.ts +0 -6
  54. package/src/models/vault.ts +0 -158
  55. package/src/models/workflow.ts +0 -142
  56. package/src/services/api.ts +0 -77
  57. package/src/services/axios.ts +0 -91
  58. package/src/services/consult.ts +0 -265
  59. package/src/services/diagnosis.ts +0 -132
  60. package/src/services/guard.ts +0 -228
  61. package/src/services/practice.ts +0 -537
  62. package/src/services/teller.ts +0 -39
  63. package/src/services/vault.ts +0 -178
  64. 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,2286 +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
- * This function returns populated treatment plans associated to a consult
1830
- * @param uuidConsult the consult uuid to fetch
1831
- * @returns a TreatmentPlans object
1832
- */
1833
- ;
1834
-
1835
- _proto.getTreatmentPlansPopulatedFromConsultUuid = function getTreatmentPlansPopulatedFromConsultUuid(uuidConsult) {
1836
- return this.api.get(this.baseURL + "/v1/treatment-plans/", {
1837
- params: {
1838
- uuidConsult: uuidConsult,
1839
- populated: true
1840
- }
1841
- });
1842
- };
1843
-
1844
- _proto.postPlans = function postPlans(plans) {
1845
- return this.api.post(this.baseURL + "/v1/treatment-plans", plans);
1846
- };
1847
-
1848
- _proto.updateTreatmentPlan = function updateTreatmentPlan(uuidPlan, uuidConsult, diagnosisRequest, plan) {
1849
- return this.api.put(this.baseURL + "/v1/treatment-plans/" + uuidPlan, {
1850
- uuidConsult: uuidConsult,
1851
- diagnosis: diagnosisRequest,
1852
- plan: plan
1853
- });
1854
- };
1855
-
1856
- _proto.acceptTreatmentPlan = function acceptTreatmentPlan(uuidPlan, uuidConsult) {
1857
- return this.api.put(this.baseURL + "/v1/treatment-plans/" + uuidPlan + "/accept", {
1858
- uuidConsult: uuidConsult
1859
- });
1860
- }
1861
- /**
1862
- * retrieves all the drugs of the specified practice
1863
- * @param uuidPractice
1864
- */
1865
- ;
1866
-
1867
- _proto.getAllDrugs =
1868
- /*#__PURE__*/
1869
- function () {
1870
- var _getAllDrugs = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(uuidPractice) {
1871
- var res;
1872
- return runtime_1.wrap(function _callee$(_context) {
1873
- while (1) {
1874
- switch (_context.prev = _context.next) {
1875
- case 0:
1876
- _context.next = 2;
1877
- return this.api.get(this.baseURL + "/v1/drugs/practice/" + uuidPractice);
1878
-
1879
- case 2:
1880
- res = _context.sent;
1881
-
1882
- if (!(res && res.foundDrugs)) {
1883
- _context.next = 5;
1884
- break;
1885
- }
1886
-
1887
- return _context.abrupt("return", res.foundDrugs);
1888
-
1889
- case 5:
1890
- return _context.abrupt("return", undefined);
1891
-
1892
- case 6:
1893
- case "end":
1894
- return _context.stop();
1895
- }
1896
- }
1897
- }, _callee, this);
1898
- }));
1899
-
1900
- function getAllDrugs(_x) {
1901
- return _getAllDrugs.apply(this, arguments);
1902
- }
1903
-
1904
- return getAllDrugs;
1905
- }();
1906
-
1907
- return DiagnosisService;
1908
- }();
1909
-
1910
- var GuardService = /*#__PURE__*/function () {
1911
- function GuardService(api, baseURL) {
1912
- this.api = api;
1913
- this.baseURL = baseURL;
1914
- this.api.setAuthRefreshFn(this.authRefresh.bind(this));
1915
- this.identityCache = {};
1916
- this.whoAmICache = {};
1917
- }
1918
- /**
1919
- * Will replace access and refresh tokens with `tokens`
1920
- *
1921
- * Note:
1922
- * ```typescript
1923
- * setTokens({accessToken: undefined, refreshToken: 'aTokenValue'}) // will erase accessToken and set refreshToken with 'aTokenValue'
1924
- * setTokens({refreshToken: 'aTokenValue'}) // will keep actual value of accessToken and set refreshToken with 'aTokenValue'
1925
- *
1926
- * ```
1927
- * @param tokens
1928
- */
1929
-
1930
-
1931
- var _proto = GuardService.prototype;
1932
-
1933
- _proto.setTokens = function setTokens(tokens) {
1934
- this.api.setTokens(_extends({}, this.api.getTokens(), tokens));
1935
- }
1936
- /**
1937
- * Allow to retrieve an access token and a refresh token in order
1938
- * to do authenticated request afterward
1939
- *
1940
- * @param req The credentials required to get an access token
1941
- * @returns AuthTokenResponse
1942
- */
1943
- ;
1944
-
1945
- _proto.authToken =
1946
- /*#__PURE__*/
1947
- function () {
1948
- var _authToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(req) {
1949
- var resp, config, _e$response, code;
1950
-
1951
- return runtime_1.wrap(function _callee$(_context) {
1952
- while (1) {
1953
- switch (_context.prev = _context.next) {
1954
- case 0:
1955
- _context.prev = 0;
1956
- config = {
1957
- skipAuthRefresh: true
1958
- };
1959
- _context.next = 4;
1960
- return this.api.post(this.baseURL + "/v1/auth/token", req, config);
1961
-
1962
- case 4:
1963
- resp = _context.sent;
1964
- this.api.setTokens({
1965
- accessToken: resp.accessToken,
1966
- refreshToken: resp.refreshToken
1967
- });
1968
- _context.next = 19;
1969
- break;
1970
-
1971
- case 8:
1972
- _context.prev = 8;
1973
- _context.t0 = _context["catch"](0);
1974
-
1975
- if (!_context.t0.isAxiosError) {
1976
- _context.next = 18;
1977
- break;
1978
- }
1979
-
1980
- code = (_e$response = _context.t0.response) == null ? void 0 : _e$response.status;
1981
- _context.t1 = code;
1982
- _context.next = _context.t1 === 400 ? 15 : _context.t1 === 500 ? 16 : _context.t1 === 401 ? 17 : 17;
1983
- break;
1984
-
1985
- case 15:
1986
- throw new AuthenticationBadRequest();
1987
-
1988
- case 16:
1989
- throw new AuthenticationServerError();
1990
-
1991
- case 17:
1992
- throw new AuthenticationFailed();
1993
-
1994
- case 18:
1995
- throw new AuthenticationFailed();
1996
-
1997
- case 19:
1998
- return _context.abrupt("return", resp);
1999
-
2000
- case 20:
2001
- case "end":
2002
- return _context.stop();
2003
- }
2004
- }
2005
- }, _callee, this, [[0, 8]]);
2006
- }));
2007
-
2008
- function authToken(_x) {
2009
- return _authToken.apply(this, arguments);
2010
- }
2011
-
2012
- return authToken;
2013
- }()
2014
- /**
2015
- * Get new access and refresh token
2016
- *
2017
- * @returns AuthTokenResponse
2018
- */
2019
- ;
2020
-
2021
- _proto.authRefresh =
2022
- /*#__PURE__*/
2023
- function () {
2024
- var _authRefresh = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(refreshToken) {
2025
- var config;
2026
- return runtime_1.wrap(function _callee2$(_context2) {
2027
- while (1) {
2028
- switch (_context2.prev = _context2.next) {
2029
- case 0:
2030
- config = {
2031
- skipAuthRefresh: true,
2032
- useRefreshToken: true
2033
- };
2034
- return _context2.abrupt("return", this.api.put(this.baseURL + "/v1/auth/token", null, config));
2035
-
2036
- case 2:
2037
- case "end":
2038
- return _context2.stop();
2039
- }
2040
- }
2041
- }, _callee2, this);
2042
- }));
2043
-
2044
- function authRefresh(_x2) {
2045
- return _authRefresh.apply(this, arguments);
2046
- }
2047
-
2048
- return authRefresh;
2049
- }()
2050
- /**
2051
- * Call guard to overwrite existing refresh token cookie
2052
- *
2053
- * @returns void
2054
- */
2055
- ;
2056
-
2057
- _proto.authLogout =
2058
- /*#__PURE__*/
2059
- function () {
2060
- var _authLogout = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
2061
- return runtime_1.wrap(function _callee3$(_context3) {
2062
- while (1) {
2063
- switch (_context3.prev = _context3.next) {
2064
- case 0:
2065
- return _context3.abrupt("return", this.api.get(this.baseURL + "/v1/auth/logout"));
2066
-
2067
- case 1:
2068
- case "end":
2069
- return _context3.stop();
2070
- }
2071
- }
2072
- }, _callee3, this);
2073
- }));
2074
-
2075
- function authLogout() {
2076
- return _authLogout.apply(this, arguments);
2077
- }
2078
-
2079
- return authLogout;
2080
- }()
2081
- /**
2082
- * Call guard to attempt account recovery
2083
- *
2084
- * @param req The email address / practice of the account to recover
2085
- * @returns void
2086
- */
2087
- ;
2088
-
2089
- _proto.authRecover =
2090
- /*#__PURE__*/
2091
- function () {
2092
- var _authRecover = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(req) {
2093
- return runtime_1.wrap(function _callee4$(_context4) {
2094
- while (1) {
2095
- switch (_context4.prev = _context4.next) {
2096
- case 0:
2097
- return _context4.abrupt("return", this.api.post(this.baseURL + "/v1/auth/recover", req));
2098
-
2099
- case 1:
2100
- case "end":
2101
- return _context4.stop();
2102
- }
2103
- }
2104
- }, _callee4, this);
2105
- }));
2106
-
2107
- function authRecover(_x3) {
2108
- return _authRecover.apply(this, arguments);
2109
- }
2110
-
2111
- return authRecover;
2112
- }()
2113
- /**
2114
- * Allow to create a new identity. The identity will then need to be confirmed
2115
- * via an email link
2116
- *
2117
- * @param req the information about the new identity to create
2118
- * @returns IdentityResponse
2119
- */
2120
- ;
2121
-
2122
- _proto.identityCreate =
2123
- /*#__PURE__*/
2124
- function () {
2125
- var _identityCreate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(req) {
2126
- var resp, _e$response2, code;
2127
-
2128
- return runtime_1.wrap(function _callee5$(_context5) {
2129
- while (1) {
2130
- switch (_context5.prev = _context5.next) {
2131
- case 0:
2132
- _context5.prev = 0;
2133
- _context5.next = 3;
2134
- return this.api.post(this.baseURL + "/v1/identities", req);
2135
-
2136
- case 3:
2137
- resp = _context5.sent;
2138
- this.api.setTokens({
2139
- refreshToken: resp.refreshToken
2140
- });
2141
- _context5.next = 18;
2142
- break;
2143
-
2144
- case 7:
2145
- _context5.prev = 7;
2146
- _context5.t0 = _context5["catch"](0);
2147
-
2148
- if (!_context5.t0.isAxiosError) {
2149
- _context5.next = 17;
2150
- break;
2151
- }
2152
-
2153
- code = (_e$response2 = _context5.t0.response) == null ? void 0 : _e$response2.status;
2154
- _context5.t1 = code;
2155
- _context5.next = _context5.t1 === 400 ? 14 : _context5.t1 === 409 ? 15 : _context5.t1 === 500 ? 16 : 16;
2156
- break;
2157
-
2158
- case 14:
2159
- throw new IdentityCreationBadRequest();
2160
-
2161
- case 15:
2162
- throw new IdentityCreationConflict();
2163
-
2164
- case 16:
2165
- throw new IdentityCreationFailed();
2166
-
2167
- case 17:
2168
- throw new IdentityCreationFailed();
2169
-
2170
- case 18:
2171
- return _context5.abrupt("return", resp);
2172
-
2173
- case 19:
2174
- case "end":
2175
- return _context5.stop();
2176
- }
2177
- }
2178
- }, _callee5, this, [[0, 7]]);
2179
- }));
2180
-
2181
- function identityCreate(_x4) {
2182
- return _identityCreate.apply(this, arguments);
2183
- }
2184
-
2185
- return identityCreate;
2186
- }()
2187
- /**
2188
- * Retrieve an identity. Will return public fields only when requested
2189
- * without authentication
2190
- *
2191
- * @param identityID Unique id of the identity to retrieve
2192
- * @returns IdentityResponse
2193
- */
2194
- ;
2195
-
2196
- _proto.identityGet =
2197
- /*#__PURE__*/
2198
- function () {
2199
- var _identityGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(identityID) {
2200
- var _tokens$accessToken, _tokens$refreshToken;
2201
-
2202
- var tokens, cacheKey;
2203
- return runtime_1.wrap(function _callee6$(_context6) {
2204
- while (1) {
2205
- switch (_context6.prev = _context6.next) {
2206
- case 0:
2207
- tokens = this.api.getTokens();
2208
- cacheKey = ((_tokens$accessToken = tokens.accessToken) != null ? _tokens$accessToken : '') + ((_tokens$refreshToken = tokens.refreshToken) != null ? _tokens$refreshToken : '') + identityID;
2209
-
2210
- if (!(!tokens.accessToken || !this.identityCache[cacheKey])) {
2211
- _context6.next = 6;
2212
- break;
2213
- }
2214
-
2215
- _context6.next = 5;
2216
- return this.api.get(this.baseURL + "/v1/identities/" + identityID);
2217
-
2218
- case 5:
2219
- this.identityCache[cacheKey] = _context6.sent;
2220
-
2221
- case 6:
2222
- return _context6.abrupt("return", this.identityCache[cacheKey]);
2223
-
2224
- case 7:
2225
- case "end":
2226
- return _context6.stop();
2227
- }
2228
- }
2229
- }, _callee6, this);
2230
- }));
2231
-
2232
- function identityGet(_x5) {
2233
- return _identityGet.apply(this, arguments);
2234
- }
2235
-
2236
- return identityGet;
2237
- }()
2238
- /**
2239
- * Get information about the current authenticated user
2240
- *
2241
- * @param refreshCache if true it will refresh the whoAmI cache (default: false)
2242
- * @returns WhoAmIResponse
2243
- */
2244
- ;
2245
-
2246
- _proto.whoAmI =
2247
- /*#__PURE__*/
2248
- function () {
2249
- var _whoAmI = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(refreshCache) {
2250
- var _this$api$getTokens$a;
2251
-
2252
- var cacheKey;
2253
- return runtime_1.wrap(function _callee7$(_context7) {
2254
- while (1) {
2255
- switch (_context7.prev = _context7.next) {
2256
- case 0:
2257
- if (refreshCache === void 0) {
2258
- refreshCache = false;
2259
- }
2260
-
2261
- cacheKey = (_this$api$getTokens$a = this.api.getTokens().accessToken) != null ? _this$api$getTokens$a : '';
2262
-
2263
- if (!(!this.whoAmICache[cacheKey] || refreshCache)) {
2264
- _context7.next = 6;
2265
- break;
2266
- }
2267
-
2268
- _context7.next = 5;
2269
- return this.api.get(this.baseURL + "/v1/auth/whoami");
2270
-
2271
- case 5:
2272
- this.whoAmICache[cacheKey] = _context7.sent;
2273
-
2274
- case 6:
2275
- return _context7.abrupt("return", this.whoAmICache[cacheKey]);
2276
-
2277
- case 7:
2278
- case "end":
2279
- return _context7.stop();
2280
- }
2281
- }
2282
- }, _callee7, this);
2283
- }));
2284
-
2285
- function whoAmI(_x6) {
2286
- return _whoAmI.apply(this, arguments);
2287
- }
2288
-
2289
- return whoAmI;
2290
- }()
2291
- /**
2292
- * Update an existing identity
2293
- *
2294
- * @param identityID unique id of identity to update
2295
- * @param req update request
2296
- * @returns IdentityResponse
2297
- */
2298
- ;
2299
-
2300
- _proto.identityUpdate =
2301
- /*#__PURE__*/
2302
- function () {
2303
- var _identityUpdate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(identityID, req) {
2304
- return runtime_1.wrap(function _callee8$(_context8) {
2305
- while (1) {
2306
- switch (_context8.prev = _context8.next) {
2307
- case 0:
2308
- return _context8.abrupt("return", this.api.put(this.baseURL + "/v1/identities/" + identityID, req));
2309
-
2310
- case 1:
2311
- case "end":
2312
- return _context8.stop();
2313
- }
2314
- }
2315
- }, _callee8, this);
2316
- }));
2317
-
2318
- function identityUpdate(_x7, _x8) {
2319
- return _identityUpdate.apply(this, arguments);
2320
- }
2321
-
2322
- return identityUpdate;
2323
- }()
2324
- /**
2325
- * Return base64 data representing a QR code that the
2326
- * current identity need in order to use MFA
2327
- *
2328
- * @param identityID unique id of the identity
2329
- * @param password the identity password (already hashed and in base64)
2330
- * @returns QRCodeResponse
2331
- */
2332
- ;
2333
-
2334
- _proto.identityMFAQRCode =
2335
- /*#__PURE__*/
2336
- function () {
2337
- var _identityMFAQRCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(identityID, password) {
2338
- var req;
2339
- return runtime_1.wrap(function _callee9$(_context9) {
2340
- while (1) {
2341
- switch (_context9.prev = _context9.next) {
2342
- case 0:
2343
- req = {
2344
- password: password
2345
- };
2346
- return _context9.abrupt("return", this.api.post(this.baseURL + "/v1/identities/" + identityID + "/mfa", req, {
2347
- headers: {
2348
- 'Accept': 'application/json'
2349
- }
2350
- }));
2351
-
2352
- case 2:
2353
- case "end":
2354
- return _context9.stop();
2355
- }
2356
- }
2357
- }, _callee9, this);
2358
- }));
2359
-
2360
- function identityMFAQRCode(_x9, _x10) {
2361
- return _identityMFAQRCode.apply(this, arguments);
2362
- }
2363
-
2364
- return identityMFAQRCode;
2365
- }();
2366
-
2367
- return GuardService;
2368
- }();
2369
-
2370
- var PracticeService = /*#__PURE__*/function () {
2371
- function PracticeService(toolbox, api, baseURL) {
2372
- this.toolbox = toolbox;
2373
- this.api = api;
2374
- this.baseURL = baseURL;
2375
- }
2376
- /**
2377
- * This function get the practice from the URL of a practice
2378
- * It is the entry point of our web apps
2379
- * @param practiceURL URL of the practice to search
2380
- * @param hydratePracticeConfigs (optional) if set true it the Practice field configs will be set
2381
- * @param accounts (optional) if set true it the Practice field accounts will be set
2382
- * @returns the found practice or undefined
2383
- */
2384
-
2385
-
2386
- var _proto = PracticeService.prototype;
2387
-
2388
- _proto.practiceGetFromURL = function practiceGetFromURL(practiceURL, params) {
2389
- return this.api.get(this.baseURL + "/v1/practices", {
2390
- params: _extends({
2391
- url_practice: practiceURL
2392
- }, params)
2393
- });
2394
- };
2395
-
2396
- _proto.practiceGetFromUuid = function practiceGetFromUuid(practiceUuid, locale, withAccounts) {
2397
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid, {
2398
- params: {
2399
- locale: locale,
2400
- accounts: withAccounts
2401
- }
2402
- });
2403
- } /// Practice Configs
2404
-
2405
- /**
2406
- * This function retrieves all configs of a specific practice
2407
- * @param practiceUuid uuid of the practice
2408
- * @returns the practice configs
2409
- */
2410
- ;
2411
-
2412
- _proto.practiceConfigGetFromPracticeUuid = function practiceConfigGetFromPracticeUuid(practiceUuid) {
2413
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/configs");
2414
- }
2415
- /**
2416
- * This function retrieves a specific config of a practice
2417
- * @param practiceUuid uuid of the practice
2418
- * @param kind of the config
2419
- * @returns the practice config
2420
- */
2421
- ;
2422
-
2423
- _proto.practiceConfigGetByKindForPracticeUuid = function practiceConfigGetByKindForPracticeUuid(practiceUuid, kind) {
2424
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/configs/" + kind);
2425
- }
2426
- /**
2427
- * This function creates a config for a specific practice
2428
- * @param practiceUuid uuid of the practice
2429
- * @param config the config to add to the practice
2430
- * @returns the created practice config
2431
- */
2432
- ;
2433
-
2434
- _proto.practiceConfigCreateForPracticeUuid = function practiceConfigCreateForPracticeUuid(practiceUuid, config) {
2435
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/configs", config);
2436
- }
2437
- /**
2438
- * This function updates a specific config of a practice
2439
- * @param practiceUuid uuid of the practice
2440
- * @param config the config to update
2441
- * @returns the practice config
2442
- */
2443
- ;
2444
-
2445
- _proto.practiceConfigUpdate = function practiceConfigUpdate(config) {
2446
- return this.api.put(this.baseURL + "/v1/practices/" + config.uuidPractice + "/configs/" + config.kind, config);
2447
- } /// Accounts
2448
- ;
2449
-
2450
- _proto.practiceGetAccounts = function practiceGetAccounts(practiceUuid) {
2451
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/accounts");
2452
- };
2453
-
2454
- _proto.practiceGetAccount = function practiceGetAccount(practiceUuid, accountUuid) {
2455
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/accounts/" + accountUuid);
2456
- } /// Workflows
2457
- ;
2458
-
2459
- _proto.practiceGetWorkflows = function practiceGetWorkflows(practiceUuid) {
2460
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/workflows");
2461
- };
2462
-
2463
- _proto.practiceGetWorkflow = function practiceGetWorkflow(practiceUuid, workflowType) {
2464
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/workflows/" + workflowType);
2465
- } /// Plans
2466
- ;
2467
-
2468
- _proto.practiceGetPlans = function practiceGetPlans(practiceUuid, planType) {
2469
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans", {
2470
- params: {
2471
- kind: planType
2472
- }
2473
- });
2474
- };
2475
-
2476
- _proto.practiceGetPlan = function practiceGetPlan(practiceUuid, planId) {
2477
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans/" + planId);
2478
- };
2479
-
2480
- _proto.practiceGetPlanPrices = function practiceGetPlanPrices(practiceUuid, planId) {
2481
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans/" + planId + "/prices");
2482
- } // Payments
2483
- ;
2484
-
2485
- _proto.practiceGetPayments = function practiceGetPayments(practiceUuid, planType) {
2486
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments", {
2487
- params: {
2488
- kind: planType
2489
- }
2490
- });
2491
- };
2492
-
2493
- _proto.practiceGetPayment = function practiceGetPayment(practiceUuid, idStripeInvoiceOrPaymentIntent) {
2494
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/" + idStripeInvoiceOrPaymentIntent);
2495
- };
2496
-
2497
- _proto.practiceGetPaymentForStripePaymentIntentWithID = function practiceGetPaymentForStripePaymentIntentWithID(practiceUuid, stripePaymentIntentId) {
2498
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/" + stripePaymentIntentId);
2499
- } // Payments Intent
2500
- ;
2501
-
2502
- _proto.practiceGetPaymentsIntents = function practiceGetPaymentsIntents(practiceUuid, planType) {
2503
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents", {
2504
- params: {
2505
- kind: planType
2506
- }
2507
- });
2508
- }
2509
- /**
2510
- * This function return the user hased email to be use for creating payment intent
2511
- * @param email the email to hash
2512
- * @returns a hashed email
2513
- */
2514
- ;
2515
-
2516
- _proto.getPaymentIntentHashedEmail = function getPaymentIntentHashedEmail(email) {
2517
- return this.toolbox.hashStringToBase64(email.toLowerCase());
2518
- };
2519
-
2520
- _proto.practiceCreatePaymentsIntent = function practiceCreatePaymentsIntent(practiceUuid, planId, userEmail, isoLocality, url_subdomain, promotionCode) {
2521
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/", {
2522
- idPlan: planId,
2523
- hashUserEmail: userEmail ? this.getPaymentIntentHashedEmail(userEmail) : undefined,
2524
- isoLocality: isoLocality
2525
- }, {
2526
- params: {
2527
- url_subdomain: url_subdomain,
2528
- promotionCode: promotionCode
2529
- }
2530
- });
2531
- };
2532
-
2533
- _proto.practiceGetPaymentsIntent = function practiceGetPaymentsIntent(practiceUuid, paymentIntentId) {
2534
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/" + paymentIntentId);
2535
- };
2536
-
2537
- _proto.practiceUpdatePaymentsIntent = function practiceUpdatePaymentsIntent(practiceUuid, idPraticePaymentIntent, practicePaymentIntent, userEmail, promotionCode) {
2538
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/" + idPraticePaymentIntent, _extends({}, practicePaymentIntent, {
2539
- hashUserEmail: userEmail ? this.getPaymentIntentHashedEmail(userEmail) : undefined
2540
- }), {
2541
- params: {
2542
- promotionCode: promotionCode
2543
- }
2544
- });
2545
- } // Practitioner
2546
- ;
2547
-
2548
- _proto.practiceGetPractitioners = function practiceGetPractitioners(practiceUuid) {
2549
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners");
2550
- };
2551
-
2552
- _proto.practiceUpdatePractitioner = function practiceUpdatePractitioner(practiceUuid, practitionerUuid, requestBody) {
2553
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid, requestBody);
2554
- };
2555
-
2556
- _proto.practiceGetPractitioner = function practiceGetPractitioner(practiceUuid, practitionerUuid) {
2557
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid);
2558
- } // Practitioner Licenses
2559
- ;
2560
-
2561
- _proto.practiceGetPractitionerLicenses = function practiceGetPractitionerLicenses(practiceUuid, practitionerUuid) {
2562
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses");
2563
- };
2564
-
2565
- _proto.practiceCreatePractitionerLicense = function practiceCreatePractitionerLicense(practiceUuid, practitionerUuid, requestBody) {
2566
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses", requestBody);
2567
- };
2568
-
2569
- _proto.practiceUpdatePractitionerLicense = function practiceUpdatePractitionerLicense(practiceUuid, practitionerUuid, licenseId, requestBody) {
2570
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses/" + licenseId, requestBody);
2571
- };
2572
-
2573
- _proto.practiceGetPractitionerLicense = function practiceGetPractitionerLicense(practiceUuid, practitionerUuid, licenseId) {
2574
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses/" + licenseId);
2575
- } // Practitioner Preferences
2576
- ;
2577
-
2578
- _proto.practiceGetPractitionerPreferences = function practiceGetPractitionerPreferences(practiceUuid, practitionerUuid) {
2579
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences");
2580
- };
2581
-
2582
- _proto.practiceCreatePractitionerPreference = function practiceCreatePractitionerPreference(practiceUuid, practitionerUuid, requestBody) {
2583
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences", requestBody);
2584
- };
2585
-
2586
- _proto.practiceUpdatePractitionerPreference = function practiceUpdatePractitionerPreference(practiceUuid, practitionerUuid, preferenceId, requestBody) {
2587
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences/" + preferenceId, requestBody);
2588
- };
2589
-
2590
- _proto.practiceGetPractitionerPreference = function practiceGetPractitionerPreference(practiceUuid, practitionerUuid, preferenceId) {
2591
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences/" + preferenceId);
2592
- } // Practitioner Roles
2593
- ;
2594
-
2595
- _proto.practiceGetPractitionerRoles = function practiceGetPractitionerRoles(practiceUuid, practitionerUuid) {
2596
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles");
2597
- };
2598
-
2599
- _proto.practiceCreatePractitionerRole = function practiceCreatePractitionerRole(practiceUuid, practitionerUuid, requestBody) {
2600
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles", requestBody);
2601
- };
2602
-
2603
- _proto.practiceDeletePractitionerRoles = function practiceDeletePractitionerRoles(practiceUuid, practitionerUuid) {
2604
- return this.api.deleteRequest(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles");
2605
- };
2606
-
2607
- _proto.practiceUpdatePractitionerRole = function practiceUpdatePractitionerRole(practiceUuid, practitionerUuid, roleId, requestBody) {
2608
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId, requestBody);
2609
- };
2610
-
2611
- _proto.practiceGetPractitionerRole = function practiceGetPractitionerRole(practiceUuid, practitionerUuid, roleId) {
2612
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId);
2613
- };
2614
-
2615
- _proto.practiceDeletePractitionerRole = function practiceDeletePractitionerRole(practiceUuid, practitionerUuid, roleId) {
2616
- return this.api.deleteRequest(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId);
2617
- } // Practitioner signature
2618
-
2619
- /**
2620
- * This function returns the practitioner's signature as a Blob
2621
- * @param practiceUuid the practice uuid of the practitioner
2622
- * @param practitionerUuid the practitioner uuid
2623
- * @returns a blob representing the signature
2624
- */
2625
- ;
2626
-
2627
- _proto.practiceGetPractitionerSignature = function practiceGetPractitionerSignature(practiceUuid, practitionerUuid) {
2628
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/signature", {
2629
- responseType: 'blob'
2630
- });
2631
- } // Assignments
2632
- ;
2633
-
2634
- _proto.practiceGetAssignments = function practiceGetAssignments(practiceUuid) {
2635
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments");
2636
- };
2637
-
2638
- _proto.practiceCreateAssignment = function practiceCreateAssignment(practiceUuid, requestBody) {
2639
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments", requestBody);
2640
- };
2641
-
2642
- _proto.practiceUpdateAssignment = function practiceUpdateAssignment(practiceUuid, assignmentId, requestBody) {
2643
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments/" + assignmentId, requestBody);
2644
- };
2645
-
2646
- _proto.practiceGetAssignment = function practiceGetAssignment(practiceUuid, assignmentId) {
2647
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments/" + assignmentId);
2648
- } // Quotas
2649
- ;
2650
-
2651
- _proto.practiceGetQuotas = function practiceGetQuotas(practiceUuid) {
2652
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/quotas");
2653
- };
2654
-
2655
- _proto.practiceGetQuota = function practiceGetQuota(practiceUuid, quotaId) {
2656
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/quotas/" + quotaId);
2657
- };
2658
-
2659
- return PracticeService;
2660
- }();
2661
-
2662
- var TellerService = /*#__PURE__*/function () {
2663
- function TellerService(api, baseURL) {
2664
- this.api = api;
2665
- this.baseURL = baseURL;
2666
- }
2667
-
2668
- var _proto = TellerService.prototype;
2669
-
2670
- _proto.lockboxDataStore = /*#__PURE__*/function () {
2671
- var _lockboxDataStore = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(lockboxUuid, req, lockboxOwnerUuid, previousDataUuid) {
2672
- return runtime_1.wrap(function _callee$(_context) {
2673
- while (1) {
2674
- switch (_context.prev = _context.next) {
2675
- case 0:
2676
- return _context.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data", req, {
2677
- params: {
2678
- lockbox_owner_uuid: lockboxOwnerUuid,
2679
- data_uuid: previousDataUuid
2680
- }
2681
- }));
2682
-
2683
- case 1:
2684
- case "end":
2685
- return _context.stop();
2686
- }
2687
- }
2688
- }, _callee, this);
2689
- }));
2690
-
2691
- function lockboxDataStore(_x, _x2, _x3, _x4) {
2692
- return _lockboxDataStore.apply(this, arguments);
2693
- }
2694
-
2695
- return lockboxDataStore;
2696
- }();
2697
-
2698
- _proto.updateConsultByUUID = function updateConsultByUUID(patientUuid, uuidConsult, statusMedical, neverExpires) {
2699
- return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult, {
2700
- patientUuid: patientUuid,
2701
- statusMedical: statusMedical,
2702
- neverExpires: neverExpires
2703
- });
2704
- };
2705
-
2706
- return TellerService;
2707
- }();
2708
-
2709
- var VaultService = /*#__PURE__*/function () {
2710
- function VaultService(api, baseURL) {
2711
- this.api = api;
2712
- this.baseURL = baseURL;
2713
- }
2714
-
2715
- var _proto = VaultService.prototype;
2716
-
2717
- _proto.lockboxCreate = /*#__PURE__*/function () {
2718
- var _lockboxCreate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(lockboxMetadata) {
2719
- return runtime_1.wrap(function _callee$(_context) {
2720
- while (1) {
2721
- switch (_context.prev = _context.next) {
2722
- case 0:
2723
- return _context.abrupt("return", this.api.post(this.baseURL + "/v1/lockbox", lockboxMetadata));
2724
-
2725
- case 1:
2726
- case "end":
2727
- return _context.stop();
2728
- }
2729
- }
2730
- }, _callee, this);
2731
- }));
2732
-
2733
- function lockboxCreate(_x) {
2734
- return _lockboxCreate.apply(this, arguments);
2735
- }
2736
-
2737
- return lockboxCreate;
2738
- }();
2739
-
2740
- _proto.lockboxMetadataAdd = /*#__PURE__*/function () {
2741
- var _lockboxMetadataAdd = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(lockboxUuid, lockboxMetadata, lockboxOwnerUuid) {
2742
- return runtime_1.wrap(function _callee2$(_context2) {
2743
- while (1) {
2744
- switch (_context2.prev = _context2.next) {
2745
- case 0:
2746
- return _context2.abrupt("return", this.api.put(this.baseURL + "/v1/lockbox/" + lockboxUuid, lockboxMetadata, {
2747
- params: {
2748
- lockbox_owner_uuid: lockboxOwnerUuid
2749
- }
2750
- }));
2751
-
2752
- case 1:
2753
- case "end":
2754
- return _context2.stop();
2755
- }
2756
- }
2757
- }, _callee2, this);
2758
- }));
2759
-
2760
- function lockboxMetadataAdd(_x2, _x3, _x4) {
2761
- return _lockboxMetadataAdd.apply(this, arguments);
2762
- }
2763
-
2764
- return lockboxMetadataAdd;
2765
- }();
2766
-
2767
- _proto.lockboxSecretGet = /*#__PURE__*/function () {
2768
- var _lockboxSecretGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(lockboxUuid, lockboxOwnerUuid) {
2769
- return runtime_1.wrap(function _callee3$(_context3) {
2770
- while (1) {
2771
- switch (_context3.prev = _context3.next) {
2772
- case 0:
2773
- return _context3.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/secret", {
2774
- params: {
2775
- lockbox_owner_uuid: lockboxOwnerUuid
2776
- }
2777
- }));
2778
-
2779
- case 1:
2780
- case "end":
2781
- return _context3.stop();
2782
- }
2783
- }
2784
- }, _callee3, this);
2785
- }));
2786
-
2787
- function lockboxSecretGet(_x5, _x6) {
2788
- return _lockboxSecretGet.apply(this, arguments);
2789
- }
2790
-
2791
- return lockboxSecretGet;
2792
- }();
2793
-
2794
- _proto.lockboxGrant = /*#__PURE__*/function () {
2795
- var _lockboxGrant = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(lockboxUuid, req, lockboxOwnerUuid) {
2796
- return runtime_1.wrap(function _callee4$(_context4) {
2797
- while (1) {
2798
- switch (_context4.prev = _context4.next) {
2799
- case 0:
2800
- return _context4.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/grant", req, {
2801
- params: {
2802
- lockbox_owner_uuid: lockboxOwnerUuid
2803
- }
2804
- }));
2805
-
2806
- case 1:
2807
- case "end":
2808
- return _context4.stop();
2809
- }
2810
- }
2811
- }, _callee4, this);
2812
- }));
2813
-
2814
- function lockboxGrant(_x7, _x8, _x9) {
2815
- return _lockboxGrant.apply(this, arguments);
2816
- }
2817
-
2818
- return lockboxGrant;
2819
- }()
2820
- /**
2821
- * Get all lockboxes granted to user
2822
- * @param filter filter of lockbox metadata
2823
- * @returns decrypted lockboxes granted to user
2824
- */
2825
- ;
2826
-
2827
- _proto.grantsGet =
2828
- /*#__PURE__*/
2829
- function () {
2830
- var _grantsGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
2831
- return runtime_1.wrap(function _callee5$(_context5) {
2832
- while (1) {
2833
- switch (_context5.prev = _context5.next) {
2834
- case 0:
2835
- return _context5.abrupt("return", this.api.get(this.baseURL + "/v1/grants"));
2836
-
2837
- case 1:
2838
- case "end":
2839
- return _context5.stop();
2840
- }
2841
- }
2842
- }, _callee5, this);
2843
- }));
2844
-
2845
- function grantsGet() {
2846
- return _grantsGet.apply(this, arguments);
2847
- }
2848
-
2849
- return grantsGet;
2850
- }()
2851
- /**
2852
- * This function create or update a data into the vault.
2853
- * @note At creation it is necessary to have all `req` filled
2854
- * @note When setting `previousDataUuid` you are updating the data. `req` metadata fields are optional.
2855
- * @param lockboxUuid The lockbox uuid the data will be stored in
2856
- * @param req The request (please see notes)
2857
- * @param lockboxOwnerUuid The uuid of the owner of the lockbox (@deprecated)
2858
- * @param previousDataUuid The data uuid of the data you want to update
2859
- * @returns
2860
- */
2861
- ;
2862
-
2863
- _proto.lockboxDataStore =
2864
- /*#__PURE__*/
2865
- function () {
2866
- var _lockboxDataStore = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(lockboxUuid, req, lockboxOwnerUuid, previousDataUuid) {
2867
- return runtime_1.wrap(function _callee6$(_context6) {
2868
- while (1) {
2869
- switch (_context6.prev = _context6.next) {
2870
- case 0:
2871
- return _context6.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data", req, {
2872
- params: {
2873
- lockbox_owner_uuid: lockboxOwnerUuid,
2874
- data_uuid: previousDataUuid
2875
- }
2876
- }));
2877
-
2878
- case 1:
2879
- case "end":
2880
- return _context6.stop();
2881
- }
2882
- }
2883
- }, _callee6, this);
2884
- }));
2885
-
2886
- function lockboxDataStore(_x10, _x11, _x12, _x13) {
2887
- return _lockboxDataStore.apply(this, arguments);
2888
- }
2889
-
2890
- return lockboxDataStore;
2891
- }();
2892
-
2893
- _proto.lockboxDataGet = /*#__PURE__*/function () {
2894
- var _lockboxDataGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(lockboxUuid, dataUuid, lockboxOwnerUuid, stream) {
2895
- var data;
2896
- return runtime_1.wrap(function _callee7$(_context7) {
2897
- while (1) {
2898
- switch (_context7.prev = _context7.next) {
2899
- case 0:
2900
- if (stream === void 0) {
2901
- stream = true;
2902
- }
2903
-
2904
- _context7.next = 3;
2905
- return this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data/" + dataUuid, {
2906
- params: {
2907
- lockbox_owner_uuid: lockboxOwnerUuid,
2908
- stream: stream
2909
- }
2910
- });
2911
-
2912
- case 3:
2913
- data = _context7.sent;
2914
-
2915
- if (!stream) {
2916
- _context7.next = 6;
2917
- break;
2918
- }
2919
-
2920
- return _context7.abrupt("return", {
2921
- data: data
2922
- });
2923
-
2924
- case 6:
2925
- return _context7.abrupt("return", data);
2926
-
2927
- case 7:
2928
- case "end":
2929
- return _context7.stop();
2930
- }
2931
- }
2932
- }, _callee7, this);
2933
- }));
2934
-
2935
- function lockboxDataGet(_x14, _x15, _x16, _x17) {
2936
- return _lockboxDataGet.apply(this, arguments);
2937
- }
2938
-
2939
- return lockboxDataGet;
2940
- }();
2941
-
2942
- _proto.lockboxManifestGet = /*#__PURE__*/function () {
2943
- var _lockboxManifestGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(lockboxUuid, filter, lockboxOwnerUuid) {
2944
- return runtime_1.wrap(function _callee8$(_context8) {
2945
- while (1) {
2946
- switch (_context8.prev = _context8.next) {
2947
- case 0:
2948
- return _context8.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid, {
2949
- params: {
2950
- lockbox_owner_uuid: lockboxOwnerUuid,
2951
- filter: filter
2952
- }
2953
- }));
2954
-
2955
- case 1:
2956
- case "end":
2957
- return _context8.stop();
2958
- }
2959
- }
2960
- }, _callee8, this);
2961
- }));
2962
-
2963
- function lockboxManifestGet(_x18, _x19, _x20) {
2964
- return _lockboxManifestGet.apply(this, arguments);
2965
- }
2966
-
2967
- return lockboxManifestGet;
2968
- }();
2969
-
2970
- _proto.lockboxMetadataGet = /*#__PURE__*/function () {
2971
- var _lockboxMetadataGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(lockboxUuid, fields, groupby, filter, lockboxOwnerUuid) {
2972
- return runtime_1.wrap(function _callee9$(_context9) {
2973
- while (1) {
2974
- switch (_context9.prev = _context9.next) {
2975
- case 0:
2976
- return _context9.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/metadata", {
2977
- params: {
2978
- lockbox_owner_uuid: lockboxOwnerUuid,
2979
- fields: fields,
2980
- groupby: groupby,
2981
- filter: filter
2982
- }
2983
- }));
2984
-
2985
- case 1:
2986
- case "end":
2987
- return _context9.stop();
2988
- }
2989
- }
2990
- }, _callee9, this);
2991
- }));
2992
-
2993
- function lockboxMetadataGet(_x21, _x22, _x23, _x24, _x25) {
2994
- return _lockboxMetadataGet.apply(this, arguments);
2995
- }
2996
-
2997
- return lockboxMetadataGet;
2998
- }()
2999
- /**
3000
- * inserts or updates encrypted index entries
3001
- * @note if the index data is being inserted for a user other than the requester, use `indexOwnerUuid`
3002
- * @note if a uuid for an entry is provided, the service will perform an update
3003
- * @param entries the encrypted index data
3004
- * @param indexOwnerUuid
3005
- */
3006
- ;
3007
-
3008
- _proto.vaultIndexPut =
3009
- /*#__PURE__*/
3010
- function () {
3011
- var _vaultIndexPut = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(entries, indexOwnerUuid) {
3012
- return runtime_1.wrap(function _callee10$(_context10) {
3013
- while (1) {
3014
- switch (_context10.prev = _context10.next) {
3015
- case 0:
3016
- return _context10.abrupt("return", this.api.put(this.baseURL + "/v1/index", entries, {
3017
- params: {
3018
- index_owner_uuid: indexOwnerUuid
3019
- }
3020
- }));
3021
-
3022
- case 1:
3023
- case "end":
3024
- return _context10.stop();
3025
- }
3026
- }
3027
- }, _callee10, this);
3028
- }));
3029
-
3030
- function vaultIndexPut(_x26, _x27) {
3031
- return _vaultIndexPut.apply(this, arguments);
3032
- }
3033
-
3034
- return vaultIndexPut;
3035
- }()
3036
- /**
3037
- * inserts or updates index snapshot for the provided index owner
3038
- * @note if the index data is being inserted for a user other than the requester, use `indexOwnerUuid`
3039
- * @param entry the encrypted index snapshot
3040
- */
3041
- ;
3042
-
3043
- _proto.vaultIndexSnapshotPut =
3044
- /*#__PURE__*/
3045
- function () {
3046
- var _vaultIndexSnapshotPut = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(entry) {
3047
- return runtime_1.wrap(function _callee11$(_context11) {
3048
- while (1) {
3049
- switch (_context11.prev = _context11.next) {
3050
- case 0:
3051
- return _context11.abrupt("return", this.api.put(this.baseURL + "/v1/index-snapshot", entry));
3052
-
3053
- case 1:
3054
- case "end":
3055
- return _context11.stop();
3056
- }
3057
- }
3058
- }, _callee11, this);
3059
- }));
3060
-
3061
- function vaultIndexSnapshotPut(_x28) {
3062
- return _vaultIndexSnapshotPut.apply(this, arguments);
3063
- }
3064
-
3065
- return vaultIndexSnapshotPut;
3066
- }()
3067
- /**
3068
- * Retrieves the encrypted index from the vault for the requesting user
3069
- * @note index keys can be specified to narrow the scope of index being requested
3070
- * @param indexKeys accepted index fields determined by vault
3071
- * @param identifiers: an array of unique_hashes or consultation uuids used to identify an index entry
3072
- * @param timestamp the minimum timestamp that index entries were created
3073
- * @returns the encrypted index
3074
- */
3075
- ;
3076
-
3077
- _proto.vaultIndexGet =
3078
- /*#__PURE__*/
3079
- function () {
3080
- var _vaultIndexGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(indexKeys, identifiers, timestamp) {
3081
- return runtime_1.wrap(function _callee12$(_context12) {
3082
- while (1) {
3083
- switch (_context12.prev = _context12.next) {
3084
- case 0:
3085
- return _context12.abrupt("return", this.api.get(this.baseURL + "/v1/index", {
3086
- params: {
3087
- index_keys: indexKeys,
3088
- identifiers: identifiers,
3089
- timestamp: timestamp
3090
- }
3091
- }));
3092
-
3093
- case 1:
3094
- case "end":
3095
- return _context12.stop();
3096
- }
3097
- }
3098
- }, _callee12, this);
3099
- }));
3100
-
3101
- function vaultIndexGet(_x29, _x30, _x31) {
3102
- return _vaultIndexGet.apply(this, arguments);
3103
- }
3104
-
3105
- return vaultIndexGet;
3106
- }();
3107
-
3108
- return VaultService;
3109
- }();
3110
-
3111
- var WorkflowService = /*#__PURE__*/function () {
3112
- function WorkflowService(api, url) {
3113
- this.api = api;
3114
- this.v1Url = url + "/v1";
3115
- }
3116
- /**
3117
- * This function returns all workflows
3118
- * @returns desired workflow
3119
- */
3120
-
3121
-
3122
- 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
+ }
3123
922
 
3124
- _proto.getWorkflows = function getWorkflows() {
3125
- return this.api.get(this.v1Url + "/workflows");
3126
- }
3127
- /**
3128
- * This function retrieves a workflow. If `locale` is not found, it will try to find 'en' version of it.
3129
- * By default, will return most recent workflow of a specific `id`. `createdAt` can be used to select older version.
3130
- * @param id The uuid of the workflow
3131
- * @param locale (optional) The desired locale of the workflow (default: 'en')
3132
- * @param createdAt (optional) The creation date of the workflow (also used for versionning)
3133
- * @returns desired workflow
3134
- */
3135
- ;
923
+ var record = finallyEntry ? finallyEntry.completion : {};
924
+ record.type = type;
925
+ record.arg = arg;
3136
926
 
3137
- _proto.getWorkflow = function getWorkflow(id, locale, createdAt) {
3138
- return this.api.get(this.v1Url + "/workflows/" + id, {
3139
- params: {
3140
- locale: locale,
3141
- createdAt: createdAt
927
+ if (finallyEntry) {
928
+ this.method = "next";
929
+ this.next = finallyEntry.finallyLoc;
930
+ return ContinueSentinel;
3142
931
  }
3143
- });
3144
- };
3145
932
 
3146
- return WorkflowService;
3147
- }();
933
+ return this.complete(record);
934
+ },
3148
935
 
3149
- var _excluded = ["locale"],
3150
- _excluded2 = ["locale"];
3151
- var CliniaService = /*#__PURE__*/function () {
3152
- function CliniaService(url, apiKey, locale) {
3153
- this.url = url;
3154
- this.locale = locale;
3155
- this.api = new AxiosService({
3156
- headers: {
3157
- 'X-Clinia-API-Key': apiKey
936
+ complete: function(record, afterLoc) {
937
+ if (record.type === "throw") {
938
+ throw record.arg;
3158
939
  }
3159
- });
3160
- }
3161
940
 
3162
- 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
+ }
3163
951
 
3164
- _proto.placeSearch = function placeSearch(searchOptions) {
3165
- var locale = searchOptions.locale,
3166
- data = _objectWithoutPropertiesLoose(searchOptions, _excluded);
952
+ return ContinueSentinel;
953
+ },
3167
954
 
3168
- return this.api.post(this.url + "/search/v1/indexes/health_facility/query", data, {
3169
- params: {
3170
- 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
+ }
3171
963
  }
3172
- });
3173
- };
964
+ },
3174
965
 
3175
- _proto.placeMatch = function placeMatch(searchOptions, type) {
3176
- var locale = searchOptions.locale,
3177
- 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
+ }
3178
978
 
3179
- var request = this.api.post(this.url + "/search/v1/matches", data, {
3180
- params: {
3181
- 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;
3182
995
  }
3183
- });
3184
996
 
3185
- if (type) {
3186
- request = request.then(function (places) {
3187
- return places.filter(function (place) {
3188
- return place.type === type;
3189
- });
3190
- });
997
+ return ContinueSentinel;
3191
998
  }
3192
-
3193
- return request;
3194
999
  };
3195
1000
 
3196
- return CliniaService;
3197
- }();
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
+ });
3198
1035
 
3199
1036
  var _personalMetaToPrefix;
3200
- 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);
3201
1038
  /**
3202
1039
  * This function extract PersonalInformations from data input object coming from workflow
3203
1040
  * @param data extracted from WorkflowData
@@ -3346,6 +1183,61 @@ function sessionStorePrivateKeyName(id) {
3346
1183
  return sessionPrivateKeyPrefix + id;
3347
1184
  }
3348
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
+
3349
1241
  function filterTriggeredAnsweredWithKind(_x, _x2) {
3350
1242
  return _filterTriggeredAnsweredWithKind.apply(this, arguments);
3351
1243
  }
@@ -3788,7 +1680,7 @@ function _registerPatient() {
3788
1680
 
3789
1681
  case 25:
3790
1682
  // the index will identify in which lockbox a consultation live
3791
- consultIndex = (_consultIndex = {}, _consultIndex[exports.IndexKey.ConsultationLockbox] = [{
1683
+ consultIndex = (_consultIndex = {}, _consultIndex[initApis.IndexKey.ConsultationLockbox] = [{
3792
1684
  grant: {
3793
1685
  lockboxUuid: lockboxUuid,
3794
1686
  lockboxOwnerUuid: patientUuid
@@ -3821,7 +1713,7 @@ function _registerPatient() {
3821
1713
  };
3822
1714
  }()); //DEPRECATED: REMOVE ME : BEGIN /////////////////////////////////////////
3823
1715
 
3824
- deprecatedConsultIndex = (_deprecatedConsultInd = {}, _deprecatedConsultInd[exports.IndexKey.Consultation] = [{
1716
+ deprecatedConsultIndex = (_deprecatedConsultInd = {}, _deprecatedConsultInd[initApis.IndexKey.Consultation] = [{
3825
1717
  grant: {
3826
1718
  lockboxUuid: lockboxUuid,
3827
1719
  lockboxOwnerUuid: patientUuid
@@ -3896,7 +1788,7 @@ function _registerPatient() {
3896
1788
  case 40:
3897
1789
  _context4.next = 42;
3898
1790
  return oroClient.consultClient.updateConsultByUUID(consult.uuid, {
3899
- statusMedical: exports.MedicalStatus.New
1791
+ statusMedical: initApis.MedicalStatus.New
3900
1792
  });
3901
1793
 
3902
1794
  case 42:
@@ -3985,8 +1877,8 @@ function _patientConsultExists() {
3985
1877
  switch (_context6.prev = _context6.next) {
3986
1878
  case 0:
3987
1879
  publicMetadata = {
3988
- category: exports.MetadataCategory.Consultation,
3989
- documentType: exports.DocumentType.PopulatedWorkflowData
1880
+ category: initApis.MetadataCategory.Consultation,
1881
+ documentType: initApis.DocumentType.PopulatedWorkflowData
3990
1882
  };
3991
1883
  _context6.next = 3;
3992
1884
  return oroClient.vaultClient.lockboxMetadataGet(lockboxUuid, ['consultationId'], [], publicMetadata);
@@ -4129,27 +2021,27 @@ function _storePatientData() {
4129
2021
  console.error('[SDK] Some errors happened during image upload', err);
4130
2022
  }), // Storing Raw data first
4131
2023
  oroClient.getOrInsertJsonData(lockboxUuid, workflow, {
4132
- category: exports.MetadataCategory.Raw,
2024
+ category: initApis.MetadataCategory.Raw,
4133
2025
  contentType: 'application/json',
4134
2026
  consultationId: consultationId
4135
- }, {}), getWorkflowDataByCategory(workflow, exports.MetadataCategory.Consultation).then(function (data) {
2027
+ }, {}), getWorkflowDataByCategory(workflow, initApis.MetadataCategory.Consultation).then(function (data) {
4136
2028
  return oroClient.getOrInsertJsonData(lockboxUuid, data, {
4137
- category: exports.MetadataCategory.Consultation,
4138
- documentType: exports.DocumentType.PopulatedWorkflowData,
2029
+ category: initApis.MetadataCategory.Consultation,
2030
+ documentType: initApis.DocumentType.PopulatedWorkflowData,
4139
2031
  consultationId: consultationId
4140
2032
  }, {
4141
2033
  consultationId: consultationId
4142
2034
  });
4143
- }), getWorkflowDataByCategory(workflow, exports.MetadataCategory.Medical).then(function (data) {
2035
+ }), getWorkflowDataByCategory(workflow, initApis.MetadataCategory.Medical).then(function (data) {
4144
2036
  return oroClient.getOrInsertJsonData(lockboxUuid, data, {
4145
- category: exports.MetadataCategory.Medical,
4146
- documentType: exports.DocumentType.PopulatedWorkflowData,
2037
+ category: initApis.MetadataCategory.Medical,
2038
+ documentType: initApis.DocumentType.PopulatedWorkflowData,
4147
2039
  consultationIds: [consultationId]
4148
2040
  }, {});
4149
- }), 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, {
4150
2042
  isoLanguage: isoLanguage
4151
2043
  }, {
4152
- category: exports.MetadataCategory.Preference,
2044
+ category: initApis.MetadataCategory.Preference,
4153
2045
  contentType: 'application/json'
4154
2046
  }, {})]).then(function (dataUuids) {
4155
2047
  return dataUuids.flat();
@@ -4207,8 +2099,8 @@ function _storeImageAliases() {
4207
2099
 
4208
2100
  promises = nonNullImages.map(function (image) {
4209
2101
  return oroClient.getOrInsertJsonData(lockboxUuid, image, {
4210
- category: exports.MetadataCategory.Consultation,
4211
- documentType: exports.DocumentType.ImageAlias,
2102
+ category: initApis.MetadataCategory.Consultation,
2103
+ documentType: initApis.DocumentType.ImageAlias,
4212
2104
  consultationId: consultationId,
4213
2105
  idbId: image.idbId
4214
2106
  }, {});
@@ -4239,7 +2131,7 @@ function _extractAndStorePersonalWorkflowData() {
4239
2131
  if (Object.keys(data.fields).length === 0) return;
4240
2132
  return oroClient.getOrInsertJsonData(lockboxUuid, data, {
4241
2133
  category: category,
4242
- documentType: exports.DocumentType.PopulatedWorkflowData,
2134
+ documentType: initApis.DocumentType.PopulatedWorkflowData,
4243
2135
  consultationIds: [consultationId]
4244
2136
  }, {});
4245
2137
  }));
@@ -4346,12 +2238,12 @@ function _filterGrantsWithLockboxMetadata() {
4346
2238
  vaultIndex = _context.sent;
4347
2239
 
4348
2240
  case 5:
4349
- if (!(vaultIndex[exports.IndexKey.Consultation] && filter)) {
2241
+ if (!(vaultIndex[initApis.IndexKey.Consultation] && filter)) {
4350
2242
  _context.next = 10;
4351
2243
  break;
4352
2244
  }
4353
2245
 
4354
- 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) {
4355
2247
  return consultGrant.consultationId === filter.consultationId;
4356
2248
  }).map(function (consultGrant) {
4357
2249
  return consultGrant.grant;
@@ -4400,7 +2292,7 @@ function _buildLegacyVaultIndex() {
4400
2292
  grant = _step.value;
4401
2293
  _context2.next = 3;
4402
2294
  return oroClient.vaultClient.lockboxMetadataGet(grant.lockboxUuid, ['consultationId'], [], {
4403
- category: exports.MetadataCategory.Consultation
2295
+ category: initApis.MetadataCategory.Consultation
4404
2296
  });
4405
2297
 
4406
2298
  case 3:
@@ -4436,7 +2328,7 @@ function _buildLegacyVaultIndex() {
4436
2328
  break;
4437
2329
 
4438
2330
  case 10:
4439
- vaultIndex = (_vaultIndex = {}, _vaultIndex[exports.IndexKey.Consultation] = consultGrants, _vaultIndex);
2331
+ vaultIndex = (_vaultIndex = {}, _vaultIndex[initApis.IndexKey.Consultation] = consultGrants, _vaultIndex);
4440
2332
  oroClient.setVaultIndex(vaultIndex);
4441
2333
  console.info('[sdk:index] Successfully Built Vault Index');
4442
2334
  return _context3.abrupt("return", vaultIndex);
@@ -4468,7 +2360,7 @@ var OroClient = /*#__PURE__*/function () {
4468
2360
  }
4469
2361
  /**
4470
2362
  * clears the vaultIndex and cached metadata grants
4471
- */
2363
+ */
4472
2364
 
4473
2365
 
4474
2366
  var _proto = OroClient.prototype;
@@ -4945,7 +2837,7 @@ var OroClient = /*#__PURE__*/function () {
4945
2837
  case 0:
4946
2838
  _context9.next = 2;
4947
2839
  return _this.vaultClient.lockboxMetadataGet(grant.lockboxUuid, ['consultationId'], [], {
4948
- category: exports.MetadataCategory.Consultation
2840
+ category: initApis.MetadataCategory.Consultation
4949
2841
  }, grant.lockboxOwnerUuid).then(function (consults) {
4950
2842
  try {
4951
2843
  return consults[0].map(function (consult) {
@@ -4984,7 +2876,7 @@ var OroClient = /*#__PURE__*/function () {
4984
2876
 
4985
2877
  case 5:
4986
2878
  indexConsultLockbox = _context10.sent;
4987
- 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 () {
4988
2880
  return alert('The Index was successfully updated!');
4989
2881
  })["catch"](function () {
4990
2882
  return console.error('The index failed to update!');
@@ -5062,7 +2954,7 @@ var OroClient = /*#__PURE__*/function () {
5062
2954
  keyString = _Object$keys[_i];
5063
2955
  key = keyString;
5064
2956
  _context11.t0 = key;
5065
- _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;
5066
2958
  break;
5067
2959
 
5068
2960
  case 18:
@@ -5094,7 +2986,7 @@ var OroClient = /*#__PURE__*/function () {
5094
2986
  }).filter(function (e) {
5095
2987
  var _this2$vaultIndex$Ind;
5096
2988
 
5097
- 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) {
5098
2990
  return v.uniqueHash === e.uniqueHash;
5099
2991
  }));
5100
2992
  }).map(function (e) {
@@ -5159,7 +3051,7 @@ var OroClient = /*#__PURE__*/function () {
5159
3051
 
5160
3052
  case 2:
5161
3053
  rsaPub = this.rsa["public"]();
5162
- 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) {
5163
3055
  return c;
5164
3056
  }).map(function (c) {
5165
3057
  return {
@@ -5298,8 +3190,8 @@ var OroClient = /*#__PURE__*/function () {
5298
3190
  encryptedPrivateMeta = _context14.t0.jsonEncryptToBase64Payload.call(_context14.t0, _context14.t2);
5299
3191
  meta = {
5300
3192
  consultationId: consultationId,
5301
- category: exports.MetadataCategory.Consultation,
5302
- documentType: exports.DocumentType.Message,
3193
+ category: initApis.MetadataCategory.Consultation,
3194
+ documentType: initApis.DocumentType.Message,
5303
3195
  contentType: 'text/plain'
5304
3196
  };
5305
3197
  request = {
@@ -5384,8 +3276,8 @@ var OroClient = /*#__PURE__*/function () {
5384
3276
  encryptedPrivateMeta = _context15.t4.jsonEncryptToBase64Payload.call(_context15.t4, _context15.t9);
5385
3277
  meta = {
5386
3278
  consultationId: consultationId,
5387
- category: exports.MetadataCategory.Consultation,
5388
- documentType: exports.DocumentType.Message,
3279
+ category: initApis.MetadataCategory.Consultation,
3280
+ documentType: initApis.DocumentType.Message,
5389
3281
  contentType: data.type
5390
3282
  };
5391
3283
  request = {
@@ -5449,7 +3341,7 @@ var OroClient = /*#__PURE__*/function () {
5449
3341
  _context16.t4 = new _context16.t2(_context16.t3);
5450
3342
  _context16.t5 = {
5451
3343
  consultationId: consultationId,
5452
- category: exports.MetadataCategory.Consultation,
3344
+ category: initApis.MetadataCategory.Consultation,
5453
3345
  documentType: documentType,
5454
3346
  contentType: data.type
5455
3347
  };
@@ -5809,10 +3701,10 @@ var OroClient = /*#__PURE__*/function () {
5809
3701
 
5810
3702
  case 6:
5811
3703
  _context22.next = 8;
5812
- 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]);
5813
3705
 
5814
3706
  case 8:
5815
- _context22.t0 = exports.IndexKey.ConsultationLockbox;
3707
+ _context22.t0 = initApis.IndexKey.ConsultationLockbox;
5816
3708
  grantsByConsultLockbox = _context22.sent[_context22.t0];
5817
3709
  decryptedConsults = decryptConsultLockboxGrants(grantsByConsultLockbox != null ? grantsByConsultLockbox : [], this.rsa);
5818
3710
 
@@ -5996,7 +3888,7 @@ var OroClient = /*#__PURE__*/function () {
5996
3888
  forceRefresh = false;
5997
3889
  }
5998
3890
 
5999
- return _context25.abrupt("return", this.getMetaCategoryFromConsultId(consultationId, exports.MetadataCategory.Medical, forceRefresh));
3891
+ return _context25.abrupt("return", this.getMetaCategoryFromConsultId(consultationId, initApis.MetadataCategory.Medical, forceRefresh));
6000
3892
 
6001
3893
  case 2:
6002
3894
  case "end":
@@ -6045,7 +3937,7 @@ var OroClient = /*#__PURE__*/function () {
6045
3937
  _context27.next = 3;
6046
3938
  return _this3.getLockboxManifest(grant.lockboxUuid, {
6047
3939
  category: category,
6048
- documentType: exports.DocumentType.PopulatedWorkflowData,
3940
+ documentType: initApis.DocumentType.PopulatedWorkflowData,
6049
3941
  consultationIds: [consultationId]
6050
3942
  }, true, grant.lockboxOwnerUuid, forceRefresh);
6051
3943
 
@@ -6060,7 +3952,7 @@ var OroClient = /*#__PURE__*/function () {
6060
3952
  _context27.next = 7;
6061
3953
  return _this3.getLockboxManifest(grant.lockboxUuid, {
6062
3954
  category: category,
6063
- documentType: exports.DocumentType.PopulatedWorkflowData
3955
+ documentType: initApis.DocumentType.PopulatedWorkflowData
6064
3956
  }, true, grant.lockboxOwnerUuid, forceRefresh);
6065
3957
 
6066
3958
  case 7:
@@ -6198,8 +4090,8 @@ var OroClient = /*#__PURE__*/function () {
6198
4090
  case 10:
6199
4091
  _context29.next = 12;
6200
4092
  return this.getLockboxManifest(lockboxUuid, {
6201
- category: exports.MetadataCategory.Personal,
6202
- documentType: exports.DocumentType.PopulatedWorkflowData
4093
+ category: initApis.MetadataCategory.Personal,
4094
+ documentType: initApis.DocumentType.PopulatedWorkflowData
6203
4095
  }, false, userId);
6204
4096
 
6205
4097
  case 12:
@@ -6476,8 +4368,8 @@ var OroClient = /*#__PURE__*/function () {
6476
4368
  }
6477
4369
 
6478
4370
  return _context34.abrupt("return", this.createJsonData(lockboxUuid, data, {
6479
- category: exports.MetadataCategory.Personal,
6480
- documentType: exports.DocumentType.PopulatedWorkflowData
4371
+ category: initApis.MetadataCategory.Personal,
4372
+ documentType: initApis.DocumentType.PopulatedWorkflowData
6481
4373
  }, {}, undefined, dataUuid));
6482
4374
 
6483
4375
  case 13:
@@ -6546,7 +4438,7 @@ var OroClient = /*#__PURE__*/function () {
6546
4438
  }
6547
4439
 
6548
4440
  return _context35.abrupt("return", this.createJsonData(lockboxUuid, preference, {
6549
- category: exports.MetadataCategory.Preference,
4441
+ category: initApis.MetadataCategory.Preference,
6550
4442
  contentType: 'application/json'
6551
4443
  }, {}, undefined, dataUuid));
6552
4444
 
@@ -6666,7 +4558,7 @@ var OroClient = /*#__PURE__*/function () {
6666
4558
 
6667
4559
  case 5:
6668
4560
  return _context37.abrupt("return", this.getDataFromGrant(grant, {
6669
- category: exports.MetadataCategory.Preference,
4561
+ category: initApis.MetadataCategory.Preference,
6670
4562
  contentType: 'application/json'
6671
4563
  }));
6672
4564
 
@@ -6717,7 +4609,7 @@ var OroClient = /*#__PURE__*/function () {
6717
4609
 
6718
4610
  case 5:
6719
4611
  return _context38.abrupt("return", this.getDataFromGrant(grant, {
6720
- category: exports.MetadataCategory.Preference,
4612
+ category: initApis.MetadataCategory.Preference,
6721
4613
  contentType: 'application/json'
6722
4614
  }));
6723
4615
 
@@ -6766,7 +4658,7 @@ var OroClient = /*#__PURE__*/function () {
6766
4658
 
6767
4659
  case 5:
6768
4660
  return _context39.abrupt("return", this.getDataFromGrant(grant, {
6769
- category: exports.MetadataCategory.Recovery,
4661
+ category: initApis.MetadataCategory.Recovery,
6770
4662
  contentType: 'application/json'
6771
4663
  }));
6772
4664
 
@@ -6817,7 +4709,7 @@ var OroClient = /*#__PURE__*/function () {
6817
4709
 
6818
4710
  case 5:
6819
4711
  return _context40.abrupt("return", this.getDataFromGrant(grant, {
6820
- category: exports.MetadataCategory.Recovery,
4712
+ category: initApis.MetadataCategory.Recovery,
6821
4713
  contentType: 'application/json'
6822
4714
  }));
6823
4715
 
@@ -6868,8 +4760,8 @@ var OroClient = /*#__PURE__*/function () {
6868
4760
  case 4:
6869
4761
  _context42.t1 = _context42.sent.map(function (grant) {
6870
4762
  return _this5.getLockboxManifest(grant.lockboxUuid, {
6871
- category: exports.MetadataCategory.Consultation,
6872
- documentType: exports.DocumentType.PopulatedWorkflowData
4763
+ category: initApis.MetadataCategory.Consultation,
4764
+ documentType: initApis.DocumentType.PopulatedWorkflowData
6873
4765
  }, true, undefined, forceRefresh).then(function (manifest) {
6874
4766
  return Promise.all(manifest.map( /*#__PURE__*/function () {
6875
4767
  var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee40(entry) {
@@ -6951,8 +4843,8 @@ var OroClient = /*#__PURE__*/function () {
6951
4843
  case 5:
6952
4844
  _context44.next = 7;
6953
4845
  return this.vaultClient.lockboxMetadataGet(grant.lockboxUuid, ['consultationId'], ['consultationId'], {
6954
- category: exports.MetadataCategory.Consultation,
6955
- documentType: exports.DocumentType.PopulatedWorkflowData
4846
+ category: initApis.MetadataCategory.Consultation,
4847
+ documentType: initApis.DocumentType.PopulatedWorkflowData
6956
4848
  }, grant.lockboxOwnerUuid);
6957
4849
 
6958
4850
  case 7:
@@ -7042,8 +4934,8 @@ var OroClient = /*#__PURE__*/function () {
7042
4934
  case 4:
7043
4935
  _context45.t1 = _context45.sent.map(function (grant) {
7044
4936
  return _this7.getLockboxManifest(grant.lockboxUuid, {
7045
- category: exports.MetadataCategory.Consultation,
7046
- documentType: exports.DocumentType.PopulatedWorkflowData,
4937
+ category: initApis.MetadataCategory.Consultation,
4938
+ documentType: initApis.DocumentType.PopulatedWorkflowData,
7047
4939
  consultationId: consultationId
7048
4940
  }, true, grant.lockboxOwnerUuid, forceRefresh).then(function (manifest) {
7049
4941
  return Promise.all(manifest.map(function (e) {
@@ -7085,8 +4977,8 @@ var OroClient = /*#__PURE__*/function () {
7085
4977
  switch (_context46.prev = _context46.next) {
7086
4978
  case 0:
7087
4979
  return _context46.abrupt("return", this.getPatientDocumentsList({
7088
- category: exports.MetadataCategory.Consultation,
7089
- documentType: exports.DocumentType.Prescription
4980
+ category: initApis.MetadataCategory.Consultation,
4981
+ documentType: initApis.DocumentType.Prescription
7090
4982
  }, true, consultationId));
7091
4983
 
7092
4984
  case 1:
@@ -7119,8 +5011,8 @@ var OroClient = /*#__PURE__*/function () {
7119
5011
  switch (_context47.prev = _context47.next) {
7120
5012
  case 0:
7121
5013
  return _context47.abrupt("return", this.getPatientDocumentsList({
7122
- category: exports.MetadataCategory.Consultation,
7123
- documentType: exports.DocumentType.Result
5014
+ category: initApis.MetadataCategory.Consultation,
5015
+ documentType: initApis.DocumentType.Result
7124
5016
  }, true, consultationId));
7125
5017
 
7126
5018
  case 1:
@@ -7153,8 +5045,8 @@ var OroClient = /*#__PURE__*/function () {
7153
5045
  switch (_context48.prev = _context48.next) {
7154
5046
  case 0:
7155
5047
  return _context48.abrupt("return", this.getPatientDocumentsList({
7156
- category: exports.MetadataCategory.Consultation,
7157
- documentType: exports.DocumentType.TreatmentPlan
5048
+ category: initApis.MetadataCategory.Consultation,
5049
+ documentType: initApis.DocumentType.TreatmentPlan
7158
5050
  }, true, consultationId));
7159
5051
 
7160
5052
  case 1:
@@ -7188,8 +5080,8 @@ var OroClient = /*#__PURE__*/function () {
7188
5080
  switch (_context49.prev = _context49.next) {
7189
5081
  case 0:
7190
5082
  return _context49.abrupt("return", this.getPatientDocumentsList({
7191
- category: exports.MetadataCategory.Consultation,
7192
- documentType: exports.DocumentType.TreatmentPlan,
5083
+ category: initApis.MetadataCategory.Consultation,
5084
+ documentType: initApis.DocumentType.TreatmentPlan,
7193
5085
  treatmentPlanId: treatmentPlanId
7194
5086
  }, true, consultationId));
7195
5087
 
@@ -7589,7 +5481,7 @@ var OroClient = /*#__PURE__*/function () {
7589
5481
  return this.getOrInsertJsonData(lockboxUuid, {
7590
5482
  masterKey: masterKey
7591
5483
  }, {
7592
- category: exports.MetadataCategory.Recovery,
5484
+ category: initApis.MetadataCategory.Recovery,
7593
5485
  contentType: 'application/json'
7594
5486
  }, {}, true);
7595
5487
 
@@ -7614,46 +5506,110 @@ var OroClient = /*#__PURE__*/function () {
7614
5506
  return OroClient;
7615
5507
  }();
7616
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
+
7617
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;
7618
5591
 
7619
- var init = function init(toolbox, tellerBaseURL, vaultBaseURL, guardBaseURL, practiceBaseURL, consultBaseURL, workflowBaseURL, diagnosisBaseUrl, authenticationCallback) {
7620
- var apiService = new APIService(undefined, authenticationCallback);
7621
- var tellerService = new TellerService(apiService, tellerBaseURL);
7622
- var practiceService = new PracticeService(toolbox, apiService, practiceBaseURL);
7623
- var consultService = new ConsultService(apiService, consultBaseURL);
7624
- var vaultService = new VaultService(apiService, vaultBaseURL);
7625
- var guardService = new GuardService(apiService, guardBaseURL);
7626
- var workflowService = new WorkflowService(apiService, workflowBaseURL);
7627
- var diagnosisService = new DiagnosisService(apiService, diagnosisBaseUrl);
7628
5592
  var client = new OroClient(toolbox, tellerService, vaultService, guardService, practiceService, consultService, workflowService, diagnosisService, authenticationCallback);
7629
5593
  return client;
7630
5594
  };
7631
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
+ });
7632
5604
  exports.OroToolboxNamespace = oroToolbox;
7633
- exports.APIService = APIService;
7634
5605
  exports.AssociatedLockboxNotFound = AssociatedLockboxNotFound;
7635
- exports.AuthenticationBadRequest = AuthenticationBadRequest;
7636
- exports.AuthenticationFailed = AuthenticationFailed;
7637
- exports.AuthenticationServerError = AuthenticationServerError;
7638
- exports.AxiosService = AxiosService;
7639
5606
  exports.CliniaService = CliniaService;
7640
- exports.ConsultService = ConsultService;
7641
- exports.DiagnosisService = DiagnosisService;
7642
- exports.GuardService = GuardService;
7643
- exports.IdentityCreationBadRequest = IdentityCreationBadRequest;
7644
- exports.IdentityCreationConflict = IdentityCreationConflict;
7645
- exports.IdentityCreationFailed = IdentityCreationFailed;
7646
5607
  exports.IncompleteAuthentication = IncompleteAuthentication;
7647
- exports.IndexBuildError = IndexBuildError;
7648
5608
  exports.MissingGrant = MissingGrant;
7649
5609
  exports.MissingLockbox = MissingLockbox;
7650
5610
  exports.MissingLockboxOwner = MissingLockboxOwner;
7651
5611
  exports.OroClient = OroClient;
7652
- exports.PracticeService = PracticeService;
7653
- exports.TellerService = TellerService;
7654
- exports.VaultService = VaultService;
7655
5612
  exports.WorkflowAnswersMissingError = WorkflowAnswersMissingError;
7656
- exports.WorkflowService = WorkflowService;
7657
5613
  exports.decryptConsultLockboxGrants = decryptConsultLockboxGrants;
7658
5614
  exports.decryptGrants = decryptGrants;
7659
5615
  exports.default = init;