oro-sdk 5.3.2 → 5.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1198,6 +1198,59 @@ function fillWorkflowFromPopulatedWorkflow(workflow, populatedWorkflow) {
1198
1198
  return filledWorkflow;
1199
1199
  }
1200
1200
 
1201
+ /**
1202
+ * Creates a consultation if one has not been created and fails to be retrieved by the payment intent
1203
+ * @param consult
1204
+ * @param oroClient
1205
+ * @returns the consult Uuid
1206
+ */
1207
+ function getOrCreatePatientConsultationUuid(_x, _x2) {
1208
+ return _getOrCreatePatientConsultationUuid.apply(this, arguments);
1209
+ }
1210
+
1211
+ function _getOrCreatePatientConsultationUuid() {
1212
+ _getOrCreatePatientConsultationUuid = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(consult, oroClient) {
1213
+ var payment;
1214
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1215
+ while (1) {
1216
+ switch (_context.prev = _context.next) {
1217
+ case 0:
1218
+ _context.next = 2;
1219
+ return oroClient.practiceClient.practiceGetPayment(consult.uuidPractice, consult.idStripeInvoiceOrPaymentIntent);
1220
+
1221
+ case 2:
1222
+ payment = _context.sent;
1223
+
1224
+ if (!(payment && payment.uuidConsult)) {
1225
+ _context.next = 7;
1226
+ break;
1227
+ }
1228
+
1229
+ return _context.abrupt("return", oroClient.consultClient.getConsultByUUID(payment.uuidConsult)["catch"](function (err) {
1230
+ console.error('Error while retrieving consult', err);
1231
+ throw err;
1232
+ }));
1233
+
1234
+ case 7:
1235
+ _context.next = 9;
1236
+ return oroClient.consultClient.consultCreate(consult)["catch"](function (err) {
1237
+ console.error('Error while creating consult', err);
1238
+ throw err;
1239
+ });
1240
+
1241
+ case 9:
1242
+ return _context.abrupt("return", _context.sent);
1243
+
1244
+ case 10:
1245
+ case "end":
1246
+ return _context.stop();
1247
+ }
1248
+ }
1249
+ }, _callee);
1250
+ }));
1251
+ return _getOrCreatePatientConsultationUuid.apply(this, arguments);
1252
+ }
1253
+
1201
1254
  var MAX_RETRIES = 15;
1202
1255
  /**
1203
1256
  * Completes a registration for a user retrying the complete flow a maximum of 15 times
@@ -1226,10 +1279,9 @@ function registerPatient(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
1226
1279
  return _registerPatient.apply(this, arguments);
1227
1280
  }
1228
1281
  /**
1229
- * Creates a consultation if one has not been created and fails to be retrieved by the payment intent
1230
- * @param consult
1282
+ * Creates a new lockbox for the patient if they do not have any, otherwise, use the first (and only one)
1231
1283
  * @param oroClient
1232
- * @returns the consult Uuid
1284
+ * @returns the lockbox Uuid
1233
1285
  */
1234
1286
 
1235
1287
  function _registerPatient() {
@@ -1371,7 +1423,7 @@ function _registerPatient() {
1371
1423
  }, _callee);
1372
1424
  }));
1373
1425
 
1374
- return function (_x31) {
1426
+ return function (_x29) {
1375
1427
  return _ref.apply(this, arguments);
1376
1428
  };
1377
1429
  }());
@@ -1403,7 +1455,7 @@ function _registerPatient() {
1403
1455
  }, _callee2);
1404
1456
  }));
1405
1457
 
1406
- return function (_x32) {
1458
+ return function (_x30) {
1407
1459
  return _ref2.apply(this, arguments);
1408
1460
  };
1409
1461
  }());
@@ -1577,60 +1629,7 @@ function _registerPatient() {
1577
1629
  return _registerPatient.apply(this, arguments);
1578
1630
  }
1579
1631
 
1580
- function getOrCreatePatientConsultationUuid(_x9, _x10) {
1581
- return _getOrCreatePatientConsultationUuid.apply(this, arguments);
1582
- }
1583
- /**
1584
- * Creates a new lockbox for the patient if they do not have any, otherwise, use the first (and only one)
1585
- * @param oroClient
1586
- * @returns the lockbox Uuid
1587
- */
1588
-
1589
-
1590
- function _getOrCreatePatientConsultationUuid() {
1591
- _getOrCreatePatientConsultationUuid = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(consult, oroClient) {
1592
- var payment;
1593
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1594
- while (1) {
1595
- switch (_context5.prev = _context5.next) {
1596
- case 0:
1597
- _context5.next = 2;
1598
- return oroClient.practiceClient.practiceGetPayment(consult.uuidPractice, consult.idStripeInvoiceOrPaymentIntent);
1599
-
1600
- case 2:
1601
- payment = _context5.sent;
1602
-
1603
- if (!(payment && payment.uuidConsult)) {
1604
- _context5.next = 7;
1605
- break;
1606
- }
1607
-
1608
- return _context5.abrupt("return", oroClient.consultClient.getConsultByUUID(payment.uuidConsult)["catch"](function (err) {
1609
- console.error('Error while retrieving consult', err);
1610
- throw err;
1611
- }));
1612
-
1613
- case 7:
1614
- _context5.next = 9;
1615
- return oroClient.consultClient.consultCreate(consult)["catch"](function (err) {
1616
- console.error('Error while creating consult', err);
1617
- throw err;
1618
- });
1619
-
1620
- case 9:
1621
- return _context5.abrupt("return", _context5.sent);
1622
-
1623
- case 10:
1624
- case "end":
1625
- return _context5.stop();
1626
- }
1627
- }
1628
- }, _callee5);
1629
- }));
1630
- return _getOrCreatePatientConsultationUuid.apply(this, arguments);
1631
- }
1632
-
1633
- function getOrCreatePatientLockbox(_x11) {
1632
+ function getOrCreatePatientLockbox(_x9) {
1634
1633
  return _getOrCreatePatientLockbox.apply(this, arguments);
1635
1634
  }
1636
1635
  /**
@@ -1645,74 +1644,74 @@ function getOrCreatePatientLockbox(_x11) {
1645
1644
 
1646
1645
 
1647
1646
  function _getOrCreatePatientLockbox() {
1648
- _getOrCreatePatientLockbox = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(oroClient) {
1647
+ _getOrCreatePatientLockbox = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(oroClient) {
1649
1648
  var grants, lockboxResponse, tokens;
1650
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1649
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1651
1650
  while (1) {
1652
- switch (_context6.prev = _context6.next) {
1651
+ switch (_context5.prev = _context5.next) {
1653
1652
  case 0:
1654
- _context6.next = 2;
1653
+ _context5.next = 2;
1655
1654
  return oroClient.getGrants();
1656
1655
 
1657
1656
  case 2:
1658
- grants = _context6.sent;
1657
+ grants = _context5.sent;
1659
1658
 
1660
1659
  if (!(grants.length > 0)) {
1661
- _context6.next = 8;
1660
+ _context5.next = 8;
1662
1661
  break;
1663
1662
  }
1664
1663
 
1665
1664
  console.log('The grant has already been created, skipping lockbox create step');
1666
- return _context6.abrupt("return", grants[0].lockboxUuid);
1665
+ return _context5.abrupt("return", grants[0].lockboxUuid);
1667
1666
 
1668
1667
  case 8:
1669
- _context6.next = 10;
1668
+ _context5.next = 10;
1670
1669
  return oroClient.vaultClient.lockboxCreate()["catch"](function (err) {
1671
1670
  console.error('Error while creating lockbox', err);
1672
1671
  throw err;
1673
1672
  });
1674
1673
 
1675
1674
  case 10:
1676
- lockboxResponse = _context6.sent;
1677
- _context6.next = 13;
1675
+ lockboxResponse = _context5.sent;
1676
+ _context5.next = 13;
1678
1677
  return oroClient.guardClient.authRefresh();
1679
1678
 
1680
1679
  case 13:
1681
- tokens = _context6.sent;
1682
- _context6.next = 16;
1680
+ tokens = _context5.sent;
1681
+ _context5.next = 16;
1683
1682
  return oroClient.guardClient.setTokens({
1684
1683
  accessToken: tokens.accessToken,
1685
1684
  refreshToken: tokens.refreshToken
1686
1685
  });
1687
1686
 
1688
1687
  case 16:
1689
- _context6.next = 18;
1688
+ _context5.next = 18;
1690
1689
  return oroClient.guardClient.whoAmI(true);
1691
1690
 
1692
1691
  case 18:
1693
- return _context6.abrupt("return", lockboxResponse.lockboxUuid);
1692
+ return _context5.abrupt("return", lockboxResponse.lockboxUuid);
1694
1693
 
1695
1694
  case 19:
1696
1695
  case "end":
1697
- return _context6.stop();
1696
+ return _context5.stop();
1698
1697
  }
1699
1698
  }
1700
- }, _callee6);
1699
+ }, _callee5);
1701
1700
  }));
1702
1701
  return _getOrCreatePatientLockbox.apply(this, arguments);
1703
1702
  }
1704
1703
 
1705
- function storePatientData(_x12, _x13, _x14, _x15, _x16) {
1704
+ function storePatientData(_x10, _x11, _x12, _x13, _x14) {
1706
1705
  return _storePatientData.apply(this, arguments);
1707
1706
  }
1708
1707
 
1709
1708
  function _storePatientData() {
1710
- _storePatientData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(consultationId, isoLanguage, lockboxUuid, workflow, oroClient) {
1711
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1709
+ _storePatientData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(consultationId, isoLanguage, lockboxUuid, workflow, oroClient) {
1710
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1712
1711
  while (1) {
1713
- switch (_context7.prev = _context7.next) {
1712
+ switch (_context6.prev = _context6.next) {
1714
1713
  case 0:
1715
- return _context7.abrupt("return", Promise.all([// Storing Raw data first
1714
+ return _context6.abrupt("return", Promise.all([// Storing Raw data first
1716
1715
  oroClient.getOrInsertJsonData(lockboxUuid, workflow, {
1717
1716
  category: MetadataCategory.Raw,
1718
1717
  contentType: 'application/json',
@@ -1743,15 +1742,15 @@ function _storePatientData() {
1743
1742
 
1744
1743
  case 1:
1745
1744
  case "end":
1746
- return _context7.stop();
1745
+ return _context6.stop();
1747
1746
  }
1748
1747
  }
1749
- }, _callee7);
1748
+ }, _callee6);
1750
1749
  }));
1751
1750
  return _storePatientData.apply(this, arguments);
1752
1751
  }
1753
1752
 
1754
- function storeImageAliases(_x17, _x18, _x19, _x20, _x21) {
1753
+ function storeImageAliases(_x15, _x16, _x17, _x18, _x19) {
1755
1754
  return _storeImageAliases.apply(this, arguments);
1756
1755
  }
1757
1756
  /**
@@ -1766,23 +1765,23 @@ function storeImageAliases(_x17, _x18, _x19, _x20, _x21) {
1766
1765
 
1767
1766
 
1768
1767
  function _storeImageAliases() {
1769
- _storeImageAliases = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(consultationId, lockboxUuid, workflow, oroClient, progress) {
1768
+ _storeImageAliases = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(consultationId, lockboxUuid, workflow, oroClient, progress) {
1770
1769
  var images, nonNullImages, storedImagesNum, totalImagesNum, promises;
1771
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1770
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1772
1771
  while (1) {
1773
- switch (_context8.prev = _context8.next) {
1772
+ switch (_context7.prev = _context7.next) {
1774
1773
  case 0:
1775
- _context8.t0 = getImagesFromIndexDb;
1776
- _context8.next = 3;
1774
+ _context7.t0 = getImagesFromIndexDb;
1775
+ _context7.next = 3;
1777
1776
  return filterTriggeredAnsweredWithKind(workflow, 'images-alias');
1778
1777
 
1779
1778
  case 3:
1780
- _context8.t1 = _context8.sent.flat();
1781
- _context8.next = 6;
1782
- return (0, _context8.t0)(_context8.t1);
1779
+ _context7.t1 = _context7.sent.flat();
1780
+ _context7.next = 6;
1781
+ return (0, _context7.t0)(_context7.t1);
1783
1782
 
1784
1783
  case 6:
1785
- images = _context8.sent;
1784
+ images = _context7.sent;
1786
1785
  nonNullImages = images.filter(function (img) {
1787
1786
  return !!img;
1788
1787
  });
@@ -1814,19 +1813,19 @@ function _storeImageAliases() {
1814
1813
  }
1815
1814
  });
1816
1815
  });
1817
- return _context8.abrupt("return", Promise.all(promises));
1816
+ return _context7.abrupt("return", Promise.all(promises));
1818
1817
 
1819
1818
  case 14:
1820
1819
  case "end":
1821
- return _context8.stop();
1820
+ return _context7.stop();
1822
1821
  }
1823
1822
  }
1824
- }, _callee8);
1823
+ }, _callee7);
1825
1824
  }));
1826
1825
  return _storeImageAliases.apply(this, arguments);
1827
1826
  }
1828
1827
 
1829
- function extractAndStorePersonalWorkflowData(_x22, _x23, _x24, _x25, _x26) {
1828
+ function extractAndStorePersonalWorkflowData(_x20, _x21, _x22, _x23, _x24) {
1830
1829
  return _extractAndStorePersonalWorkflowData.apply(this, arguments);
1831
1830
  }
1832
1831
  /**
@@ -1835,12 +1834,12 @@ function extractAndStorePersonalWorkflowData(_x22, _x23, _x24, _x25, _x26) {
1835
1834
  */
1836
1835
 
1837
1836
  function _extractAndStorePersonalWorkflowData() {
1838
- _extractAndStorePersonalWorkflowData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(workflow, lockboxUuid, consultationId, category, oroClient) {
1839
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1837
+ _extractAndStorePersonalWorkflowData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(workflow, lockboxUuid, consultationId, category, oroClient) {
1838
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1840
1839
  while (1) {
1841
- switch (_context9.prev = _context9.next) {
1840
+ switch (_context8.prev = _context8.next) {
1842
1841
  case 0:
1843
- return _context9.abrupt("return", getWorkflowDataByCategory(workflow, category).then(function (data) {
1842
+ return _context8.abrupt("return", getWorkflowDataByCategory(workflow, category).then(function (data) {
1844
1843
  if (Object.keys(data.fields).length === 0) return;
1845
1844
  return oroClient.getOrInsertJsonData(lockboxUuid, data, {
1846
1845
  category: category,
@@ -1851,15 +1850,15 @@ function _extractAndStorePersonalWorkflowData() {
1851
1850
 
1852
1851
  case 1:
1853
1852
  case "end":
1854
- return _context9.stop();
1853
+ return _context8.stop();
1855
1854
  }
1856
1855
  }
1857
- }, _callee9);
1856
+ }, _callee8);
1858
1857
  }));
1859
1858
  return _extractAndStorePersonalWorkflowData.apply(this, arguments);
1860
1859
  }
1861
1860
 
1862
- function extractPersonalInfoFromWorkflowData(_x27) {
1861
+ function extractPersonalInfoFromWorkflowData(_x25) {
1863
1862
  return _extractPersonalInfoFromWorkflowData.apply(this, arguments);
1864
1863
  }
1865
1864
  /**
@@ -1870,12 +1869,12 @@ function extractPersonalInfoFromWorkflowData(_x27) {
1870
1869
  */
1871
1870
 
1872
1871
  function _extractPersonalInfoFromWorkflowData() {
1873
- _extractPersonalInfoFromWorkflowData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(workflow) {
1874
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1872
+ _extractPersonalInfoFromWorkflowData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(workflow) {
1873
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1875
1874
  while (1) {
1876
- switch (_context10.prev = _context10.next) {
1875
+ switch (_context9.prev = _context9.next) {
1877
1876
  case 0:
1878
- return _context10.abrupt("return", Promise.all([getWorkflowDataByCategory(workflow, MetadataCategory.Personal), getWorkflowDataByCategory(workflow, MetadataCategory.ChildPersonal), getWorkflowDataByCategory(workflow, MetadataCategory.OtherPersonal)]).then(function (_ref3) {
1877
+ return _context9.abrupt("return", Promise.all([getWorkflowDataByCategory(workflow, MetadataCategory.Personal), getWorkflowDataByCategory(workflow, MetadataCategory.ChildPersonal), getWorkflowDataByCategory(workflow, MetadataCategory.OtherPersonal)]).then(function (_ref3) {
1879
1878
  var personalInfoPopulatedWfData = _ref3[0],
1880
1879
  childPersonalInfoPopulatedWfData = _ref3[1],
1881
1880
  otherPersonalInfoPopulatedWfData = _ref3[2];
@@ -1888,35 +1887,35 @@ function _extractPersonalInfoFromWorkflowData() {
1888
1887
 
1889
1888
  case 1:
1890
1889
  case "end":
1891
- return _context10.stop();
1890
+ return _context9.stop();
1892
1891
  }
1893
1892
  }
1894
- }, _callee10);
1893
+ }, _callee9);
1895
1894
  }));
1896
1895
  return _extractPersonalInfoFromWorkflowData.apply(this, arguments);
1897
1896
  }
1898
1897
 
1899
- function buildConsultSearchIndex(_x28, _x29, _x30) {
1898
+ function buildConsultSearchIndex(_x26, _x27, _x28) {
1900
1899
  return _buildConsultSearchIndex.apply(this, arguments);
1901
1900
  }
1902
1901
 
1903
1902
  function _buildConsultSearchIndex() {
1904
- _buildConsultSearchIndex = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(consult, workflow, oroClient) {
1903
+ _buildConsultSearchIndex = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(consult, workflow, oroClient) {
1905
1904
  var terms, _yield$extractPersona, personalInfoPopulatedWfData, childPersonalInfoPopulatedWfData, otherPersonalInfoPopulatedWfData, personalInfo, childPersonalInfo, otherPersonalInfo;
1906
1905
 
1907
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1906
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1908
1907
  while (1) {
1909
- switch (_context11.prev = _context11.next) {
1908
+ switch (_context10.prev = _context10.next) {
1910
1909
  case 0:
1911
1910
  terms = [{
1912
1911
  kind: 'consult-shortid',
1913
1912
  value: consult.shortId
1914
1913
  }];
1915
- _context11.next = 3;
1914
+ _context10.next = 3;
1916
1915
  return extractPersonalInfoFromWorkflowData(workflow);
1917
1916
 
1918
1917
  case 3:
1919
- _yield$extractPersona = _context11.sent;
1918
+ _yield$extractPersona = _context10.sent;
1920
1919
  personalInfoPopulatedWfData = _yield$extractPersona.personalInfoPopulatedWfData;
1921
1920
  childPersonalInfoPopulatedWfData = _yield$extractPersona.childPersonalInfoPopulatedWfData;
1922
1921
  otherPersonalInfoPopulatedWfData = _yield$extractPersona.otherPersonalInfoPopulatedWfData;
@@ -1951,15 +1950,15 @@ function _buildConsultSearchIndex() {
1951
1950
  });
1952
1951
  }
1953
1952
 
1954
- _context11.next = 15;
1953
+ _context10.next = 15;
1955
1954
  return oroClient.searchClient.index(consult.uuid, terms);
1956
1955
 
1957
1956
  case 15:
1958
1957
  case "end":
1959
- return _context11.stop();
1958
+ return _context10.stop();
1960
1959
  }
1961
1960
  }
1962
- }, _callee11);
1961
+ }, _callee10);
1963
1962
  }));
1964
1963
  return _buildConsultSearchIndex.apply(this, arguments);
1965
1964
  }
@@ -2012,6 +2011,200 @@ function decryptConsultLockboxGrants(encryptedConsultLockboxes, rsaKey) {
2012
2011
  });
2013
2012
  }
2014
2013
 
2014
+ var MAX_RETRIES$1 = 15;
2015
+ /**
2016
+ * Placeholder while the workflow interpreter for the refill flows is complete
2017
+ *
2018
+ * Creates a fake workflow in which the workflow data will reside
2019
+ *
2020
+ * @param isTreatmentWorking the value from the `is treatment working` question
2021
+ * @param hasSideEffects the value from the `does the treatment have side effects` question
2022
+ * @param deliveryAddress the provided delivery address
2023
+ * @param pharmacy
2024
+ * @returns a workflow
2025
+ */
2026
+
2027
+ function getRefillAnswersAsWorkflow(isTreatmentWorking, hasSideEffects, deliveryAddress, pharmacy) {
2028
+ var _ref, _ref2, _selectedAnswers$push, _selectedAnswers$push2;
2029
+
2030
+ var selectedAnswers = [(_ref = {}, _ref['isTreatmentWorking'] = isTreatmentWorking, _ref), (_ref2 = {}, _ref2['hasSideEffects'] = hasSideEffects, _ref2)];
2031
+ if (deliveryAddress) selectedAnswers.push((_selectedAnswers$push = {}, _selectedAnswers$push['deliveryAddress'] = deliveryAddress, _selectedAnswers$push));
2032
+ if (pharmacy) selectedAnswers.push((_selectedAnswers$push2 = {}, _selectedAnswers$push2['pharmacy'] = JSON.stringify(pharmacy), _selectedAnswers$push2));
2033
+ return {
2034
+ "id": "32573a20-6f1d-49be-9ad3-b87c58074979",
2035
+ "createdAt": "2022-10-03T00:00:00.000Z",
2036
+ "culDeSacs": [],
2037
+ "hidePlanRules": [],
2038
+ "pages": [{
2039
+ "title": "Prescription Refill",
2040
+ "groups": [{
2041
+ "type": "field-group",
2042
+ "fieldsAndGroups": [{
2043
+ "type": "field",
2044
+ "id": "isTreatmentWorking"
2045
+ }, {
2046
+ "type": "field",
2047
+ "id": "hasSideEffects"
2048
+ }, {
2049
+ "type": "field",
2050
+ "id": "youPharmacy"
2051
+ }, {
2052
+ "type": "field",
2053
+ "id": "youAddress"
2054
+ }]
2055
+ }],
2056
+ "questions": {
2057
+ "isTreatmentWorking": {
2058
+ "label": "Is the treatment working for you?",
2059
+ "kind": "radio",
2060
+ "inline": true,
2061
+ "inlineLabel": false,
2062
+ "metaCategory": MetadataCategory.Refill,
2063
+ "answers": {
2064
+ "73bec6eb-0310-4787-af3c-ac9c291737b2": {
2065
+ "text": "Yes"
2066
+ },
2067
+ "e193951f-986f-4db3-bede-903045a1804a": {
2068
+ "text": "No"
2069
+ }
2070
+ }
2071
+ },
2072
+ "hasSideEffects": {
2073
+ "label": "Are there any side effects",
2074
+ "kind": "radio",
2075
+ "inline": true,
2076
+ "inlineLabel": false,
2077
+ "metaCategory": MetadataCategory.Refill,
2078
+ "answers": {
2079
+ "1b87ad22-d316-4fac-9c7f-8f4ccb841aed": {
2080
+ "text": "Yes"
2081
+ },
2082
+ "ab7f5a41-c351-4f5d-a568-e38f9f200e9a": {
2083
+ "text": "No"
2084
+ }
2085
+ }
2086
+ },
2087
+ "youPharmacy": {
2088
+ "kind": "online-pharmacy-picker",
2089
+ "label": "Which pharmacy do you want the prescription sent to?",
2090
+ "metaCategory": MetadataCategory.Refill,
2091
+ "minorLabel": " (Optional)",
2092
+ "summaryLabel": "Your pharmacy"
2093
+ },
2094
+ "youAddress": {
2095
+ "kind": "place-address",
2096
+ "label": "Address",
2097
+ "metaCategory": MetadataCategory.Refill
2098
+ }
2099
+ }
2100
+ }],
2101
+ "locale": "en",
2102
+ selectedAnswers: selectedAnswers
2103
+ };
2104
+ }
2105
+ /**
2106
+ * Complete refill flow, creates a consult, stores refill data and updates consultation status
2107
+ * @param consultRequest
2108
+ * @param populatedRefillWorkflow the refill workflow data
2109
+ * @param oroClient
2110
+ */
2111
+
2112
+ function createRefill(_x, _x2, _x3) {
2113
+ return _createRefill.apply(this, arguments);
2114
+ }
2115
+
2116
+ function _createRefill() {
2117
+ _createRefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(consultRequest, populatedRefillWorkflow, oroClient) {
2118
+ var retry, errorsThrown, newConsult, lockboxUuid;
2119
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2120
+ while (1) {
2121
+ switch (_context.prev = _context.next) {
2122
+ case 0:
2123
+ retry = MAX_RETRIES$1;
2124
+ errorsThrown = [];
2125
+
2126
+ case 2:
2127
+ if (!(retry > 0)) {
2128
+ _context.next = 28;
2129
+ break;
2130
+ }
2131
+
2132
+ _context.prev = 3;
2133
+
2134
+ if (newConsult) {
2135
+ _context.next = 8;
2136
+ break;
2137
+ }
2138
+
2139
+ _context.next = 7;
2140
+ return getOrCreatePatientConsultationUuid(consultRequest, oroClient);
2141
+
2142
+ case 7:
2143
+ newConsult = _context.sent;
2144
+
2145
+ case 8:
2146
+ if (lockboxUuid) {
2147
+ _context.next = 12;
2148
+ break;
2149
+ }
2150
+
2151
+ _context.next = 11;
2152
+ return oroClient.getGrants();
2153
+
2154
+ case 11:
2155
+ lockboxUuid = _context.sent[0].lockboxUuid;
2156
+
2157
+ case 12:
2158
+ _context.next = 14;
2159
+ return oroClient.getOrInsertJsonData(lockboxUuid, populatedRefillWorkflow, {
2160
+ category: MetadataCategory.Refill,
2161
+ documentType: DocumentType.PopulatedWorkflowData,
2162
+ consultationIds: [newConsult.uuid]
2163
+ }, {})["catch"](function (err) {
2164
+ console.error('[SDK: prescription refill] Some errors happened during refill data upload', err);
2165
+ errorsThrown.push(err);
2166
+ });
2167
+
2168
+ case 14:
2169
+ if (!(errorsThrown.length > 0)) {
2170
+ _context.next = 16;
2171
+ break;
2172
+ }
2173
+
2174
+ throw errorsThrown;
2175
+
2176
+ case 16:
2177
+ _context.next = 18;
2178
+ return oroClient.consultClient.updateConsultByUUID(newConsult.uuid, {
2179
+ statusMedical: MedicalStatus.New
2180
+ });
2181
+
2182
+ case 18:
2183
+ _context.next = 25;
2184
+ break;
2185
+
2186
+ case 20:
2187
+ _context.prev = 20;
2188
+ _context.t0 = _context["catch"](3);
2189
+ console.error("[SDK] Error occured during refill: " + _context.t0 + ", retrying... Retries remaining: " + retry);
2190
+ errorsThrown = [];
2191
+ return _context.abrupt("continue", 25);
2192
+
2193
+ case 25:
2194
+ retry--;
2195
+ _context.next = 2;
2196
+ break;
2197
+
2198
+ case 28:
2199
+ case "end":
2200
+ return _context.stop();
2201
+ }
2202
+ }
2203
+ }, _callee, null, [[3, 20]]);
2204
+ }));
2205
+ return _createRefill.apply(this, arguments);
2206
+ }
2207
+
2015
2208
  /**
2016
2209
  * @name filterGrantsWithLockboxMetadata
2017
2210
  * @description searches for the existance of a consult uuid in each granted lockbox
@@ -2490,6 +2683,50 @@ var OroClient = /*#__PURE__*/function () {
2490
2683
 
2491
2684
  return registerPatient$1;
2492
2685
  }()
2686
+ /**
2687
+ * Creates and stores all relevant refill data
2688
+ * - New consultation is created
2689
+ * - Stores refill workflow data in the lockbox
2690
+ * - Updates the consult to new
2691
+ *
2692
+ * @param consult
2693
+ * @param populatedRefillWorkflow
2694
+ * @returns
2695
+ */
2696
+ ;
2697
+
2698
+ _proto.createRefill =
2699
+ /*#__PURE__*/
2700
+ function () {
2701
+ var _createRefill2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(consult, populatedRefillWorkflow) {
2702
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
2703
+ while (1) {
2704
+ switch (_context8.prev = _context8.next) {
2705
+ case 0:
2706
+ if (this.rsa) {
2707
+ _context8.next = 2;
2708
+ break;
2709
+ }
2710
+
2711
+ throw IncompleteAuthentication;
2712
+
2713
+ case 2:
2714
+ return _context8.abrupt("return", createRefill(consult, populatedRefillWorkflow, this));
2715
+
2716
+ case 3:
2717
+ case "end":
2718
+ return _context8.stop();
2719
+ }
2720
+ }
2721
+ }, _callee8, this);
2722
+ }));
2723
+
2724
+ function createRefill$1(_x19, _x20) {
2725
+ return _createRefill2.apply(this, arguments);
2726
+ }
2727
+
2728
+ return createRefill$1;
2729
+ }()
2493
2730
  /**
2494
2731
  * Fetches all grants, and consultations that exist in each lockbox
2495
2732
  * Then updates the index for the current user with the lockbox consult relationship
@@ -2499,28 +2736,28 @@ var OroClient = /*#__PURE__*/function () {
2499
2736
  _proto.forceUpdateIndexEntries =
2500
2737
  /*#__PURE__*/
2501
2738
  function () {
2502
- var _forceUpdateIndexEntries = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
2739
+ var _forceUpdateIndexEntries = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
2503
2740
  var _this = this,
2504
2741
  _this$vaultIndexAdd;
2505
2742
 
2506
2743
  var grants, indexConsultLockbox;
2507
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
2744
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
2508
2745
  while (1) {
2509
- switch (_context9.prev = _context9.next) {
2746
+ switch (_context10.prev = _context10.next) {
2510
2747
  case 0:
2511
- _context9.next = 2;
2748
+ _context10.next = 2;
2512
2749
  return this.getGrants();
2513
2750
 
2514
2751
  case 2:
2515
- grants = _context9.sent;
2516
- _context9.next = 5;
2752
+ grants = _context10.sent;
2753
+ _context10.next = 5;
2517
2754
  return Promise.all(grants.map( /*#__PURE__*/function () {
2518
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(grant) {
2519
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
2755
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(grant) {
2756
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
2520
2757
  while (1) {
2521
- switch (_context8.prev = _context8.next) {
2758
+ switch (_context9.prev = _context9.next) {
2522
2759
  case 0:
2523
- _context8.next = 2;
2760
+ _context9.next = 2;
2524
2761
  return _this.vaultClient.lockboxMetadataGet(grant.lockboxUuid, ['consultationId'], [], {
2525
2762
  category: MetadataCategory.Consultation
2526
2763
  }, grant.lockboxOwnerUuid).then(function (consults) {
@@ -2542,17 +2779,17 @@ var OroClient = /*#__PURE__*/function () {
2542
2779
  });
2543
2780
 
2544
2781
  case 2:
2545
- return _context8.abrupt("return", _context8.sent);
2782
+ return _context9.abrupt("return", _context9.sent);
2546
2783
 
2547
2784
  case 3:
2548
2785
  case "end":
2549
- return _context8.stop();
2786
+ return _context9.stop();
2550
2787
  }
2551
2788
  }
2552
- }, _callee8);
2789
+ }, _callee9);
2553
2790
  }));
2554
2791
 
2555
- return function (_x19) {
2792
+ return function (_x21) {
2556
2793
  return _ref2.apply(this, arguments);
2557
2794
  };
2558
2795
  }())).then(function (consults) {
@@ -2560,7 +2797,7 @@ var OroClient = /*#__PURE__*/function () {
2560
2797
  });
2561
2798
 
2562
2799
  case 5:
2563
- indexConsultLockbox = _context9.sent;
2800
+ indexConsultLockbox = _context10.sent;
2564
2801
  this.vaultIndexAdd((_this$vaultIndexAdd = {}, _this$vaultIndexAdd[IndexKey.Consultation] = indexConsultLockbox, _this$vaultIndexAdd)).then(function () {
2565
2802
  return alert('The Index was successfully updated!');
2566
2803
  })["catch"](function () {
@@ -2569,10 +2806,10 @@ var OroClient = /*#__PURE__*/function () {
2569
2806
 
2570
2807
  case 7:
2571
2808
  case "end":
2572
- return _context9.stop();
2809
+ return _context10.stop();
2573
2810
  }
2574
2811
  }
2575
- }, _callee9, this);
2812
+ }, _callee10, this);
2576
2813
  }));
2577
2814
 
2578
2815
  function forceUpdateIndexEntries() {
@@ -2592,15 +2829,15 @@ var OroClient = /*#__PURE__*/function () {
2592
2829
  _proto.vaultIndexAdd =
2593
2830
  /*#__PURE__*/
2594
2831
  function () {
2595
- var _vaultIndexAdd = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(entries, indexOwnerUuid) {
2832
+ var _vaultIndexAdd = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(entries, indexOwnerUuid) {
2596
2833
  var rsaPub, base64IndexOwnerPubKey, encryptedIndex, _i, _Object$keys, keyString, key;
2597
2834
 
2598
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
2835
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
2599
2836
  while (1) {
2600
- switch (_context10.prev = _context10.next) {
2837
+ switch (_context11.prev = _context11.next) {
2601
2838
  case 0:
2602
2839
  if (this.rsa) {
2603
- _context10.next = 2;
2840
+ _context11.next = 2;
2604
2841
  break;
2605
2842
  }
2606
2843
 
@@ -2608,17 +2845,17 @@ var OroClient = /*#__PURE__*/function () {
2608
2845
 
2609
2846
  case 2:
2610
2847
  if (!indexOwnerUuid) {
2611
- _context10.next = 9;
2848
+ _context11.next = 9;
2612
2849
  break;
2613
2850
  }
2614
2851
 
2615
- _context10.next = 5;
2852
+ _context11.next = 5;
2616
2853
  return this.guardClient.identityGet(indexOwnerUuid);
2617
2854
 
2618
2855
  case 5:
2619
- base64IndexOwnerPubKey = _context10.sent.publicKey;
2856
+ base64IndexOwnerPubKey = _context11.sent.publicKey;
2620
2857
  rsaPub = this.toolbox.decodeFromBase64(base64IndexOwnerPubKey);
2621
- _context10.next = 10;
2858
+ _context11.next = 10;
2622
2859
  break;
2623
2860
 
2624
2861
  case 9:
@@ -2630,14 +2867,14 @@ var OroClient = /*#__PURE__*/function () {
2630
2867
 
2631
2868
  case 12:
2632
2869
  if (!(_i < _Object$keys.length)) {
2633
- _context10.next = 23;
2870
+ _context11.next = 23;
2634
2871
  break;
2635
2872
  }
2636
2873
 
2637
2874
  keyString = _Object$keys[_i];
2638
2875
  key = keyString;
2639
- _context10.t0 = key;
2640
- _context10.next = _context10.t0 === IndexKey.ConsultationLockbox ? 18 : 20;
2876
+ _context11.t0 = key;
2877
+ _context11.next = _context11.t0 === IndexKey.ConsultationLockbox ? 18 : 20;
2641
2878
  break;
2642
2879
 
2643
2880
  case 18:
@@ -2656,26 +2893,26 @@ var OroClient = /*#__PURE__*/function () {
2656
2893
  }, rsaPub)
2657
2894
  };
2658
2895
  });
2659
- return _context10.abrupt("break", 20);
2896
+ return _context11.abrupt("break", 20);
2660
2897
 
2661
2898
  case 20:
2662
2899
  _i++;
2663
- _context10.next = 12;
2900
+ _context11.next = 12;
2664
2901
  break;
2665
2902
 
2666
2903
  case 23:
2667
- _context10.next = 25;
2904
+ _context11.next = 25;
2668
2905
  return this.vaultClient.vaultIndexPut(encryptedIndex, indexOwnerUuid);
2669
2906
 
2670
2907
  case 25:
2671
2908
  case "end":
2672
- return _context10.stop();
2909
+ return _context11.stop();
2673
2910
  }
2674
2911
  }
2675
- }, _callee10, this);
2912
+ }, _callee11, this);
2676
2913
  }));
2677
2914
 
2678
- function vaultIndexAdd(_x20, _x21) {
2915
+ function vaultIndexAdd(_x22, _x23) {
2679
2916
  return _vaultIndexAdd.apply(this, arguments);
2680
2917
  }
2681
2918
 
@@ -2693,48 +2930,48 @@ var OroClient = /*#__PURE__*/function () {
2693
2930
  _proto.grantLockbox =
2694
2931
  /*#__PURE__*/
2695
2932
  function () {
2696
- var _grantLockbox = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(granteeUuid, lockboxUuid, lockboxOwnerUuid) {
2933
+ var _grantLockbox = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(granteeUuid, lockboxUuid, lockboxOwnerUuid) {
2697
2934
  var secret, base64GranteePublicKey, granteePublicKey, granteeEncryptedSecret, request;
2698
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
2935
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
2699
2936
  while (1) {
2700
- switch (_context11.prev = _context11.next) {
2937
+ switch (_context12.prev = _context12.next) {
2701
2938
  case 0:
2702
2939
  if (this.rsa) {
2703
- _context11.next = 2;
2940
+ _context12.next = 2;
2704
2941
  break;
2705
2942
  }
2706
2943
 
2707
2944
  throw IncompleteAuthentication;
2708
2945
 
2709
2946
  case 2:
2710
- _context11.next = 4;
2947
+ _context12.next = 4;
2711
2948
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
2712
2949
 
2713
2950
  case 4:
2714
- secret = _context11.sent.key();
2715
- _context11.next = 7;
2951
+ secret = _context12.sent.key();
2952
+ _context12.next = 7;
2716
2953
  return this.guardClient.identityGet(granteeUuid);
2717
2954
 
2718
2955
  case 7:
2719
- base64GranteePublicKey = _context11.sent.publicKey;
2956
+ base64GranteePublicKey = _context12.sent.publicKey;
2720
2957
  granteePublicKey = this.toolbox.decodeFromBase64(base64GranteePublicKey);
2721
2958
  granteeEncryptedSecret = CryptoRSA.bytesWithPubEncryptToBase64(secret, granteePublicKey);
2722
2959
  request = {
2723
2960
  encryptedSecret: granteeEncryptedSecret,
2724
2961
  granteeUuid: granteeUuid
2725
2962
  };
2726
- _context11.next = 13;
2963
+ _context12.next = 13;
2727
2964
  return this.vaultClient.lockboxGrant(lockboxUuid, request, lockboxOwnerUuid);
2728
2965
 
2729
2966
  case 13:
2730
2967
  case "end":
2731
- return _context11.stop();
2968
+ return _context12.stop();
2732
2969
  }
2733
2970
  }
2734
- }, _callee11, this);
2971
+ }, _callee12, this);
2735
2972
  }));
2736
2973
 
2737
- function grantLockbox(_x22, _x23, _x24) {
2974
+ function grantLockbox(_x24, _x25, _x26) {
2738
2975
  return _grantLockbox.apply(this, arguments);
2739
2976
  }
2740
2977
 
@@ -2755,36 +2992,36 @@ var OroClient = /*#__PURE__*/function () {
2755
2992
  _proto.createMessageData =
2756
2993
  /*#__PURE__*/
2757
2994
  function () {
2758
- var _createMessageData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(lockboxUuid, message, consultationId, lockboxOwnerUuid, previousDataUuid) {
2995
+ var _createMessageData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(lockboxUuid, message, consultationId, lockboxOwnerUuid, previousDataUuid) {
2759
2996
  var symmetricEncryptor, encryptedData, encryptedPrivateMeta, meta, request;
2760
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
2997
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2761
2998
  while (1) {
2762
- switch (_context12.prev = _context12.next) {
2999
+ switch (_context13.prev = _context13.next) {
2763
3000
  case 0:
2764
3001
  if (this.rsa) {
2765
- _context12.next = 2;
3002
+ _context13.next = 2;
2766
3003
  break;
2767
3004
  }
2768
3005
 
2769
3006
  throw IncompleteAuthentication;
2770
3007
 
2771
3008
  case 2:
2772
- _context12.next = 4;
3009
+ _context13.next = 4;
2773
3010
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
2774
3011
 
2775
3012
  case 4:
2776
- symmetricEncryptor = _context12.sent;
3013
+ symmetricEncryptor = _context13.sent;
2777
3014
  encryptedData = symmetricEncryptor.jsonEncryptToBase64Payload(message);
2778
- _context12.t0 = symmetricEncryptor;
2779
- _context12.next = 9;
3015
+ _context13.t0 = symmetricEncryptor;
3016
+ _context13.next = 9;
2780
3017
  return this.guardClient.whoAmI();
2781
3018
 
2782
3019
  case 9:
2783
- _context12.t1 = _context12.sent.sub;
2784
- _context12.t2 = {
2785
- author: _context12.t1
3020
+ _context13.t1 = _context13.sent.sub;
3021
+ _context13.t2 = {
3022
+ author: _context13.t1
2786
3023
  };
2787
- encryptedPrivateMeta = _context12.t0.jsonEncryptToBase64Payload.call(_context12.t0, _context12.t2);
3024
+ encryptedPrivateMeta = _context13.t0.jsonEncryptToBase64Payload.call(_context13.t0, _context13.t2);
2788
3025
  meta = {
2789
3026
  consultationId: consultationId,
2790
3027
  category: MetadataCategory.Consultation,
@@ -2796,17 +3033,17 @@ var OroClient = /*#__PURE__*/function () {
2796
3033
  publicMetadata: meta,
2797
3034
  privateMetadata: encryptedPrivateMeta
2798
3035
  };
2799
- return _context12.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3036
+ return _context13.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
2800
3037
 
2801
3038
  case 15:
2802
3039
  case "end":
2803
- return _context12.stop();
3040
+ return _context13.stop();
2804
3041
  }
2805
3042
  }
2806
- }, _callee12, this);
3043
+ }, _callee13, this);
2807
3044
  }));
2808
3045
 
2809
- function createMessageData(_x25, _x26, _x27, _x28, _x29) {
3046
+ function createMessageData(_x27, _x28, _x29, _x30, _x31) {
2810
3047
  return _createMessageData.apply(this, arguments);
2811
3048
  }
2812
3049
 
@@ -2827,50 +3064,50 @@ var OroClient = /*#__PURE__*/function () {
2827
3064
  _proto.createMessageAttachmentData =
2828
3065
  /*#__PURE__*/
2829
3066
  function () {
2830
- var _createMessageAttachmentData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(lockboxUuid, data, consultationId, lockboxOwnerUuid, previousDataUuid) {
3067
+ var _createMessageAttachmentData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(lockboxUuid, data, consultationId, lockboxOwnerUuid, previousDataUuid) {
2831
3068
  var symmetricEncryptor, encryptedData, encryptedPrivateMeta, meta, request;
2832
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
3069
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2833
3070
  while (1) {
2834
- switch (_context13.prev = _context13.next) {
3071
+ switch (_context14.prev = _context14.next) {
2835
3072
  case 0:
2836
3073
  if (this.rsa) {
2837
- _context13.next = 2;
3074
+ _context14.next = 2;
2838
3075
  break;
2839
3076
  }
2840
3077
 
2841
3078
  throw IncompleteAuthentication;
2842
3079
 
2843
3080
  case 2:
2844
- _context13.next = 4;
3081
+ _context14.next = 4;
2845
3082
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
2846
3083
 
2847
3084
  case 4:
2848
- symmetricEncryptor = _context13.sent;
2849
- _context13.t0 = symmetricEncryptor;
2850
- _context13.t1 = Uint8Array;
2851
- _context13.next = 9;
3085
+ symmetricEncryptor = _context14.sent;
3086
+ _context14.t0 = symmetricEncryptor;
3087
+ _context14.t1 = Uint8Array;
3088
+ _context14.next = 9;
2852
3089
  return data.arrayBuffer();
2853
3090
 
2854
3091
  case 9:
2855
- _context13.t2 = _context13.sent;
2856
- _context13.t3 = new _context13.t1(_context13.t2);
2857
- encryptedData = _context13.t0.bytesEncryptToBase64Payload.call(_context13.t0, _context13.t3);
2858
- _context13.t4 = symmetricEncryptor;
2859
- _context13.next = 15;
3092
+ _context14.t2 = _context14.sent;
3093
+ _context14.t3 = new _context14.t1(_context14.t2);
3094
+ encryptedData = _context14.t0.bytesEncryptToBase64Payload.call(_context14.t0, _context14.t3);
3095
+ _context14.t4 = symmetricEncryptor;
3096
+ _context14.next = 15;
2860
3097
  return this.guardClient.whoAmI();
2861
3098
 
2862
3099
  case 15:
2863
- _context13.t5 = _context13.sent.sub;
2864
- _context13.t6 = data.name;
2865
- _context13.t7 = data.lastModified;
2866
- _context13.t8 = data.size;
2867
- _context13.t9 = {
2868
- author: _context13.t5,
2869
- fileName: _context13.t6,
2870
- lastModified: _context13.t7,
2871
- size: _context13.t8
3100
+ _context14.t5 = _context14.sent.sub;
3101
+ _context14.t6 = data.name;
3102
+ _context14.t7 = data.lastModified;
3103
+ _context14.t8 = data.size;
3104
+ _context14.t9 = {
3105
+ author: _context14.t5,
3106
+ fileName: _context14.t6,
3107
+ lastModified: _context14.t7,
3108
+ size: _context14.t8
2872
3109
  };
2873
- encryptedPrivateMeta = _context13.t4.jsonEncryptToBase64Payload.call(_context13.t4, _context13.t9);
3110
+ encryptedPrivateMeta = _context14.t4.jsonEncryptToBase64Payload.call(_context14.t4, _context14.t9);
2874
3111
  meta = {
2875
3112
  consultationId: consultationId,
2876
3113
  category: MetadataCategory.Consultation,
@@ -2882,17 +3119,17 @@ var OroClient = /*#__PURE__*/function () {
2882
3119
  publicMetadata: meta,
2883
3120
  privateMetadata: encryptedPrivateMeta
2884
3121
  };
2885
- return _context13.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3122
+ return _context14.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
2886
3123
 
2887
3124
  case 24:
2888
3125
  case "end":
2889
- return _context13.stop();
3126
+ return _context14.stop();
2890
3127
  }
2891
3128
  }
2892
- }, _callee13, this);
3129
+ }, _callee14, this);
2893
3130
  }));
2894
3131
 
2895
- function createMessageAttachmentData(_x30, _x31, _x32, _x33, _x34) {
3132
+ function createMessageAttachmentData(_x32, _x33, _x34, _x35, _x36) {
2896
3133
  return _createMessageAttachmentData.apply(this, arguments);
2897
3134
  }
2898
3135
 
@@ -2915,62 +3152,62 @@ var OroClient = /*#__PURE__*/function () {
2915
3152
  _proto.createConsultationAttachmentData =
2916
3153
  /*#__PURE__*/
2917
3154
  function () {
2918
- var _createConsultationAttachmentData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(lockboxUuid, data, consultationId, documentType, lockboxOwnerUuid, previousDataUuid, withNotification) {
2919
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
3155
+ var _createConsultationAttachmentData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(lockboxUuid, data, consultationId, documentType, lockboxOwnerUuid, previousDataUuid, withNotification) {
3156
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2920
3157
  while (1) {
2921
- switch (_context14.prev = _context14.next) {
3158
+ switch (_context15.prev = _context15.next) {
2922
3159
  case 0:
2923
3160
  if (withNotification === void 0) {
2924
3161
  withNotification = false;
2925
3162
  }
2926
3163
 
2927
3164
  if (this.rsa) {
2928
- _context14.next = 3;
3165
+ _context15.next = 3;
2929
3166
  break;
2930
3167
  }
2931
3168
 
2932
3169
  throw IncompleteAuthentication;
2933
3170
 
2934
3171
  case 3:
2935
- _context14.t0 = this;
2936
- _context14.t1 = lockboxUuid;
2937
- _context14.t2 = Uint8Array;
2938
- _context14.next = 8;
3172
+ _context15.t0 = this;
3173
+ _context15.t1 = lockboxUuid;
3174
+ _context15.t2 = Uint8Array;
3175
+ _context15.next = 8;
2939
3176
  return data.arrayBuffer();
2940
3177
 
2941
3178
  case 8:
2942
- _context14.t3 = _context14.sent;
2943
- _context14.t4 = new _context14.t2(_context14.t3);
2944
- _context14.t5 = {
3179
+ _context15.t3 = _context15.sent;
3180
+ _context15.t4 = new _context15.t2(_context15.t3);
3181
+ _context15.t5 = {
2945
3182
  consultationId: consultationId,
2946
3183
  category: MetadataCategory.Consultation,
2947
3184
  documentType: documentType,
2948
3185
  contentType: data.type
2949
3186
  };
2950
- _context14.next = 13;
3187
+ _context15.next = 13;
2951
3188
  return this.guardClient.whoAmI();
2952
3189
 
2953
3190
  case 13:
2954
- _context14.t6 = _context14.sent.sub;
2955
- _context14.t7 = data.name;
2956
- _context14.t8 = {
2957
- author: _context14.t6,
2958
- fileName: _context14.t7
3191
+ _context15.t6 = _context15.sent.sub;
3192
+ _context15.t7 = data.name;
3193
+ _context15.t8 = {
3194
+ author: _context15.t6,
3195
+ fileName: _context15.t7
2959
3196
  };
2960
- _context14.t9 = lockboxOwnerUuid;
2961
- _context14.t10 = previousDataUuid;
2962
- _context14.t11 = withNotification;
2963
- return _context14.abrupt("return", _context14.t0.createBytesData.call(_context14.t0, _context14.t1, _context14.t4, _context14.t5, _context14.t8, _context14.t9, _context14.t10, _context14.t11));
3197
+ _context15.t9 = lockboxOwnerUuid;
3198
+ _context15.t10 = previousDataUuid;
3199
+ _context15.t11 = withNotification;
3200
+ return _context15.abrupt("return", _context15.t0.createBytesData.call(_context15.t0, _context15.t1, _context15.t4, _context15.t5, _context15.t8, _context15.t9, _context15.t10, _context15.t11));
2964
3201
 
2965
3202
  case 20:
2966
3203
  case "end":
2967
- return _context14.stop();
3204
+ return _context15.stop();
2968
3205
  }
2969
3206
  }
2970
- }, _callee14, this);
3207
+ }, _callee15, this);
2971
3208
  }));
2972
3209
 
2973
- function createConsultationAttachmentData(_x35, _x36, _x37, _x38, _x39, _x40, _x41) {
3210
+ function createConsultationAttachmentData(_x37, _x38, _x39, _x40, _x41, _x42, _x43) {
2974
3211
  return _createConsultationAttachmentData.apply(this, arguments);
2975
3212
  }
2976
3213
 
@@ -2993,29 +3230,29 @@ var OroClient = /*#__PURE__*/function () {
2993
3230
  _proto.createJsonData =
2994
3231
  /*#__PURE__*/
2995
3232
  function () {
2996
- var _createJsonData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(lockboxUuid, data, meta, privateMeta, lockboxOwnerUuid, previousDataUuid, withNotification) {
3233
+ var _createJsonData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(lockboxUuid, data, meta, privateMeta, lockboxOwnerUuid, previousDataUuid, withNotification) {
2997
3234
  var symmetricEncryptor, encryptedData, encryptedPrivateMeta, request;
2998
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
3235
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2999
3236
  while (1) {
3000
- switch (_context15.prev = _context15.next) {
3237
+ switch (_context16.prev = _context16.next) {
3001
3238
  case 0:
3002
3239
  if (withNotification === void 0) {
3003
3240
  withNotification = false;
3004
3241
  }
3005
3242
 
3006
3243
  if (this.rsa) {
3007
- _context15.next = 3;
3244
+ _context16.next = 3;
3008
3245
  break;
3009
3246
  }
3010
3247
 
3011
3248
  throw IncompleteAuthentication;
3012
3249
 
3013
3250
  case 3:
3014
- _context15.next = 5;
3251
+ _context16.next = 5;
3015
3252
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
3016
3253
 
3017
3254
  case 5:
3018
- symmetricEncryptor = _context15.sent;
3255
+ symmetricEncryptor = _context16.sent;
3019
3256
  encryptedData = symmetricEncryptor.jsonEncryptToBase64Payload(data);
3020
3257
  encryptedPrivateMeta = symmetricEncryptor.jsonEncryptToBase64Payload(privateMeta);
3021
3258
  request = {
@@ -3025,24 +3262,24 @@ var OroClient = /*#__PURE__*/function () {
3025
3262
  };
3026
3263
 
3027
3264
  if (!withNotification) {
3028
- _context15.next = 13;
3265
+ _context16.next = 13;
3029
3266
  break;
3030
3267
  }
3031
3268
 
3032
- return _context15.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3269
+ return _context16.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3033
3270
 
3034
3271
  case 13:
3035
- return _context15.abrupt("return", this.vaultClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3272
+ return _context16.abrupt("return", this.vaultClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3036
3273
 
3037
3274
  case 14:
3038
3275
  case "end":
3039
- return _context15.stop();
3276
+ return _context16.stop();
3040
3277
  }
3041
3278
  }
3042
- }, _callee15, this);
3279
+ }, _callee16, this);
3043
3280
  }));
3044
3281
 
3045
- function createJsonData(_x42, _x43, _x44, _x45, _x46, _x47, _x48) {
3282
+ function createJsonData(_x44, _x45, _x46, _x47, _x48, _x49, _x50) {
3046
3283
  return _createJsonData.apply(this, arguments);
3047
3284
  }
3048
3285
 
@@ -3063,11 +3300,11 @@ var OroClient = /*#__PURE__*/function () {
3063
3300
  _proto.getOrInsertJsonData =
3064
3301
  /*#__PURE__*/
3065
3302
  function () {
3066
- var _getOrInsertJsonData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(lockboxUuid, data, publicMetadata, privateMetadata, forceReplace, withNotification) {
3303
+ var _getOrInsertJsonData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(lockboxUuid, data, publicMetadata, privateMetadata, forceReplace, withNotification) {
3067
3304
  var manifest;
3068
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
3305
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3069
3306
  while (1) {
3070
- switch (_context16.prev = _context16.next) {
3307
+ switch (_context17.prev = _context17.next) {
3071
3308
  case 0:
3072
3309
  if (forceReplace === void 0) {
3073
3310
  forceReplace = false;
@@ -3077,22 +3314,22 @@ var OroClient = /*#__PURE__*/function () {
3077
3314
  withNotification = false;
3078
3315
  }
3079
3316
 
3080
- _context16.next = 4;
3317
+ _context17.next = 4;
3081
3318
  return this.vaultClient.lockboxManifestGet(lockboxUuid, publicMetadata);
3082
3319
 
3083
3320
  case 4:
3084
- manifest = _context16.sent;
3321
+ manifest = _context17.sent;
3085
3322
 
3086
3323
  if (!(!forceReplace && manifest.length > 0)) {
3087
- _context16.next = 10;
3324
+ _context17.next = 10;
3088
3325
  break;
3089
3326
  }
3090
3327
 
3091
3328
  console.log("The data for " + JSON.stringify(publicMetadata) + " already exist");
3092
- return _context16.abrupt("return", manifest[0].dataUuid);
3329
+ return _context17.abrupt("return", manifest[0].dataUuid);
3093
3330
 
3094
3331
  case 10:
3095
- _context16.next = 12;
3332
+ _context17.next = 12;
3096
3333
  return this.createJsonData(lockboxUuid, data, publicMetadata, privateMetadata, undefined, forceReplace && manifest.length > 0 ? manifest[0].dataUuid : undefined, // if forceReplace and data already exist, then replace data. Otherwise insert it
3097
3334
  withNotification)["catch"](function (err) {
3098
3335
  console.error("Error while upserting data " + JSON.stringify(publicMetadata) + " data", err);
@@ -3100,17 +3337,17 @@ var OroClient = /*#__PURE__*/function () {
3100
3337
  });
3101
3338
 
3102
3339
  case 12:
3103
- return _context16.abrupt("return", _context16.sent.dataUuid);
3340
+ return _context17.abrupt("return", _context17.sent.dataUuid);
3104
3341
 
3105
3342
  case 13:
3106
3343
  case "end":
3107
- return _context16.stop();
3344
+ return _context17.stop();
3108
3345
  }
3109
3346
  }
3110
- }, _callee16, this);
3347
+ }, _callee17, this);
3111
3348
  }));
3112
3349
 
3113
- function getOrInsertJsonData(_x49, _x50, _x51, _x52, _x53, _x54) {
3350
+ function getOrInsertJsonData(_x51, _x52, _x53, _x54, _x55, _x56) {
3114
3351
  return _getOrInsertJsonData.apply(this, arguments);
3115
3352
  }
3116
3353
 
@@ -3133,29 +3370,29 @@ var OroClient = /*#__PURE__*/function () {
3133
3370
  _proto.createBytesData =
3134
3371
  /*#__PURE__*/
3135
3372
  function () {
3136
- var _createBytesData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(lockboxUuid, data, meta, privateMeta, lockboxOwnerUuid, previousDataUuid, withNotification) {
3373
+ var _createBytesData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(lockboxUuid, data, meta, privateMeta, lockboxOwnerUuid, previousDataUuid, withNotification) {
3137
3374
  var symmetricEncryptor, encryptedData, encryptedPrivateMeta, request;
3138
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3375
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3139
3376
  while (1) {
3140
- switch (_context17.prev = _context17.next) {
3377
+ switch (_context18.prev = _context18.next) {
3141
3378
  case 0:
3142
3379
  if (withNotification === void 0) {
3143
3380
  withNotification = false;
3144
3381
  }
3145
3382
 
3146
3383
  if (this.rsa) {
3147
- _context17.next = 3;
3384
+ _context18.next = 3;
3148
3385
  break;
3149
3386
  }
3150
3387
 
3151
3388
  throw IncompleteAuthentication;
3152
3389
 
3153
3390
  case 3:
3154
- _context17.next = 5;
3391
+ _context18.next = 5;
3155
3392
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
3156
3393
 
3157
3394
  case 5:
3158
- symmetricEncryptor = _context17.sent;
3395
+ symmetricEncryptor = _context18.sent;
3159
3396
  encryptedData = symmetricEncryptor.bytesEncryptToBase64Payload(data);
3160
3397
  encryptedPrivateMeta = symmetricEncryptor.jsonEncryptToBase64Payload(privateMeta);
3161
3398
  request = {
@@ -3165,24 +3402,24 @@ var OroClient = /*#__PURE__*/function () {
3165
3402
  };
3166
3403
 
3167
3404
  if (!withNotification) {
3168
- _context17.next = 13;
3405
+ _context18.next = 13;
3169
3406
  break;
3170
3407
  }
3171
3408
 
3172
- return _context17.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3409
+ return _context18.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3173
3410
 
3174
3411
  case 13:
3175
- return _context17.abrupt("return", this.vaultClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3412
+ return _context18.abrupt("return", this.vaultClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3176
3413
 
3177
3414
  case 14:
3178
3415
  case "end":
3179
- return _context17.stop();
3416
+ return _context18.stop();
3180
3417
  }
3181
3418
  }
3182
- }, _callee17, this);
3419
+ }, _callee18, this);
3183
3420
  }));
3184
3421
 
3185
- function createBytesData(_x55, _x56, _x57, _x58, _x59, _x60, _x61) {
3422
+ function createBytesData(_x57, _x58, _x59, _x60, _x61, _x62, _x63) {
3186
3423
  return _createBytesData.apply(this, arguments);
3187
3424
  }
3188
3425
 
@@ -3204,39 +3441,39 @@ var OroClient = /*#__PURE__*/function () {
3204
3441
  _proto.getJsonData =
3205
3442
  /*#__PURE__*/
3206
3443
  function () {
3207
- var _getJsonData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(lockboxUuid, dataUuid, lockboxOwnerUuid) {
3444
+ var _getJsonData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(lockboxUuid, dataUuid, lockboxOwnerUuid) {
3208
3445
  var _yield$Promise$all, encryptedPayload, symmetricDecryptor;
3209
3446
 
3210
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3447
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3211
3448
  while (1) {
3212
- switch (_context18.prev = _context18.next) {
3449
+ switch (_context19.prev = _context19.next) {
3213
3450
  case 0:
3214
3451
  if (this.rsa) {
3215
- _context18.next = 2;
3452
+ _context19.next = 2;
3216
3453
  break;
3217
3454
  }
3218
3455
 
3219
3456
  throw IncompleteAuthentication;
3220
3457
 
3221
3458
  case 2:
3222
- _context18.next = 4;
3459
+ _context19.next = 4;
3223
3460
  return Promise.all([this.vaultClient.lockboxDataGet(lockboxUuid, dataUuid, lockboxOwnerUuid), this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid)]);
3224
3461
 
3225
3462
  case 4:
3226
- _yield$Promise$all = _context18.sent;
3463
+ _yield$Promise$all = _context19.sent;
3227
3464
  encryptedPayload = _yield$Promise$all[0];
3228
3465
  symmetricDecryptor = _yield$Promise$all[1];
3229
- return _context18.abrupt("return", symmetricDecryptor.base64PayloadDecryptToJson(encryptedPayload.data));
3466
+ return _context19.abrupt("return", symmetricDecryptor.base64PayloadDecryptToJson(encryptedPayload.data));
3230
3467
 
3231
3468
  case 8:
3232
3469
  case "end":
3233
- return _context18.stop();
3470
+ return _context19.stop();
3234
3471
  }
3235
3472
  }
3236
- }, _callee18, this);
3473
+ }, _callee19, this);
3237
3474
  }));
3238
3475
 
3239
- function getJsonData(_x62, _x63, _x64) {
3476
+ function getJsonData(_x64, _x65, _x66) {
3240
3477
  return _getJsonData.apply(this, arguments);
3241
3478
  }
3242
3479
 
@@ -3254,39 +3491,39 @@ var OroClient = /*#__PURE__*/function () {
3254
3491
  _proto.getBytesData =
3255
3492
  /*#__PURE__*/
3256
3493
  function () {
3257
- var _getBytesData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(lockboxUuid, dataUuid, lockboxOwnerUuid) {
3494
+ var _getBytesData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(lockboxUuid, dataUuid, lockboxOwnerUuid) {
3258
3495
  var _yield$Promise$all2, encryptedPayload, symmetricDecryptor;
3259
3496
 
3260
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3497
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3261
3498
  while (1) {
3262
- switch (_context19.prev = _context19.next) {
3499
+ switch (_context20.prev = _context20.next) {
3263
3500
  case 0:
3264
3501
  if (this.rsa) {
3265
- _context19.next = 2;
3502
+ _context20.next = 2;
3266
3503
  break;
3267
3504
  }
3268
3505
 
3269
3506
  throw IncompleteAuthentication;
3270
3507
 
3271
3508
  case 2:
3272
- _context19.next = 4;
3509
+ _context20.next = 4;
3273
3510
  return Promise.all([this.vaultClient.lockboxDataGet(lockboxUuid, dataUuid, lockboxOwnerUuid), this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid)]);
3274
3511
 
3275
3512
  case 4:
3276
- _yield$Promise$all2 = _context19.sent;
3513
+ _yield$Promise$all2 = _context20.sent;
3277
3514
  encryptedPayload = _yield$Promise$all2[0];
3278
3515
  symmetricDecryptor = _yield$Promise$all2[1];
3279
- return _context19.abrupt("return", symmetricDecryptor.base64PayloadDecryptToBytes(encryptedPayload.data));
3516
+ return _context20.abrupt("return", symmetricDecryptor.base64PayloadDecryptToBytes(encryptedPayload.data));
3280
3517
 
3281
3518
  case 8:
3282
3519
  case "end":
3283
- return _context19.stop();
3520
+ return _context20.stop();
3284
3521
  }
3285
3522
  }
3286
- }, _callee19, this);
3523
+ }, _callee20, this);
3287
3524
  }));
3288
3525
 
3289
- function getBytesData(_x65, _x66, _x67) {
3526
+ function getBytesData(_x67, _x68, _x69) {
3290
3527
  return _getBytesData.apply(this, arguments);
3291
3528
  }
3292
3529
 
@@ -3307,14 +3544,14 @@ var OroClient = /*#__PURE__*/function () {
3307
3544
  _proto.getGrants =
3308
3545
  /*#__PURE__*/
3309
3546
  function () {
3310
- var _getGrants = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(filter) {
3547
+ var _getGrants = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(filter) {
3311
3548
  var filterString, currentAccountRole, encryptedGrants, decryptedGrants, grantsByConsultLockbox, decryptedConsults;
3312
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3549
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
3313
3550
  while (1) {
3314
- switch (_context20.prev = _context20.next) {
3551
+ switch (_context21.prev = _context21.next) {
3315
3552
  case 0:
3316
3553
  if (this.rsa) {
3317
- _context20.next = 2;
3554
+ _context21.next = 2;
3318
3555
  break;
3319
3556
  }
3320
3557
 
@@ -3324,75 +3561,75 @@ var OroClient = /*#__PURE__*/function () {
3324
3561
  filterString = JSON.stringify(filter); // retrieves cached grants
3325
3562
 
3326
3563
  if (!this.cachedMetadataGrants[filterString]) {
3327
- _context20.next = 5;
3564
+ _context21.next = 5;
3328
3565
  break;
3329
3566
  }
3330
3567
 
3331
- return _context20.abrupt("return", this.cachedMetadataGrants[filterString]);
3568
+ return _context21.abrupt("return", this.cachedMetadataGrants[filterString]);
3332
3569
 
3333
3570
  case 5:
3334
- _context20.next = 7;
3571
+ _context21.next = 7;
3335
3572
  return this.getAccountRole();
3336
3573
 
3337
3574
  case 7:
3338
- currentAccountRole = _context20.sent;
3575
+ currentAccountRole = _context21.sent;
3339
3576
 
3340
3577
  if (!(currentAccountRole.length === 1 && currentAccountRole[0] === OtherRoleType.User)) {
3341
- _context20.next = 10;
3578
+ _context21.next = 10;
3342
3579
  break;
3343
3580
  }
3344
3581
 
3345
- return _context20.abrupt("return", []);
3582
+ return _context21.abrupt("return", []);
3346
3583
 
3347
3584
  case 10:
3348
3585
  if (![OtherRoleType.Patient, OtherRoleType.User].every(function (requiredRole) {
3349
3586
  return currentAccountRole.includes(requiredRole);
3350
3587
  })) {
3351
- _context20.next = 26;
3588
+ _context21.next = 26;
3352
3589
  break;
3353
3590
  }
3354
3591
 
3355
3592
  if (!filter) {
3356
- _context20.next = 17;
3593
+ _context21.next = 17;
3357
3594
  break;
3358
3595
  }
3359
3596
 
3360
- _context20.next = 14;
3597
+ _context21.next = 14;
3361
3598
  return filterGrantsWithLockboxMetadata(this, filter);
3362
3599
 
3363
3600
  case 14:
3364
- encryptedGrants = _context20.sent;
3365
- _context20.next = 20;
3601
+ encryptedGrants = _context21.sent;
3602
+ _context21.next = 20;
3366
3603
  break;
3367
3604
 
3368
3605
  case 17:
3369
- _context20.next = 19;
3606
+ _context21.next = 19;
3370
3607
  return this.vaultClient.grantsGet();
3371
3608
 
3372
3609
  case 19:
3373
- encryptedGrants = _context20.sent.grants;
3610
+ encryptedGrants = _context21.sent.grants;
3374
3611
 
3375
3612
  case 20:
3376
- _context20.next = 22;
3613
+ _context21.next = 22;
3377
3614
  return decryptGrants(encryptedGrants, this.rsa);
3378
3615
 
3379
3616
  case 22:
3380
- decryptedGrants = _context20.sent;
3617
+ decryptedGrants = _context21.sent;
3381
3618
  // sets the cached grant
3382
3619
  this.cachedMetadataGrants[filterString] = decryptedGrants;
3383
3620
  console.info('[sdk:grant] Found grant for patient');
3384
- return _context20.abrupt("return", decryptedGrants);
3621
+ return _context21.abrupt("return", decryptedGrants);
3385
3622
 
3386
3623
  case 26:
3387
3624
  if (filter) {
3388
- _context20.next = 28;
3625
+ _context21.next = 28;
3389
3626
  break;
3390
3627
  }
3391
3628
 
3392
3629
  throw MissingGrantFilter;
3393
3630
 
3394
3631
  case 28:
3395
- _context20.next = 30;
3632
+ _context21.next = 30;
3396
3633
  return this.vaultClient.vaultIndexGet([IndexKey.ConsultationLockbox], [filter.consultationId]).then(function (res) {
3397
3634
  return res[IndexKey.ConsultationLockbox];
3398
3635
  })["catch"](function (e) {
@@ -3401,30 +3638,30 @@ var OroClient = /*#__PURE__*/function () {
3401
3638
  });
3402
3639
 
3403
3640
  case 30:
3404
- grantsByConsultLockbox = _context20.sent;
3641
+ grantsByConsultLockbox = _context21.sent;
3405
3642
  decryptedConsults = decryptConsultLockboxGrants(grantsByConsultLockbox != null ? grantsByConsultLockbox : [], this.rsa);
3406
3643
 
3407
3644
  if (!(decryptedConsults.length > 0)) {
3408
- _context20.next = 36;
3645
+ _context21.next = 36;
3409
3646
  break;
3410
3647
  }
3411
3648
 
3412
3649
  console.info('[sdk:index] Grants found in user`s constant time secure index');
3413
3650
  this.cachedMetadataGrants[filterString] = decryptedConsults;
3414
- return _context20.abrupt("return", this.cachedMetadataGrants[filterString]);
3651
+ return _context21.abrupt("return", this.cachedMetadataGrants[filterString]);
3415
3652
 
3416
3653
  case 36:
3417
- return _context20.abrupt("return", []);
3654
+ return _context21.abrupt("return", []);
3418
3655
 
3419
3656
  case 37:
3420
3657
  case "end":
3421
- return _context20.stop();
3658
+ return _context21.stop();
3422
3659
  }
3423
3660
  }
3424
- }, _callee20, this);
3661
+ }, _callee21, this);
3425
3662
  }));
3426
3663
 
3427
- function getGrants(_x68) {
3664
+ function getGrants(_x70) {
3428
3665
  return _getGrants.apply(this, arguments);
3429
3666
  }
3430
3667
 
@@ -3440,23 +3677,23 @@ var OroClient = /*#__PURE__*/function () {
3440
3677
  _proto.getAccountRole =
3441
3678
  /*#__PURE__*/
3442
3679
  function () {
3443
- var _getAccountRole = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
3444
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
3680
+ var _getAccountRole = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
3681
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
3445
3682
  while (1) {
3446
- switch (_context21.prev = _context21.next) {
3683
+ switch (_context22.prev = _context22.next) {
3447
3684
  case 0:
3448
- _context21.next = 2;
3685
+ _context22.next = 2;
3449
3686
  return this.guardClient.whoAmI();
3450
3687
 
3451
3688
  case 2:
3452
- return _context21.abrupt("return", _context21.sent.scope.split(' '));
3689
+ return _context22.abrupt("return", _context22.sent.scope.split(' '));
3453
3690
 
3454
3691
  case 3:
3455
3692
  case "end":
3456
- return _context21.stop();
3693
+ return _context22.stop();
3457
3694
  }
3458
3695
  }
3459
- }, _callee21, this);
3696
+ }, _callee22, this);
3460
3697
  }));
3461
3698
 
3462
3699
  function getAccountRole() {
@@ -3477,14 +3714,14 @@ var OroClient = /*#__PURE__*/function () {
3477
3714
  _proto.getCachedSecretCryptor =
3478
3715
  /*#__PURE__*/
3479
3716
  function () {
3480
- var _getCachedSecretCryptor = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(lockboxUuid, lockboxOwnerUuid) {
3717
+ var _getCachedSecretCryptor = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(lockboxUuid, lockboxOwnerUuid) {
3481
3718
  var index, encryptedSecret, secret, cryptor;
3482
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
3719
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
3483
3720
  while (1) {
3484
- switch (_context22.prev = _context22.next) {
3721
+ switch (_context23.prev = _context23.next) {
3485
3722
  case 0:
3486
3723
  if (this.rsa) {
3487
- _context22.next = 2;
3724
+ _context23.next = 2;
3488
3725
  break;
3489
3726
  }
3490
3727
 
@@ -3496,35 +3733,35 @@ var OroClient = /*#__PURE__*/function () {
3496
3733
  });
3497
3734
 
3498
3735
  if (!(index === -1)) {
3499
- _context22.next = 13;
3736
+ _context23.next = 13;
3500
3737
  break;
3501
3738
  }
3502
3739
 
3503
- _context22.next = 6;
3740
+ _context23.next = 6;
3504
3741
  return this.vaultClient.lockboxSecretGet(lockboxUuid, lockboxOwnerUuid);
3505
3742
 
3506
3743
  case 6:
3507
- encryptedSecret = _context22.sent.sharedSecret;
3744
+ encryptedSecret = _context23.sent.sharedSecret;
3508
3745
  secret = this.rsa.base64DecryptToBytes(encryptedSecret);
3509
3746
  cryptor = this.toolbox.CryptoChaCha.fromKey(secret);
3510
3747
  this.secrets.push({
3511
3748
  lockboxUuid: lockboxUuid,
3512
3749
  cryptor: cryptor
3513
3750
  });
3514
- return _context22.abrupt("return", cryptor);
3751
+ return _context23.abrupt("return", cryptor);
3515
3752
 
3516
3753
  case 13:
3517
- return _context22.abrupt("return", this.secrets[index].cryptor);
3754
+ return _context23.abrupt("return", this.secrets[index].cryptor);
3518
3755
 
3519
3756
  case 14:
3520
3757
  case "end":
3521
- return _context22.stop();
3758
+ return _context23.stop();
3522
3759
  }
3523
3760
  }
3524
- }, _callee22, this);
3761
+ }, _callee23, this);
3525
3762
  }));
3526
3763
 
3527
- function getCachedSecretCryptor(_x69, _x70) {
3764
+ function getCachedSecretCryptor(_x71, _x72) {
3528
3765
  return _getCachedSecretCryptor.apply(this, arguments);
3529
3766
  }
3530
3767
 
@@ -3544,26 +3781,26 @@ var OroClient = /*#__PURE__*/function () {
3544
3781
  _proto.getPersonalInformationsFromConsultId =
3545
3782
  /*#__PURE__*/
3546
3783
  function () {
3547
- var _getPersonalInformationsFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(consultationId, category, forceRefresh) {
3548
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
3784
+ var _getPersonalInformationsFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(consultationId, category, forceRefresh) {
3785
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
3549
3786
  while (1) {
3550
- switch (_context23.prev = _context23.next) {
3787
+ switch (_context24.prev = _context24.next) {
3551
3788
  case 0:
3552
3789
  if (forceRefresh === void 0) {
3553
3790
  forceRefresh = false;
3554
3791
  }
3555
3792
 
3556
- return _context23.abrupt("return", this.getMetaCategoryFromConsultId(consultationId, category, forceRefresh));
3793
+ return _context24.abrupt("return", this.getMetaCategoryFromConsultId(consultationId, category, forceRefresh));
3557
3794
 
3558
3795
  case 2:
3559
3796
  case "end":
3560
- return _context23.stop();
3797
+ return _context24.stop();
3561
3798
  }
3562
3799
  }
3563
- }, _callee23, this);
3800
+ }, _callee24, this);
3564
3801
  }));
3565
3802
 
3566
- function getPersonalInformationsFromConsultId(_x71, _x72, _x73) {
3803
+ function getPersonalInformationsFromConsultId(_x73, _x74, _x75) {
3567
3804
  return _getPersonalInformationsFromConsultId.apply(this, arguments);
3568
3805
  }
3569
3806
 
@@ -3582,26 +3819,26 @@ var OroClient = /*#__PURE__*/function () {
3582
3819
  _proto.getMedicalDataFromConsultId =
3583
3820
  /*#__PURE__*/
3584
3821
  function () {
3585
- var _getMedicalDataFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(consultationId, forceRefresh) {
3586
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
3822
+ var _getMedicalDataFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(consultationId, forceRefresh) {
3823
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3587
3824
  while (1) {
3588
- switch (_context24.prev = _context24.next) {
3825
+ switch (_context25.prev = _context25.next) {
3589
3826
  case 0:
3590
3827
  if (forceRefresh === void 0) {
3591
3828
  forceRefresh = false;
3592
3829
  }
3593
3830
 
3594
- return _context24.abrupt("return", this.getMetaCategoryFromConsultId(consultationId, MetadataCategory.Medical, forceRefresh));
3831
+ return _context25.abrupt("return", this.getMetaCategoryFromConsultId(consultationId, MetadataCategory.Medical, forceRefresh));
3595
3832
 
3596
3833
  case 2:
3597
3834
  case "end":
3598
- return _context24.stop();
3835
+ return _context25.stop();
3599
3836
  }
3600
3837
  }
3601
- }, _callee24, this);
3838
+ }, _callee25, this);
3602
3839
  }));
3603
3840
 
3604
- function getMedicalDataFromConsultId(_x74, _x75) {
3841
+ function getMedicalDataFromConsultId(_x76, _x77) {
3605
3842
  return _getMedicalDataFromConsultId.apply(this, arguments);
3606
3843
  }
3607
3844
 
@@ -3609,35 +3846,35 @@ var OroClient = /*#__PURE__*/function () {
3609
3846
  }();
3610
3847
 
3611
3848
  _proto.getMetaCategoryFromConsultId = /*#__PURE__*/function () {
3612
- var _getMetaCategoryFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(consultationId, category, forceRefresh) {
3849
+ var _getMetaCategoryFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(consultationId, category, forceRefresh) {
3613
3850
  var _this2 = this;
3614
3851
 
3615
3852
  var grants, workflowData, _loop, _iterator, _step;
3616
3853
 
3617
- return _regeneratorRuntime().wrap(function _callee26$(_context27) {
3854
+ return _regeneratorRuntime().wrap(function _callee27$(_context28) {
3618
3855
  while (1) {
3619
- switch (_context27.prev = _context27.next) {
3856
+ switch (_context28.prev = _context28.next) {
3620
3857
  case 0:
3621
3858
  if (forceRefresh === void 0) {
3622
3859
  forceRefresh = false;
3623
3860
  }
3624
3861
 
3625
- _context27.next = 3;
3862
+ _context28.next = 3;
3626
3863
  return this.getGrants({
3627
3864
  consultationId: consultationId
3628
3865
  });
3629
3866
 
3630
3867
  case 3:
3631
- grants = _context27.sent;
3868
+ grants = _context28.sent;
3632
3869
  workflowData = [];
3633
3870
  _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
3634
3871
  var grant, manifest, data;
3635
- return _regeneratorRuntime().wrap(function _loop$(_context26) {
3872
+ return _regeneratorRuntime().wrap(function _loop$(_context27) {
3636
3873
  while (1) {
3637
- switch (_context26.prev = _context26.next) {
3874
+ switch (_context27.prev = _context27.next) {
3638
3875
  case 0:
3639
3876
  grant = _step.value;
3640
- _context26.next = 3;
3877
+ _context27.next = 3;
3641
3878
  return _this2.getLockboxManifest(grant.lockboxUuid, {
3642
3879
  category: category,
3643
3880
  documentType: DocumentType.PopulatedWorkflowData,
@@ -3645,67 +3882,67 @@ var OroClient = /*#__PURE__*/function () {
3645
3882
  }, true, grant.lockboxOwnerUuid, forceRefresh);
3646
3883
 
3647
3884
  case 3:
3648
- manifest = _context26.sent;
3885
+ manifest = _context27.sent;
3649
3886
 
3650
3887
  if (!(manifest.length === 0)) {
3651
- _context26.next = 8;
3888
+ _context27.next = 8;
3652
3889
  break;
3653
3890
  }
3654
3891
 
3655
- _context26.next = 7;
3892
+ _context27.next = 7;
3656
3893
  return _this2.getLockboxManifest(grant.lockboxUuid, {
3657
3894
  category: category,
3658
3895
  documentType: DocumentType.PopulatedWorkflowData
3659
3896
  }, true, grant.lockboxOwnerUuid, forceRefresh);
3660
3897
 
3661
3898
  case 7:
3662
- manifest = _context26.sent.filter(function (entry) {
3899
+ manifest = _context27.sent.filter(function (entry) {
3663
3900
  return !entry.metadata.consultationIds;
3664
3901
  });
3665
3902
 
3666
3903
  case 8:
3667
- _context26.next = 10;
3904
+ _context27.next = 10;
3668
3905
  return Promise.all(manifest.map( /*#__PURE__*/function () {
3669
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(entry) {
3670
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3906
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(entry) {
3907
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3671
3908
  while (1) {
3672
- switch (_context25.prev = _context25.next) {
3909
+ switch (_context26.prev = _context26.next) {
3673
3910
  case 0:
3674
- _context25.t0 = grant.lockboxOwnerUuid;
3675
- _context25.t1 = grant.lockboxUuid;
3676
- _context25.t2 = entry.dataUuid;
3677
- _context25.next = 5;
3911
+ _context26.t0 = grant.lockboxOwnerUuid;
3912
+ _context26.t1 = grant.lockboxUuid;
3913
+ _context26.t2 = entry.dataUuid;
3914
+ _context26.next = 5;
3678
3915
  return _this2.getJsonData(grant.lockboxUuid, entry.dataUuid);
3679
3916
 
3680
3917
  case 5:
3681
- _context25.t3 = _context25.sent;
3682
- return _context25.abrupt("return", {
3683
- lockboxOwnerUuid: _context25.t0,
3684
- lockboxUuid: _context25.t1,
3685
- dataUuid: _context25.t2,
3686
- data: _context25.t3
3918
+ _context26.t3 = _context26.sent;
3919
+ return _context26.abrupt("return", {
3920
+ lockboxOwnerUuid: _context26.t0,
3921
+ lockboxUuid: _context26.t1,
3922
+ dataUuid: _context26.t2,
3923
+ data: _context26.t3
3687
3924
  });
3688
3925
 
3689
3926
  case 7:
3690
3927
  case "end":
3691
- return _context25.stop();
3928
+ return _context26.stop();
3692
3929
  }
3693
3930
  }
3694
- }, _callee25);
3931
+ }, _callee26);
3695
3932
  }));
3696
3933
 
3697
- return function (_x79) {
3934
+ return function (_x81) {
3698
3935
  return _ref3.apply(this, arguments);
3699
3936
  };
3700
3937
  }()));
3701
3938
 
3702
3939
  case 10:
3703
- data = _context26.sent;
3940
+ data = _context27.sent;
3704
3941
  workflowData = _extends({}, workflowData, data);
3705
3942
 
3706
3943
  case 12:
3707
3944
  case "end":
3708
- return _context26.stop();
3945
+ return _context27.stop();
3709
3946
  }
3710
3947
  }
3711
3948
  }, _loop);
@@ -3714,28 +3951,28 @@ var OroClient = /*#__PURE__*/function () {
3714
3951
 
3715
3952
  case 7:
3716
3953
  if ((_step = _iterator()).done) {
3717
- _context27.next = 11;
3954
+ _context28.next = 11;
3718
3955
  break;
3719
3956
  }
3720
3957
 
3721
- return _context27.delegateYield(_loop(), "t0", 9);
3958
+ return _context28.delegateYield(_loop(), "t0", 9);
3722
3959
 
3723
3960
  case 9:
3724
- _context27.next = 7;
3961
+ _context28.next = 7;
3725
3962
  break;
3726
3963
 
3727
3964
  case 11:
3728
- return _context27.abrupt("return", workflowData);
3965
+ return _context28.abrupt("return", workflowData);
3729
3966
 
3730
3967
  case 12:
3731
3968
  case "end":
3732
- return _context27.stop();
3969
+ return _context28.stop();
3733
3970
  }
3734
3971
  }
3735
- }, _callee26, this);
3972
+ }, _callee27, this);
3736
3973
  }));
3737
3974
 
3738
- function getMetaCategoryFromConsultId(_x76, _x77, _x78) {
3975
+ function getMetaCategoryFromConsultId(_x78, _x79, _x80) {
3739
3976
  return _getMetaCategoryFromConsultId.apply(this, arguments);
3740
3977
  }
3741
3978
 
@@ -3751,22 +3988,22 @@ var OroClient = /*#__PURE__*/function () {
3751
3988
  _proto.getPersonalInformations =
3752
3989
  /*#__PURE__*/
3753
3990
  function () {
3754
- var _getPersonalInformations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(userId) {
3991
+ var _getPersonalInformations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(userId) {
3755
3992
  var grant, lockboxUuid, lockboxOwnerUuid, identificationDataUuid;
3756
- return _regeneratorRuntime().wrap(function _callee27$(_context28) {
3993
+ return _regeneratorRuntime().wrap(function _callee28$(_context29) {
3757
3994
  while (1) {
3758
- switch (_context28.prev = _context28.next) {
3995
+ switch (_context29.prev = _context29.next) {
3759
3996
  case 0:
3760
- _context28.next = 2;
3997
+ _context29.next = 2;
3761
3998
  return this.getGrants();
3762
3999
 
3763
4000
  case 2:
3764
- grant = _context28.sent.find(function (lockbox) {
4001
+ grant = _context29.sent.find(function (lockbox) {
3765
4002
  return lockbox.lockboxOwnerUuid === userId;
3766
4003
  });
3767
4004
 
3768
4005
  if (grant) {
3769
- _context28.next = 5;
4006
+ _context29.next = 5;
3770
4007
  break;
3771
4008
  }
3772
4009
 
@@ -3776,7 +4013,7 @@ var OroClient = /*#__PURE__*/function () {
3776
4013
  lockboxUuid = grant.lockboxUuid, lockboxOwnerUuid = grant.lockboxOwnerUuid;
3777
4014
 
3778
4015
  if (lockboxUuid) {
3779
- _context28.next = 8;
4016
+ _context29.next = 8;
3780
4017
  break;
3781
4018
  }
3782
4019
 
@@ -3784,45 +4021,45 @@ var OroClient = /*#__PURE__*/function () {
3784
4021
 
3785
4022
  case 8:
3786
4023
  if (lockboxOwnerUuid) {
3787
- _context28.next = 10;
4024
+ _context29.next = 10;
3788
4025
  break;
3789
4026
  }
3790
4027
 
3791
4028
  throw MissingLockboxOwner;
3792
4029
 
3793
4030
  case 10:
3794
- _context28.next = 12;
4031
+ _context29.next = 12;
3795
4032
  return this.getLockboxManifest(lockboxUuid, {
3796
4033
  category: MetadataCategory.Personal,
3797
4034
  documentType: DocumentType.PopulatedWorkflowData
3798
4035
  }, false, userId);
3799
4036
 
3800
4037
  case 12:
3801
- identificationDataUuid = _context28.sent[0].dataUuid;
3802
- _context28.t0 = lockboxOwnerUuid;
3803
- _context28.t1 = lockboxUuid;
3804
- _context28.t2 = identificationDataUuid;
3805
- _context28.next = 18;
4038
+ identificationDataUuid = _context29.sent[0].dataUuid;
4039
+ _context29.t0 = lockboxOwnerUuid;
4040
+ _context29.t1 = lockboxUuid;
4041
+ _context29.t2 = identificationDataUuid;
4042
+ _context29.next = 18;
3806
4043
  return this.getJsonData(lockboxUuid, identificationDataUuid);
3807
4044
 
3808
4045
  case 18:
3809
- _context28.t3 = _context28.sent;
3810
- return _context28.abrupt("return", {
3811
- lockboxOwnerUuid: _context28.t0,
3812
- lockboxUuid: _context28.t1,
3813
- dataUuid: _context28.t2,
3814
- data: _context28.t3
4046
+ _context29.t3 = _context29.sent;
4047
+ return _context29.abrupt("return", {
4048
+ lockboxOwnerUuid: _context29.t0,
4049
+ lockboxUuid: _context29.t1,
4050
+ dataUuid: _context29.t2,
4051
+ data: _context29.t3
3815
4052
  });
3816
4053
 
3817
4054
  case 20:
3818
4055
  case "end":
3819
- return _context28.stop();
4056
+ return _context29.stop();
3820
4057
  }
3821
4058
  }
3822
- }, _callee27, this);
4059
+ }, _callee28, this);
3823
4060
  }));
3824
4061
 
3825
- function getPersonalInformations(_x80) {
4062
+ function getPersonalInformations(_x82) {
3826
4063
  return _getPersonalInformations.apply(this, arguments);
3827
4064
  }
3828
4065
 
@@ -3839,39 +4076,39 @@ var OroClient = /*#__PURE__*/function () {
3839
4076
  _proto.getGrantFromConsultId =
3840
4077
  /*#__PURE__*/
3841
4078
  function () {
3842
- var _getGrantFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(consultationId) {
4079
+ var _getGrantFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(consultationId) {
3843
4080
  var grants;
3844
- return _regeneratorRuntime().wrap(function _callee28$(_context29) {
4081
+ return _regeneratorRuntime().wrap(function _callee29$(_context30) {
3845
4082
  while (1) {
3846
- switch (_context29.prev = _context29.next) {
4083
+ switch (_context30.prev = _context30.next) {
3847
4084
  case 0:
3848
- _context29.next = 2;
4085
+ _context30.next = 2;
3849
4086
  return this.getGrants({
3850
4087
  consultationId: consultationId
3851
4088
  });
3852
4089
 
3853
4090
  case 2:
3854
- grants = _context29.sent;
4091
+ grants = _context30.sent;
3855
4092
 
3856
4093
  if (!(grants.length === 0)) {
3857
- _context29.next = 5;
4094
+ _context30.next = 5;
3858
4095
  break;
3859
4096
  }
3860
4097
 
3861
4098
  throw AssociatedLockboxNotFound;
3862
4099
 
3863
4100
  case 5:
3864
- return _context29.abrupt("return", grants[0]);
4101
+ return _context30.abrupt("return", grants[0]);
3865
4102
 
3866
4103
  case 6:
3867
4104
  case "end":
3868
- return _context29.stop();
4105
+ return _context30.stop();
3869
4106
  }
3870
4107
  }
3871
- }, _callee28, this);
4108
+ }, _callee29, this);
3872
4109
  }));
3873
4110
 
3874
- function getGrantFromConsultId(_x81) {
4111
+ function getGrantFromConsultId(_x83) {
3875
4112
  return _getGrantFromConsultId.apply(this, arguments);
3876
4113
  }
3877
4114
 
@@ -3887,41 +4124,41 @@ var OroClient = /*#__PURE__*/function () {
3887
4124
  _proto.getIdentityFromConsultId =
3888
4125
  /*#__PURE__*/
3889
4126
  function () {
3890
- var _getIdentityFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(consultationId) {
4127
+ var _getIdentityFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(consultationId) {
3891
4128
  var grant;
3892
- return _regeneratorRuntime().wrap(function _callee29$(_context30) {
4129
+ return _regeneratorRuntime().wrap(function _callee30$(_context31) {
3893
4130
  while (1) {
3894
- switch (_context30.prev = _context30.next) {
4131
+ switch (_context31.prev = _context31.next) {
3895
4132
  case 0:
3896
- _context30.next = 2;
4133
+ _context31.next = 2;
3897
4134
  return this.getGrantFromConsultId(consultationId);
3898
4135
 
3899
4136
  case 2:
3900
- grant = _context30.sent;
4137
+ grant = _context31.sent;
3901
4138
 
3902
4139
  if (!(grant && grant.lockboxOwnerUuid)) {
3903
- _context30.next = 9;
4140
+ _context31.next = 9;
3904
4141
  break;
3905
4142
  }
3906
4143
 
3907
- _context30.next = 6;
4144
+ _context31.next = 6;
3908
4145
  return this.guardClient.identityGet(grant.lockboxOwnerUuid);
3909
4146
 
3910
4147
  case 6:
3911
- return _context30.abrupt("return", _context30.sent);
4148
+ return _context31.abrupt("return", _context31.sent);
3912
4149
 
3913
4150
  case 9:
3914
- return _context30.abrupt("return", undefined);
4151
+ return _context31.abrupt("return", undefined);
3915
4152
 
3916
4153
  case 10:
3917
4154
  case "end":
3918
- return _context30.stop();
4155
+ return _context31.stop();
3919
4156
  }
3920
4157
  }
3921
- }, _callee29, this);
4158
+ }, _callee30, this);
3922
4159
  }));
3923
4160
 
3924
- function getIdentityFromConsultId(_x82) {
4161
+ function getIdentityFromConsultId(_x84) {
3925
4162
  return _getIdentityFromConsultId.apply(this, arguments);
3926
4163
  }
3927
4164
 
@@ -3942,13 +4179,13 @@ var OroClient = /*#__PURE__*/function () {
3942
4179
  _proto.getLockboxManifest =
3943
4180
  /*#__PURE__*/
3944
4181
  function () {
3945
- var _getLockboxManifest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(lockboxUuid, filter, expandPrivateMetadata, lockboxOwnerUuid, forceRefresh) {
4182
+ var _getLockboxManifest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(lockboxUuid, filter, expandPrivateMetadata, lockboxOwnerUuid, forceRefresh) {
3946
4183
  var _this3 = this;
3947
4184
 
3948
4185
  var manifestKey;
3949
- return _regeneratorRuntime().wrap(function _callee31$(_context32) {
4186
+ return _regeneratorRuntime().wrap(function _callee32$(_context33) {
3950
4187
  while (1) {
3951
- switch (_context32.prev = _context32.next) {
4188
+ switch (_context33.prev = _context33.next) {
3952
4189
  case 0:
3953
4190
  if (forceRefresh === void 0) {
3954
4191
  forceRefresh = false;
@@ -3962,45 +4199,45 @@ var OroClient = /*#__PURE__*/function () {
3962
4199
  });
3963
4200
 
3964
4201
  if (!(!forceRefresh && this.cachedManifest[manifestKey])) {
3965
- _context32.next = 4;
4202
+ _context33.next = 4;
3966
4203
  break;
3967
4204
  }
3968
4205
 
3969
- return _context32.abrupt("return", this.cachedManifest[manifestKey]);
4206
+ return _context33.abrupt("return", this.cachedManifest[manifestKey]);
3970
4207
 
3971
4208
  case 4:
3972
- return _context32.abrupt("return", this.vaultClient.lockboxManifestGet(lockboxUuid, filter, lockboxOwnerUuid).then(function (manifest) {
4209
+ return _context33.abrupt("return", this.vaultClient.lockboxManifestGet(lockboxUuid, filter, lockboxOwnerUuid).then(function (manifest) {
3973
4210
  return Promise.all(manifest.map( /*#__PURE__*/function () {
3974
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(entry) {
4211
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(entry) {
3975
4212
  var privateMeta;
3976
- return _regeneratorRuntime().wrap(function _callee30$(_context31) {
4213
+ return _regeneratorRuntime().wrap(function _callee31$(_context32) {
3977
4214
  while (1) {
3978
- switch (_context31.prev = _context31.next) {
4215
+ switch (_context32.prev = _context32.next) {
3979
4216
  case 0:
3980
4217
  if (!(expandPrivateMetadata && entry.metadata.privateMetadata)) {
3981
- _context31.next = 5;
4218
+ _context32.next = 5;
3982
4219
  break;
3983
4220
  }
3984
4221
 
3985
- _context31.next = 3;
4222
+ _context32.next = 3;
3986
4223
  return _this3.getJsonData(lockboxUuid, entry.metadata.privateMetadata, lockboxOwnerUuid);
3987
4224
 
3988
4225
  case 3:
3989
- privateMeta = _context31.sent;
4226
+ privateMeta = _context32.sent;
3990
4227
  entry.metadata = _extends({}, entry.metadata, privateMeta);
3991
4228
 
3992
4229
  case 5:
3993
- return _context31.abrupt("return", entry);
4230
+ return _context32.abrupt("return", entry);
3994
4231
 
3995
4232
  case 6:
3996
4233
  case "end":
3997
- return _context31.stop();
4234
+ return _context32.stop();
3998
4235
  }
3999
4236
  }
4000
- }, _callee30);
4237
+ }, _callee31);
4001
4238
  }));
4002
4239
 
4003
- return function (_x88) {
4240
+ return function (_x90) {
4004
4241
  return _ref4.apply(this, arguments);
4005
4242
  };
4006
4243
  }())).then(function (manifest) {
@@ -4010,13 +4247,13 @@ var OroClient = /*#__PURE__*/function () {
4010
4247
 
4011
4248
  case 5:
4012
4249
  case "end":
4013
- return _context32.stop();
4250
+ return _context33.stop();
4014
4251
  }
4015
4252
  }
4016
- }, _callee31, this);
4253
+ }, _callee32, this);
4017
4254
  }));
4018
4255
 
4019
- function getLockboxManifest(_x83, _x84, _x85, _x86, _x87) {
4256
+ function getLockboxManifest(_x85, _x86, _x87, _x88, _x89) {
4020
4257
  return _getLockboxManifest.apply(this, arguments);
4021
4258
  }
4022
4259
 
@@ -4034,43 +4271,43 @@ var OroClient = /*#__PURE__*/function () {
4034
4271
  _proto.createPersonalInformations =
4035
4272
  /*#__PURE__*/
4036
4273
  function () {
4037
- var _createPersonalInformations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(identity, data, dataUuid) {
4274
+ var _createPersonalInformations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(identity, data, dataUuid) {
4038
4275
  var _yield$this$getGrants;
4039
4276
 
4040
4277
  var lockboxUuid;
4041
- return _regeneratorRuntime().wrap(function _callee32$(_context33) {
4278
+ return _regeneratorRuntime().wrap(function _callee33$(_context34) {
4042
4279
  while (1) {
4043
- switch (_context33.prev = _context33.next) {
4280
+ switch (_context34.prev = _context34.next) {
4044
4281
  case 0:
4045
- _context33.next = 2;
4282
+ _context34.next = 2;
4046
4283
  return this.getGrants();
4047
4284
 
4048
4285
  case 2:
4049
- _context33.t0 = _yield$this$getGrants = _context33.sent.find(function (lockbox) {
4286
+ _context34.t0 = _yield$this$getGrants = _context34.sent.find(function (lockbox) {
4050
4287
  return lockbox.lockboxOwnerUuid === identity.id;
4051
4288
  });
4052
4289
 
4053
- if (!(_context33.t0 == null)) {
4054
- _context33.next = 7;
4290
+ if (!(_context34.t0 == null)) {
4291
+ _context34.next = 7;
4055
4292
  break;
4056
4293
  }
4057
4294
 
4058
- _context33.t1 = void 0;
4059
- _context33.next = 8;
4295
+ _context34.t1 = void 0;
4296
+ _context34.next = 8;
4060
4297
  break;
4061
4298
 
4062
4299
  case 7:
4063
- _context33.t1 = _yield$this$getGrants.lockboxUuid;
4300
+ _context34.t1 = _yield$this$getGrants.lockboxUuid;
4064
4301
 
4065
4302
  case 8:
4066
- lockboxUuid = _context33.t1;
4303
+ lockboxUuid = _context34.t1;
4067
4304
 
4068
4305
  if (!lockboxUuid) {
4069
- _context33.next = 13;
4306
+ _context34.next = 13;
4070
4307
  break;
4071
4308
  }
4072
4309
 
4073
- return _context33.abrupt("return", this.createJsonData(lockboxUuid, data, {
4310
+ return _context34.abrupt("return", this.createJsonData(lockboxUuid, data, {
4074
4311
  category: MetadataCategory.Personal,
4075
4312
  documentType: DocumentType.PopulatedWorkflowData
4076
4313
  }, {}, undefined, dataUuid));
@@ -4080,13 +4317,13 @@ var OroClient = /*#__PURE__*/function () {
4080
4317
 
4081
4318
  case 14:
4082
4319
  case "end":
4083
- return _context33.stop();
4320
+ return _context34.stop();
4084
4321
  }
4085
4322
  }
4086
- }, _callee32, this);
4323
+ }, _callee33, this);
4087
4324
  }));
4088
4325
 
4089
- function createPersonalInformations(_x89, _x90, _x91) {
4326
+ function createPersonalInformations(_x91, _x92, _x93) {
4090
4327
  return _createPersonalInformations.apply(this, arguments);
4091
4328
  }
4092
4329
 
@@ -4104,43 +4341,43 @@ var OroClient = /*#__PURE__*/function () {
4104
4341
  _proto.createUserPreference =
4105
4342
  /*#__PURE__*/
4106
4343
  function () {
4107
- var _createUserPreference = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(identity, preference, dataUuid) {
4344
+ var _createUserPreference = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(identity, preference, dataUuid) {
4108
4345
  var _yield$this$getGrants2;
4109
4346
 
4110
4347
  var lockboxUuid;
4111
- return _regeneratorRuntime().wrap(function _callee33$(_context34) {
4348
+ return _regeneratorRuntime().wrap(function _callee34$(_context35) {
4112
4349
  while (1) {
4113
- switch (_context34.prev = _context34.next) {
4350
+ switch (_context35.prev = _context35.next) {
4114
4351
  case 0:
4115
- _context34.next = 2;
4352
+ _context35.next = 2;
4116
4353
  return this.getGrants();
4117
4354
 
4118
4355
  case 2:
4119
- _context34.t0 = _yield$this$getGrants2 = _context34.sent.find(function (lockbox) {
4356
+ _context35.t0 = _yield$this$getGrants2 = _context35.sent.find(function (lockbox) {
4120
4357
  return lockbox.lockboxOwnerUuid === identity.id;
4121
4358
  });
4122
4359
 
4123
- if (!(_context34.t0 == null)) {
4124
- _context34.next = 7;
4360
+ if (!(_context35.t0 == null)) {
4361
+ _context35.next = 7;
4125
4362
  break;
4126
4363
  }
4127
4364
 
4128
- _context34.t1 = void 0;
4129
- _context34.next = 8;
4365
+ _context35.t1 = void 0;
4366
+ _context35.next = 8;
4130
4367
  break;
4131
4368
 
4132
4369
  case 7:
4133
- _context34.t1 = _yield$this$getGrants2.lockboxUuid;
4370
+ _context35.t1 = _yield$this$getGrants2.lockboxUuid;
4134
4371
 
4135
4372
  case 8:
4136
- lockboxUuid = _context34.t1;
4373
+ lockboxUuid = _context35.t1;
4137
4374
 
4138
4375
  if (!lockboxUuid) {
4139
- _context34.next = 13;
4376
+ _context35.next = 13;
4140
4377
  break;
4141
4378
  }
4142
4379
 
4143
- return _context34.abrupt("return", this.createJsonData(lockboxUuid, preference, {
4380
+ return _context35.abrupt("return", this.createJsonData(lockboxUuid, preference, {
4144
4381
  category: MetadataCategory.Preference,
4145
4382
  contentType: 'application/json'
4146
4383
  }, {}, undefined, dataUuid));
@@ -4150,13 +4387,13 @@ var OroClient = /*#__PURE__*/function () {
4150
4387
 
4151
4388
  case 14:
4152
4389
  case "end":
4153
- return _context34.stop();
4390
+ return _context35.stop();
4154
4391
  }
4155
4392
  }
4156
- }, _callee33, this);
4393
+ }, _callee34, this);
4157
4394
  }));
4158
4395
 
4159
- function createUserPreference(_x92, _x93, _x94) {
4396
+ function createUserPreference(_x94, _x95, _x96) {
4160
4397
  return _createUserPreference.apply(this, arguments);
4161
4398
  }
4162
4399
 
@@ -4172,16 +4409,16 @@ var OroClient = /*#__PURE__*/function () {
4172
4409
  _proto.getDataFromGrant =
4173
4410
  /*#__PURE__*/
4174
4411
  function () {
4175
- var _getDataFromGrant = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(grant, filter) {
4412
+ var _getDataFromGrant = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(grant, filter) {
4176
4413
  var lockboxUuid, lockboxOwnerUuid, identificationDataUuid;
4177
- return _regeneratorRuntime().wrap(function _callee34$(_context35) {
4414
+ return _regeneratorRuntime().wrap(function _callee35$(_context36) {
4178
4415
  while (1) {
4179
- switch (_context35.prev = _context35.next) {
4416
+ switch (_context36.prev = _context36.next) {
4180
4417
  case 0:
4181
4418
  lockboxUuid = grant.lockboxUuid, lockboxOwnerUuid = grant.lockboxOwnerUuid;
4182
4419
 
4183
4420
  if (lockboxUuid) {
4184
- _context35.next = 3;
4421
+ _context36.next = 3;
4185
4422
  break;
4186
4423
  }
4187
4424
 
@@ -4189,42 +4426,42 @@ var OroClient = /*#__PURE__*/function () {
4189
4426
 
4190
4427
  case 3:
4191
4428
  if (lockboxOwnerUuid) {
4192
- _context35.next = 5;
4429
+ _context36.next = 5;
4193
4430
  break;
4194
4431
  }
4195
4432
 
4196
4433
  throw MissingLockboxOwner;
4197
4434
 
4198
4435
  case 5:
4199
- _context35.next = 7;
4436
+ _context36.next = 7;
4200
4437
  return this.getLockboxManifest(lockboxUuid, filter, false, grant.lockboxOwnerUuid, true);
4201
4438
 
4202
4439
  case 7:
4203
- identificationDataUuid = _context35.sent[0].dataUuid;
4204
- _context35.t0 = lockboxOwnerUuid;
4205
- _context35.t1 = lockboxUuid;
4206
- _context35.t2 = identificationDataUuid;
4207
- _context35.next = 13;
4440
+ identificationDataUuid = _context36.sent[0].dataUuid;
4441
+ _context36.t0 = lockboxOwnerUuid;
4442
+ _context36.t1 = lockboxUuid;
4443
+ _context36.t2 = identificationDataUuid;
4444
+ _context36.next = 13;
4208
4445
  return this.getJsonData(lockboxUuid, identificationDataUuid);
4209
4446
 
4210
4447
  case 13:
4211
- _context35.t3 = _context35.sent;
4212
- return _context35.abrupt("return", {
4213
- lockboxOwnerUuid: _context35.t0,
4214
- lockboxUuid: _context35.t1,
4215
- dataUuid: _context35.t2,
4216
- data: _context35.t3
4448
+ _context36.t3 = _context36.sent;
4449
+ return _context36.abrupt("return", {
4450
+ lockboxOwnerUuid: _context36.t0,
4451
+ lockboxUuid: _context36.t1,
4452
+ dataUuid: _context36.t2,
4453
+ data: _context36.t3
4217
4454
  });
4218
4455
 
4219
4456
  case 15:
4220
4457
  case "end":
4221
- return _context35.stop();
4458
+ return _context36.stop();
4222
4459
  }
4223
4460
  }
4224
- }, _callee34, this);
4461
+ }, _callee35, this);
4225
4462
  }));
4226
4463
 
4227
- function getDataFromGrant(_x95, _x96) {
4464
+ function getDataFromGrant(_x97, _x98) {
4228
4465
  return _getDataFromGrant.apply(this, arguments);
4229
4466
  }
4230
4467
 
@@ -4240,40 +4477,40 @@ var OroClient = /*#__PURE__*/function () {
4240
4477
  _proto.getUserPreferenceFromConsultId =
4241
4478
  /*#__PURE__*/
4242
4479
  function () {
4243
- var _getUserPreferenceFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(consultationId) {
4480
+ var _getUserPreferenceFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(consultationId) {
4244
4481
  var grant;
4245
- return _regeneratorRuntime().wrap(function _callee35$(_context36) {
4482
+ return _regeneratorRuntime().wrap(function _callee36$(_context37) {
4246
4483
  while (1) {
4247
- switch (_context36.prev = _context36.next) {
4484
+ switch (_context37.prev = _context37.next) {
4248
4485
  case 0:
4249
- _context36.next = 2;
4486
+ _context37.next = 2;
4250
4487
  return this.getGrantFromConsultId(consultationId);
4251
4488
 
4252
4489
  case 2:
4253
- grant = _context36.sent;
4490
+ grant = _context37.sent;
4254
4491
 
4255
4492
  if (grant) {
4256
- _context36.next = 5;
4493
+ _context37.next = 5;
4257
4494
  break;
4258
4495
  }
4259
4496
 
4260
4497
  throw MissingGrant;
4261
4498
 
4262
4499
  case 5:
4263
- return _context36.abrupt("return", this.getDataFromGrant(grant, {
4500
+ return _context37.abrupt("return", this.getDataFromGrant(grant, {
4264
4501
  category: MetadataCategory.Preference,
4265
4502
  contentType: 'application/json'
4266
4503
  }));
4267
4504
 
4268
4505
  case 6:
4269
4506
  case "end":
4270
- return _context36.stop();
4507
+ return _context37.stop();
4271
4508
  }
4272
4509
  }
4273
- }, _callee35, this);
4510
+ }, _callee36, this);
4274
4511
  }));
4275
4512
 
4276
- function getUserPreferenceFromConsultId(_x97) {
4513
+ function getUserPreferenceFromConsultId(_x99) {
4277
4514
  return _getUserPreferenceFromConsultId.apply(this, arguments);
4278
4515
  }
4279
4516
 
@@ -4289,42 +4526,42 @@ var OroClient = /*#__PURE__*/function () {
4289
4526
  _proto.getUserPreference =
4290
4527
  /*#__PURE__*/
4291
4528
  function () {
4292
- var _getUserPreference = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(identity) {
4529
+ var _getUserPreference = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(identity) {
4293
4530
  var grant;
4294
- return _regeneratorRuntime().wrap(function _callee36$(_context37) {
4531
+ return _regeneratorRuntime().wrap(function _callee37$(_context38) {
4295
4532
  while (1) {
4296
- switch (_context37.prev = _context37.next) {
4533
+ switch (_context38.prev = _context38.next) {
4297
4534
  case 0:
4298
- _context37.next = 2;
4535
+ _context38.next = 2;
4299
4536
  return this.getGrants();
4300
4537
 
4301
4538
  case 2:
4302
- grant = _context37.sent.find(function (lockbox) {
4539
+ grant = _context38.sent.find(function (lockbox) {
4303
4540
  return lockbox.lockboxOwnerUuid === identity.id;
4304
4541
  });
4305
4542
 
4306
4543
  if (grant) {
4307
- _context37.next = 5;
4544
+ _context38.next = 5;
4308
4545
  break;
4309
4546
  }
4310
4547
 
4311
4548
  throw MissingGrant;
4312
4549
 
4313
4550
  case 5:
4314
- return _context37.abrupt("return", this.getDataFromGrant(grant, {
4551
+ return _context38.abrupt("return", this.getDataFromGrant(grant, {
4315
4552
  category: MetadataCategory.Preference,
4316
4553
  contentType: 'application/json'
4317
4554
  }));
4318
4555
 
4319
4556
  case 6:
4320
4557
  case "end":
4321
- return _context37.stop();
4558
+ return _context38.stop();
4322
4559
  }
4323
4560
  }
4324
- }, _callee36, this);
4561
+ }, _callee37, this);
4325
4562
  }));
4326
4563
 
4327
- function getUserPreference(_x98) {
4564
+ function getUserPreference(_x100) {
4328
4565
  return _getUserPreference.apply(this, arguments);
4329
4566
  }
4330
4567
 
@@ -4340,40 +4577,40 @@ var OroClient = /*#__PURE__*/function () {
4340
4577
  _proto.getRecoveryDataFromConsultId =
4341
4578
  /*#__PURE__*/
4342
4579
  function () {
4343
- var _getRecoveryDataFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(consultationId) {
4580
+ var _getRecoveryDataFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(consultationId) {
4344
4581
  var grant;
4345
- return _regeneratorRuntime().wrap(function _callee37$(_context38) {
4582
+ return _regeneratorRuntime().wrap(function _callee38$(_context39) {
4346
4583
  while (1) {
4347
- switch (_context38.prev = _context38.next) {
4584
+ switch (_context39.prev = _context39.next) {
4348
4585
  case 0:
4349
- _context38.next = 2;
4586
+ _context39.next = 2;
4350
4587
  return this.getGrantFromConsultId(consultationId);
4351
4588
 
4352
4589
  case 2:
4353
- grant = _context38.sent;
4590
+ grant = _context39.sent;
4354
4591
 
4355
4592
  if (grant) {
4356
- _context38.next = 5;
4593
+ _context39.next = 5;
4357
4594
  break;
4358
4595
  }
4359
4596
 
4360
4597
  throw MissingGrant;
4361
4598
 
4362
4599
  case 5:
4363
- return _context38.abrupt("return", this.getDataFromGrant(grant, {
4600
+ return _context39.abrupt("return", this.getDataFromGrant(grant, {
4364
4601
  category: MetadataCategory.Recovery,
4365
4602
  contentType: 'application/json'
4366
4603
  }));
4367
4604
 
4368
4605
  case 6:
4369
4606
  case "end":
4370
- return _context38.stop();
4607
+ return _context39.stop();
4371
4608
  }
4372
4609
  }
4373
- }, _callee37, this);
4610
+ }, _callee38, this);
4374
4611
  }));
4375
4612
 
4376
- function getRecoveryDataFromConsultId(_x99) {
4613
+ function getRecoveryDataFromConsultId(_x101) {
4377
4614
  return _getRecoveryDataFromConsultId.apply(this, arguments);
4378
4615
  }
4379
4616
 
@@ -4389,42 +4626,42 @@ var OroClient = /*#__PURE__*/function () {
4389
4626
  _proto.getRecoveryData =
4390
4627
  /*#__PURE__*/
4391
4628
  function () {
4392
- var _getRecoveryData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(identity) {
4629
+ var _getRecoveryData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(identity) {
4393
4630
  var grant;
4394
- return _regeneratorRuntime().wrap(function _callee38$(_context39) {
4631
+ return _regeneratorRuntime().wrap(function _callee39$(_context40) {
4395
4632
  while (1) {
4396
- switch (_context39.prev = _context39.next) {
4633
+ switch (_context40.prev = _context40.next) {
4397
4634
  case 0:
4398
- _context39.next = 2;
4635
+ _context40.next = 2;
4399
4636
  return this.getGrants();
4400
4637
 
4401
4638
  case 2:
4402
- grant = _context39.sent.find(function (lockbox) {
4639
+ grant = _context40.sent.find(function (lockbox) {
4403
4640
  return lockbox.lockboxOwnerUuid === identity.id;
4404
4641
  });
4405
4642
 
4406
4643
  if (grant) {
4407
- _context39.next = 5;
4644
+ _context40.next = 5;
4408
4645
  break;
4409
4646
  }
4410
4647
 
4411
4648
  throw MissingGrant;
4412
4649
 
4413
4650
  case 5:
4414
- return _context39.abrupt("return", this.getDataFromGrant(grant, {
4651
+ return _context40.abrupt("return", this.getDataFromGrant(grant, {
4415
4652
  category: MetadataCategory.Recovery,
4416
4653
  contentType: 'application/json'
4417
4654
  }));
4418
4655
 
4419
4656
  case 6:
4420
4657
  case "end":
4421
- return _context39.stop();
4658
+ return _context40.stop();
4422
4659
  }
4423
4660
  }
4424
- }, _callee38, this);
4661
+ }, _callee39, this);
4425
4662
  }));
4426
4663
 
4427
- function getRecoveryData(_x100) {
4664
+ function getRecoveryData(_x102) {
4428
4665
  return _getRecoveryData.apply(this, arguments);
4429
4666
  }
4430
4667
 
@@ -4445,44 +4682,44 @@ var OroClient = /*#__PURE__*/function () {
4445
4682
  _proto.getAssignedConsultations =
4446
4683
  /*#__PURE__*/
4447
4684
  function () {
4448
- var _getAssignedConsultations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(practiceUuid) {
4685
+ var _getAssignedConsultations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(practiceUuid) {
4449
4686
  var _this4 = this;
4450
4687
 
4451
- return _regeneratorRuntime().wrap(function _callee40$(_context41) {
4688
+ return _regeneratorRuntime().wrap(function _callee41$(_context42) {
4452
4689
  while (1) {
4453
- switch (_context41.prev = _context41.next) {
4690
+ switch (_context42.prev = _context42.next) {
4454
4691
  case 0:
4455
- _context41.t0 = Promise;
4456
- _context41.next = 3;
4692
+ _context42.t0 = Promise;
4693
+ _context42.next = 3;
4457
4694
  return this.getGrants();
4458
4695
 
4459
4696
  case 3:
4460
- _context41.t1 = _context41.sent.map(function (grant) {
4697
+ _context42.t1 = _context42.sent.map(function (grant) {
4461
4698
  return _this4.getLockboxManifest(grant.lockboxUuid, {
4462
4699
  category: MetadataCategory.Consultation,
4463
4700
  documentType: DocumentType.PopulatedWorkflowData
4464
4701
  }, true, undefined).then(function (manifest) {
4465
4702
  return Promise.all(manifest.map( /*#__PURE__*/function () {
4466
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(entry) {
4467
- return _regeneratorRuntime().wrap(function _callee39$(_context40) {
4703
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(entry) {
4704
+ return _regeneratorRuntime().wrap(function _callee40$(_context41) {
4468
4705
  while (1) {
4469
- switch (_context40.prev = _context40.next) {
4706
+ switch (_context41.prev = _context41.next) {
4470
4707
  case 0:
4471
- _context40.next = 2;
4708
+ _context41.next = 2;
4472
4709
  return _this4.consultClient.getConsultByUUID(entry.metadata.consultationId, practiceUuid);
4473
4710
 
4474
4711
  case 2:
4475
- return _context40.abrupt("return", _context40.sent);
4712
+ return _context41.abrupt("return", _context41.sent);
4476
4713
 
4477
4714
  case 3:
4478
4715
  case "end":
4479
- return _context40.stop();
4716
+ return _context41.stop();
4480
4717
  }
4481
4718
  }
4482
- }, _callee39);
4719
+ }, _callee40);
4483
4720
  }));
4484
4721
 
4485
- return function (_x102) {
4722
+ return function (_x104) {
4486
4723
  return _ref5.apply(this, arguments);
4487
4724
  };
4488
4725
  }())).then(function (promise) {
@@ -4490,19 +4727,19 @@ var OroClient = /*#__PURE__*/function () {
4490
4727
  });
4491
4728
  });
4492
4729
  });
4493
- return _context41.abrupt("return", _context41.t0.all.call(_context41.t0, _context41.t1).then(function (consults) {
4730
+ return _context42.abrupt("return", _context42.t0.all.call(_context42.t0, _context42.t1).then(function (consults) {
4494
4731
  return consults.flat();
4495
4732
  }));
4496
4733
 
4497
4734
  case 5:
4498
4735
  case "end":
4499
- return _context41.stop();
4736
+ return _context42.stop();
4500
4737
  }
4501
4738
  }
4502
- }, _callee40, this);
4739
+ }, _callee41, this);
4503
4740
  }));
4504
4741
 
4505
- function getAssignedConsultations(_x101) {
4742
+ function getAssignedConsultations(_x103) {
4506
4743
  return _getAssignedConsultations.apply(this, arguments);
4507
4744
  }
4508
4745
 
@@ -4518,85 +4755,85 @@ var OroClient = /*#__PURE__*/function () {
4518
4755
  _proto.getPastConsultationsFromConsultId =
4519
4756
  /*#__PURE__*/
4520
4757
  function () {
4521
- var _getPastConsultationsFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(consultationId, practiceUuid) {
4758
+ var _getPastConsultationsFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(consultationId, practiceUuid) {
4522
4759
  var _this5 = this;
4523
4760
 
4524
4761
  var grant, consultationsInLockbox;
4525
- return _regeneratorRuntime().wrap(function _callee42$(_context43) {
4762
+ return _regeneratorRuntime().wrap(function _callee43$(_context44) {
4526
4763
  while (1) {
4527
- switch (_context43.prev = _context43.next) {
4764
+ switch (_context44.prev = _context44.next) {
4528
4765
  case 0:
4529
- _context43.next = 2;
4766
+ _context44.next = 2;
4530
4767
  return this.getGrantFromConsultId(consultationId);
4531
4768
 
4532
4769
  case 2:
4533
- grant = _context43.sent;
4770
+ grant = _context44.sent;
4534
4771
 
4535
4772
  if (grant) {
4536
- _context43.next = 5;
4773
+ _context44.next = 5;
4537
4774
  break;
4538
4775
  }
4539
4776
 
4540
- return _context43.abrupt("return", undefined);
4777
+ return _context44.abrupt("return", undefined);
4541
4778
 
4542
4779
  case 5:
4543
- _context43.next = 7;
4780
+ _context44.next = 7;
4544
4781
  return this.vaultClient.lockboxMetadataGet(grant.lockboxUuid, ['consultationId'], ['consultationId'], {
4545
4782
  category: MetadataCategory.Consultation,
4546
4783
  documentType: DocumentType.PopulatedWorkflowData
4547
4784
  }, grant.lockboxOwnerUuid);
4548
4785
 
4549
4786
  case 7:
4550
- consultationsInLockbox = _context43.sent.flat().map(function (metadata) {
4787
+ consultationsInLockbox = _context44.sent.flat().map(function (metadata) {
4551
4788
  return metadata.consultationId;
4552
4789
  });
4553
4790
 
4554
4791
  if (!(consultationsInLockbox.length == 0)) {
4555
- _context43.next = 10;
4792
+ _context44.next = 10;
4556
4793
  break;
4557
4794
  }
4558
4795
 
4559
- return _context43.abrupt("return", []);
4796
+ return _context44.abrupt("return", []);
4560
4797
 
4561
4798
  case 10:
4562
- _context43.next = 12;
4799
+ _context44.next = 12;
4563
4800
  return Promise.all(consultationsInLockbox.map( /*#__PURE__*/function () {
4564
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(consultId) {
4565
- return _regeneratorRuntime().wrap(function _callee41$(_context42) {
4801
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(consultId) {
4802
+ return _regeneratorRuntime().wrap(function _callee42$(_context43) {
4566
4803
  while (1) {
4567
- switch (_context42.prev = _context42.next) {
4804
+ switch (_context43.prev = _context43.next) {
4568
4805
  case 0:
4569
- _context42.next = 2;
4806
+ _context43.next = 2;
4570
4807
  return _this5.consultClient.getConsultByUUID(consultId, practiceUuid);
4571
4808
 
4572
4809
  case 2:
4573
- return _context42.abrupt("return", _context42.sent);
4810
+ return _context43.abrupt("return", _context43.sent);
4574
4811
 
4575
4812
  case 3:
4576
4813
  case "end":
4577
- return _context42.stop();
4814
+ return _context43.stop();
4578
4815
  }
4579
4816
  }
4580
- }, _callee41);
4817
+ }, _callee42);
4581
4818
  }));
4582
4819
 
4583
- return function (_x105) {
4820
+ return function (_x107) {
4584
4821
  return _ref6.apply(this, arguments);
4585
4822
  };
4586
4823
  }()));
4587
4824
 
4588
4825
  case 12:
4589
- return _context43.abrupt("return", _context43.sent);
4826
+ return _context44.abrupt("return", _context44.sent);
4590
4827
 
4591
4828
  case 13:
4592
4829
  case "end":
4593
- return _context43.stop();
4830
+ return _context44.stop();
4594
4831
  }
4595
4832
  }
4596
- }, _callee42, this);
4833
+ }, _callee43, this);
4597
4834
  }));
4598
4835
 
4599
- function getPastConsultationsFromConsultId(_x103, _x104) {
4836
+ function getPastConsultationsFromConsultId(_x105, _x106) {
4600
4837
  return _getPastConsultationsFromConsultId.apply(this, arguments);
4601
4838
  }
4602
4839
 
@@ -4613,25 +4850,25 @@ var OroClient = /*#__PURE__*/function () {
4613
4850
  _proto.getPatientConsultationData =
4614
4851
  /*#__PURE__*/
4615
4852
  function () {
4616
- var _getPatientConsultationData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(consultationId, forceRefresh) {
4853
+ var _getPatientConsultationData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(consultationId, forceRefresh) {
4617
4854
  var _this6 = this;
4618
4855
 
4619
- return _regeneratorRuntime().wrap(function _callee43$(_context44) {
4856
+ return _regeneratorRuntime().wrap(function _callee44$(_context45) {
4620
4857
  while (1) {
4621
- switch (_context44.prev = _context44.next) {
4858
+ switch (_context45.prev = _context45.next) {
4622
4859
  case 0:
4623
4860
  if (forceRefresh === void 0) {
4624
4861
  forceRefresh = false;
4625
4862
  }
4626
4863
 
4627
- _context44.t0 = Promise;
4628
- _context44.next = 4;
4864
+ _context45.t0 = Promise;
4865
+ _context45.next = 4;
4629
4866
  return this.getGrants({
4630
4867
  consultationId: consultationId
4631
4868
  });
4632
4869
 
4633
4870
  case 4:
4634
- _context44.t1 = _context44.sent.map(function (grant) {
4871
+ _context45.t1 = _context45.sent.map(function (grant) {
4635
4872
  return _this6.getLockboxManifest(grant.lockboxUuid, {
4636
4873
  category: MetadataCategory.Consultation,
4637
4874
  documentType: DocumentType.PopulatedWorkflowData,
@@ -4642,19 +4879,19 @@ var OroClient = /*#__PURE__*/function () {
4642
4879
  }));
4643
4880
  });
4644
4881
  }).flat();
4645
- return _context44.abrupt("return", _context44.t0.all.call(_context44.t0, _context44.t1).then(function (data) {
4882
+ return _context45.abrupt("return", _context45.t0.all.call(_context45.t0, _context45.t1).then(function (data) {
4646
4883
  return data.flat();
4647
4884
  }));
4648
4885
 
4649
4886
  case 6:
4650
4887
  case "end":
4651
- return _context44.stop();
4888
+ return _context45.stop();
4652
4889
  }
4653
4890
  }
4654
- }, _callee43, this);
4891
+ }, _callee44, this);
4655
4892
  }));
4656
4893
 
4657
- function getPatientConsultationData(_x106, _x107) {
4894
+ function getPatientConsultationData(_x108, _x109) {
4658
4895
  return _getPatientConsultationData.apply(this, arguments);
4659
4896
  }
4660
4897
 
@@ -4670,25 +4907,25 @@ var OroClient = /*#__PURE__*/function () {
4670
4907
  _proto.getPatientPrescriptionsList =
4671
4908
  /*#__PURE__*/
4672
4909
  function () {
4673
- var _getPatientPrescriptionsList = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(consultationId) {
4674
- return _regeneratorRuntime().wrap(function _callee44$(_context45) {
4910
+ var _getPatientPrescriptionsList = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(consultationId) {
4911
+ return _regeneratorRuntime().wrap(function _callee45$(_context46) {
4675
4912
  while (1) {
4676
- switch (_context45.prev = _context45.next) {
4913
+ switch (_context46.prev = _context46.next) {
4677
4914
  case 0:
4678
- return _context45.abrupt("return", this.getPatientDocumentsList({
4915
+ return _context46.abrupt("return", this.getPatientDocumentsList({
4679
4916
  category: MetadataCategory.Consultation,
4680
4917
  documentType: DocumentType.Prescription
4681
4918
  }, true, consultationId));
4682
4919
 
4683
4920
  case 1:
4684
4921
  case "end":
4685
- return _context45.stop();
4922
+ return _context46.stop();
4686
4923
  }
4687
4924
  }
4688
- }, _callee44, this);
4925
+ }, _callee45, this);
4689
4926
  }));
4690
4927
 
4691
- function getPatientPrescriptionsList(_x108) {
4928
+ function getPatientPrescriptionsList(_x110) {
4692
4929
  return _getPatientPrescriptionsList.apply(this, arguments);
4693
4930
  }
4694
4931
 
@@ -4704,25 +4941,25 @@ var OroClient = /*#__PURE__*/function () {
4704
4941
  _proto.getPatientResultsList =
4705
4942
  /*#__PURE__*/
4706
4943
  function () {
4707
- var _getPatientResultsList = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(consultationId) {
4708
- return _regeneratorRuntime().wrap(function _callee45$(_context46) {
4944
+ var _getPatientResultsList = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(consultationId) {
4945
+ return _regeneratorRuntime().wrap(function _callee46$(_context47) {
4709
4946
  while (1) {
4710
- switch (_context46.prev = _context46.next) {
4947
+ switch (_context47.prev = _context47.next) {
4711
4948
  case 0:
4712
- return _context46.abrupt("return", this.getPatientDocumentsList({
4949
+ return _context47.abrupt("return", this.getPatientDocumentsList({
4713
4950
  category: MetadataCategory.Consultation,
4714
4951
  documentType: DocumentType.Result
4715
4952
  }, true, consultationId));
4716
4953
 
4717
4954
  case 1:
4718
4955
  case "end":
4719
- return _context46.stop();
4956
+ return _context47.stop();
4720
4957
  }
4721
4958
  }
4722
- }, _callee45, this);
4959
+ }, _callee46, this);
4723
4960
  }));
4724
4961
 
4725
- function getPatientResultsList(_x109) {
4962
+ function getPatientResultsList(_x111) {
4726
4963
  return _getPatientResultsList.apply(this, arguments);
4727
4964
  }
4728
4965
 
@@ -4738,25 +4975,25 @@ var OroClient = /*#__PURE__*/function () {
4738
4975
  _proto.getPatientTreatmentPlans =
4739
4976
  /*#__PURE__*/
4740
4977
  function () {
4741
- var _getPatientTreatmentPlans = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(consultationId) {
4742
- return _regeneratorRuntime().wrap(function _callee46$(_context47) {
4978
+ var _getPatientTreatmentPlans = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(consultationId) {
4979
+ return _regeneratorRuntime().wrap(function _callee47$(_context48) {
4743
4980
  while (1) {
4744
- switch (_context47.prev = _context47.next) {
4981
+ switch (_context48.prev = _context48.next) {
4745
4982
  case 0:
4746
- return _context47.abrupt("return", this.getPatientDocumentsList({
4983
+ return _context48.abrupt("return", this.getPatientDocumentsList({
4747
4984
  category: MetadataCategory.Consultation,
4748
4985
  documentType: DocumentType.TreatmentPlan
4749
4986
  }, true, consultationId));
4750
4987
 
4751
4988
  case 1:
4752
4989
  case "end":
4753
- return _context47.stop();
4990
+ return _context48.stop();
4754
4991
  }
4755
4992
  }
4756
- }, _callee46, this);
4993
+ }, _callee47, this);
4757
4994
  }));
4758
4995
 
4759
- function getPatientTreatmentPlans(_x110) {
4996
+ function getPatientTreatmentPlans(_x112) {
4760
4997
  return _getPatientTreatmentPlans.apply(this, arguments);
4761
4998
  }
4762
4999
 
@@ -4773,12 +5010,12 @@ var OroClient = /*#__PURE__*/function () {
4773
5010
  _proto.getPatientTreatmentPlanByUuid =
4774
5011
  /*#__PURE__*/
4775
5012
  function () {
4776
- var _getPatientTreatmentPlanByUuid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(consultationId, treatmentPlanId) {
4777
- return _regeneratorRuntime().wrap(function _callee47$(_context48) {
5013
+ var _getPatientTreatmentPlanByUuid = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(consultationId, treatmentPlanId) {
5014
+ return _regeneratorRuntime().wrap(function _callee48$(_context49) {
4778
5015
  while (1) {
4779
- switch (_context48.prev = _context48.next) {
5016
+ switch (_context49.prev = _context49.next) {
4780
5017
  case 0:
4781
- return _context48.abrupt("return", this.getPatientDocumentsList({
5018
+ return _context49.abrupt("return", this.getPatientDocumentsList({
4782
5019
  category: MetadataCategory.Consultation,
4783
5020
  documentType: DocumentType.TreatmentPlan,
4784
5021
  treatmentPlanId: treatmentPlanId
@@ -4786,13 +5023,13 @@ var OroClient = /*#__PURE__*/function () {
4786
5023
 
4787
5024
  case 1:
4788
5025
  case "end":
4789
- return _context48.stop();
5026
+ return _context49.stop();
4790
5027
  }
4791
5028
  }
4792
- }, _callee47, this);
5029
+ }, _callee48, this);
4793
5030
  }));
4794
5031
 
4795
- function getPatientTreatmentPlanByUuid(_x111, _x112) {
5032
+ function getPatientTreatmentPlanByUuid(_x113, _x114) {
4796
5033
  return _getPatientTreatmentPlanByUuid.apply(this, arguments);
4797
5034
  }
4798
5035
 
@@ -4812,62 +5049,62 @@ var OroClient = /*#__PURE__*/function () {
4812
5049
  _proto.getPatientDocumentsList =
4813
5050
  /*#__PURE__*/
4814
5051
  function () {
4815
- var _getPatientDocumentsList = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(filters, expandPrivateMetadata, consultationId) {
5052
+ var _getPatientDocumentsList = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(filters, expandPrivateMetadata, consultationId) {
4816
5053
  var _this7 = this;
4817
5054
 
4818
- return _regeneratorRuntime().wrap(function _callee49$(_context50) {
5055
+ return _regeneratorRuntime().wrap(function _callee50$(_context51) {
4819
5056
  while (1) {
4820
- switch (_context50.prev = _context50.next) {
5057
+ switch (_context51.prev = _context51.next) {
4821
5058
  case 0:
4822
- _context50.t0 = Promise;
4823
- _context50.next = 3;
5059
+ _context51.t0 = Promise;
5060
+ _context51.next = 3;
4824
5061
  return this.getGrants({
4825
5062
  consultationId: consultationId
4826
5063
  });
4827
5064
 
4828
5065
  case 3:
4829
- _context50.t1 = _context50.sent.map(function (grant) {
5066
+ _context51.t1 = _context51.sent.map(function (grant) {
4830
5067
  return _this7.getLockboxManifest(grant.lockboxUuid, _extends({}, filters, {
4831
5068
  consultationId: consultationId
4832
5069
  }), expandPrivateMetadata, grant.lockboxOwnerUuid, true).then(function (manifest) {
4833
5070
  return Promise.all(manifest.map( /*#__PURE__*/function () {
4834
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(entry) {
4835
- return _regeneratorRuntime().wrap(function _callee48$(_context49) {
5071
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(entry) {
5072
+ return _regeneratorRuntime().wrap(function _callee49$(_context50) {
4836
5073
  while (1) {
4837
- switch (_context49.prev = _context49.next) {
5074
+ switch (_context50.prev = _context50.next) {
4838
5075
  case 0:
4839
- return _context49.abrupt("return", _extends({
5076
+ return _context50.abrupt("return", _extends({
4840
5077
  lockboxOwnerUuid: grant.lockboxOwnerUuid,
4841
5078
  lockboxUuid: grant.lockboxUuid
4842
5079
  }, entry));
4843
5080
 
4844
5081
  case 1:
4845
5082
  case "end":
4846
- return _context49.stop();
5083
+ return _context50.stop();
4847
5084
  }
4848
5085
  }
4849
- }, _callee48);
5086
+ }, _callee49);
4850
5087
  }));
4851
5088
 
4852
- return function (_x116) {
5089
+ return function (_x118) {
4853
5090
  return _ref7.apply(this, arguments);
4854
5091
  };
4855
5092
  }()));
4856
5093
  });
4857
5094
  }).flat();
4858
- return _context50.abrupt("return", _context50.t0.all.call(_context50.t0, _context50.t1).then(function (data) {
5095
+ return _context51.abrupt("return", _context51.t0.all.call(_context51.t0, _context51.t1).then(function (data) {
4859
5096
  return data.flat();
4860
5097
  }));
4861
5098
 
4862
5099
  case 5:
4863
5100
  case "end":
4864
- return _context50.stop();
5101
+ return _context51.stop();
4865
5102
  }
4866
5103
  }
4867
- }, _callee49, this);
5104
+ }, _callee50, this);
4868
5105
  }));
4869
5106
 
4870
- function getPatientDocumentsList(_x113, _x114, _x115) {
5107
+ function getPatientDocumentsList(_x115, _x116, _x117) {
4871
5108
  return _getPatientDocumentsList.apply(this, arguments);
4872
5109
  }
4873
5110
 
@@ -4890,17 +5127,17 @@ var OroClient = /*#__PURE__*/function () {
4890
5127
  _proto.recoverPrivateKeyFromSecurityQuestions =
4891
5128
  /*#__PURE__*/
4892
5129
  function () {
4893
- var _recoverPrivateKeyFromSecurityQuestions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(id, recoverySecurityQuestions, recoverySecurityAnswers, threshold) {
5130
+ var _recoverPrivateKeyFromSecurityQuestions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(id, recoverySecurityQuestions, recoverySecurityAnswers, threshold) {
4894
5131
  var shards, answeredShards, privateKey;
4895
- return _regeneratorRuntime().wrap(function _callee50$(_context51) {
5132
+ return _regeneratorRuntime().wrap(function _callee51$(_context52) {
4896
5133
  while (1) {
4897
- switch (_context51.prev = _context51.next) {
5134
+ switch (_context52.prev = _context52.next) {
4898
5135
  case 0:
4899
- _context51.next = 2;
5136
+ _context52.next = 2;
4900
5137
  return this.guardClient.identityGet(id);
4901
5138
 
4902
5139
  case 2:
4903
- shards = _context51.sent.recoverySecurityQuestions;
5140
+ shards = _context52.sent.recoverySecurityQuestions;
4904
5141
  answeredShards = shards.filter(function (shard) {
4905
5142
  // filters all answered security questions
4906
5143
  var indexOfQuestion = recoverySecurityQuestions.indexOf(shard.securityQuestion);
@@ -4923,13 +5160,13 @@ var OroClient = /*#__PURE__*/function () {
4923
5160
 
4924
5161
  case 5:
4925
5162
  case "end":
4926
- return _context51.stop();
5163
+ return _context52.stop();
4927
5164
  }
4928
5165
  }
4929
- }, _callee50, this);
5166
+ }, _callee51, this);
4930
5167
  }));
4931
5168
 
4932
- function recoverPrivateKeyFromSecurityQuestions(_x117, _x118, _x119, _x120) {
5169
+ function recoverPrivateKeyFromSecurityQuestions(_x119, _x120, _x121, _x122) {
4933
5170
  return _recoverPrivateKeyFromSecurityQuestions.apply(this, arguments);
4934
5171
  }
4935
5172
 
@@ -4946,17 +5183,17 @@ var OroClient = /*#__PURE__*/function () {
4946
5183
  _proto.recoverPrivateKeyFromPassword =
4947
5184
  /*#__PURE__*/
4948
5185
  function () {
4949
- var _recoverPrivateKeyFromPassword = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(id, password) {
5186
+ var _recoverPrivateKeyFromPassword = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(id, password) {
4950
5187
  var identity, recoveryPayload, symmetricDecryptor, privateKey, symetricEncryptor;
4951
- return _regeneratorRuntime().wrap(function _callee51$(_context52) {
5188
+ return _regeneratorRuntime().wrap(function _callee52$(_context53) {
4952
5189
  while (1) {
4953
- switch (_context52.prev = _context52.next) {
5190
+ switch (_context53.prev = _context53.next) {
4954
5191
  case 0:
4955
- _context52.next = 2;
5192
+ _context53.next = 2;
4956
5193
  return this.guardClient.identityGet(id);
4957
5194
 
4958
5195
  case 2:
4959
- identity = _context52.sent;
5196
+ identity = _context53.sent;
4960
5197
  recoveryPayload = identity.recoveryPassword;
4961
5198
  symmetricDecryptor = this.toolbox.CryptoChaCha.fromPassphrase(password);
4962
5199
  privateKey = symmetricDecryptor.base64PayloadDecryptToBytes(recoveryPayload);
@@ -4971,13 +5208,13 @@ var OroClient = /*#__PURE__*/function () {
4971
5208
 
4972
5209
  case 8:
4973
5210
  case "end":
4974
- return _context52.stop();
5211
+ return _context53.stop();
4975
5212
  }
4976
5213
  }
4977
- }, _callee51, this);
5214
+ }, _callee52, this);
4978
5215
  }));
4979
5216
 
4980
- function recoverPrivateKeyFromPassword(_x121, _x122) {
5217
+ function recoverPrivateKeyFromPassword(_x123, _x124) {
4981
5218
  return _recoverPrivateKeyFromPassword.apply(this, arguments);
4982
5219
  }
4983
5220
 
@@ -4994,30 +5231,30 @@ var OroClient = /*#__PURE__*/function () {
4994
5231
  _proto.recoverPrivateKeyFromMasterKey =
4995
5232
  /*#__PURE__*/
4996
5233
  function () {
4997
- var _recoverPrivateKeyFromMasterKey = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(id, masterKey) {
5234
+ var _recoverPrivateKeyFromMasterKey = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(id, masterKey) {
4998
5235
  var recoveryPayload, symmetricDecryptor, privateKey;
4999
- return _regeneratorRuntime().wrap(function _callee52$(_context53) {
5236
+ return _regeneratorRuntime().wrap(function _callee53$(_context54) {
5000
5237
  while (1) {
5001
- switch (_context53.prev = _context53.next) {
5238
+ switch (_context54.prev = _context54.next) {
5002
5239
  case 0:
5003
- _context53.next = 2;
5240
+ _context54.next = 2;
5004
5241
  return this.guardClient.identityGet(id);
5005
5242
 
5006
5243
  case 2:
5007
- recoveryPayload = _context53.sent.recoveryMasterKey;
5244
+ recoveryPayload = _context54.sent.recoveryMasterKey;
5008
5245
  symmetricDecryptor = this.toolbox.CryptoChaCha.fromPassphrase(masterKey);
5009
5246
  privateKey = symmetricDecryptor.base64PayloadDecryptToBytes(recoveryPayload);
5010
5247
  this.rsa = this.toolbox.CryptoRSA.fromKey(privateKey);
5011
5248
 
5012
5249
  case 6:
5013
5250
  case "end":
5014
- return _context53.stop();
5251
+ return _context54.stop();
5015
5252
  }
5016
5253
  }
5017
- }, _callee52, this);
5254
+ }, _callee53, this);
5018
5255
  }));
5019
5256
 
5020
- function recoverPrivateKeyFromMasterKey(_x123, _x124) {
5257
+ function recoverPrivateKeyFromMasterKey(_x125, _x126) {
5021
5258
  return _recoverPrivateKeyFromMasterKey.apply(this, arguments);
5022
5259
  }
5023
5260
 
@@ -5036,14 +5273,14 @@ var OroClient = /*#__PURE__*/function () {
5036
5273
  _proto.updateSecurityQuestions =
5037
5274
  /*#__PURE__*/
5038
5275
  function () {
5039
- var _updateSecurityQuestions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(id, recoverySecurityQuestions, recoverySecurityAnswers, threshold) {
5276
+ var _updateSecurityQuestions = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(id, recoverySecurityQuestions, recoverySecurityAnswers, threshold) {
5040
5277
  var securityQuestionPayload, updateRequest;
5041
- return _regeneratorRuntime().wrap(function _callee53$(_context54) {
5278
+ return _regeneratorRuntime().wrap(function _callee54$(_context55) {
5042
5279
  while (1) {
5043
- switch (_context54.prev = _context54.next) {
5280
+ switch (_context55.prev = _context55.next) {
5044
5281
  case 0:
5045
5282
  if (this.rsa) {
5046
- _context54.next = 2;
5283
+ _context55.next = 2;
5047
5284
  break;
5048
5285
  }
5049
5286
 
@@ -5054,21 +5291,21 @@ var OroClient = /*#__PURE__*/function () {
5054
5291
  updateRequest = {
5055
5292
  recoverySecurityQuestions: securityQuestionPayload
5056
5293
  };
5057
- _context54.next = 6;
5294
+ _context55.next = 6;
5058
5295
  return this.guardClient.identityUpdate(id, updateRequest);
5059
5296
 
5060
5297
  case 6:
5061
- return _context54.abrupt("return", _context54.sent);
5298
+ return _context55.abrupt("return", _context55.sent);
5062
5299
 
5063
5300
  case 7:
5064
5301
  case "end":
5065
- return _context54.stop();
5302
+ return _context55.stop();
5066
5303
  }
5067
5304
  }
5068
- }, _callee53, this);
5305
+ }, _callee54, this);
5069
5306
  }));
5070
5307
 
5071
- function updateSecurityQuestions(_x125, _x126, _x127, _x128) {
5308
+ function updateSecurityQuestions(_x127, _x128, _x129, _x130) {
5072
5309
  return _updateSecurityQuestions.apply(this, arguments);
5073
5310
  }
5074
5311
 
@@ -5090,14 +5327,14 @@ var OroClient = /*#__PURE__*/function () {
5090
5327
  _proto.updatePassword =
5091
5328
  /*#__PURE__*/
5092
5329
  function () {
5093
- var _updatePassword = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(id, newPassword, oldPassword) {
5330
+ var _updatePassword = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(id, newPassword, oldPassword) {
5094
5331
  var symmetricEncryptor, passwordPayload, updateRequest;
5095
- return _regeneratorRuntime().wrap(function _callee54$(_context55) {
5332
+ return _regeneratorRuntime().wrap(function _callee55$(_context56) {
5096
5333
  while (1) {
5097
- switch (_context55.prev = _context55.next) {
5334
+ switch (_context56.prev = _context56.next) {
5098
5335
  case 0:
5099
5336
  if (this.rsa) {
5100
- _context55.next = 2;
5337
+ _context56.next = 2;
5101
5338
  break;
5102
5339
  }
5103
5340
 
@@ -5119,21 +5356,21 @@ var OroClient = /*#__PURE__*/function () {
5119
5356
  },
5120
5357
  recoveryPassword: passwordPayload
5121
5358
  };
5122
- _context55.next = 9;
5359
+ _context56.next = 9;
5123
5360
  return this.guardClient.identityUpdate(id, updateRequest);
5124
5361
 
5125
5362
  case 9:
5126
- return _context55.abrupt("return", _context55.sent);
5363
+ return _context56.abrupt("return", _context56.sent);
5127
5364
 
5128
5365
  case 10:
5129
5366
  case "end":
5130
- return _context55.stop();
5367
+ return _context56.stop();
5131
5368
  }
5132
5369
  }
5133
- }, _callee54, this);
5370
+ }, _callee55, this);
5134
5371
  }));
5135
5372
 
5136
- function updatePassword(_x129, _x130, _x131) {
5373
+ function updatePassword(_x131, _x132, _x133) {
5137
5374
  return _updatePassword.apply(this, arguments);
5138
5375
  }
5139
5376
 
@@ -5152,14 +5389,14 @@ var OroClient = /*#__PURE__*/function () {
5152
5389
  _proto.updateMasterKey =
5153
5390
  /*#__PURE__*/
5154
5391
  function () {
5155
- var _updateMasterKey = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(id, masterKey, lockboxUuid) {
5392
+ var _updateMasterKey = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(id, masterKey, lockboxUuid) {
5156
5393
  var symmetricEncryptor, masterKeyPayload, updateRequest, updatedIdentity;
5157
- return _regeneratorRuntime().wrap(function _callee55$(_context56) {
5394
+ return _regeneratorRuntime().wrap(function _callee56$(_context57) {
5158
5395
  while (1) {
5159
- switch (_context56.prev = _context56.next) {
5396
+ switch (_context57.prev = _context57.next) {
5160
5397
  case 0:
5161
5398
  if (this.rsa) {
5162
- _context56.next = 2;
5399
+ _context57.next = 2;
5163
5400
  break;
5164
5401
  }
5165
5402
 
@@ -5171,12 +5408,12 @@ var OroClient = /*#__PURE__*/function () {
5171
5408
  updateRequest = {
5172
5409
  recoveryMasterKey: masterKeyPayload
5173
5410
  };
5174
- _context56.next = 7;
5411
+ _context57.next = 7;
5175
5412
  return this.guardClient.identityUpdate(id, updateRequest);
5176
5413
 
5177
5414
  case 7:
5178
- updatedIdentity = _context56.sent;
5179
- _context56.next = 10;
5415
+ updatedIdentity = _context57.sent;
5416
+ _context57.next = 10;
5180
5417
  return this.getOrInsertJsonData(lockboxUuid, {
5181
5418
  masterKey: masterKey
5182
5419
  }, {
@@ -5185,17 +5422,17 @@ var OroClient = /*#__PURE__*/function () {
5185
5422
  }, {}, true);
5186
5423
 
5187
5424
  case 10:
5188
- return _context56.abrupt("return", updatedIdentity);
5425
+ return _context57.abrupt("return", updatedIdentity);
5189
5426
 
5190
5427
  case 11:
5191
5428
  case "end":
5192
- return _context56.stop();
5429
+ return _context57.stop();
5193
5430
  }
5194
5431
  }
5195
- }, _callee55, this);
5432
+ }, _callee56, this);
5196
5433
  }));
5197
5434
 
5198
- function updateMasterKey(_x132, _x133, _x134) {
5435
+ function updateMasterKey(_x134, _x135, _x136) {
5199
5436
  return _updateMasterKey.apply(this, arguments);
5200
5437
  }
5201
5438
 
@@ -5296,5 +5533,5 @@ var init = function init(toolbox, tellerBaseURL, vaultBaseURL, guardBaseURL, sea
5296
5533
  };
5297
5534
 
5298
5535
  export default init;
5299
- export { AssociatedLockboxNotFound, CliniaService, IncompleteAuthentication, MissingGrant, MissingGrantFilter, MissingLockbox, MissingLockboxOwner, OroClient, WorkflowAnswersMissingError, buildConsultSearchIndex, decryptConsultLockboxGrants, decryptGrants, extractAndStorePersonalWorkflowData, extractISOLocalityForConsult, extractPersonalInfoFromWorkflowData, fillWorkflowFromPopulatedWorkflow, filterTriggeredAnsweredWithKind, flattenSelectedAnswers, getImagesFromIndexDb, getInitialisedSelectedAnswers, getWorkflowDataByCategory, identificationToPersonalInformations, isTriggered, registerPatient, sessionStorePrivateKeyName, toActualObject, updatePersonalIntoPopulatedWorkflowData, wasmPath };
5536
+ export { AssociatedLockboxNotFound, CliniaService, IncompleteAuthentication, MissingGrant, MissingGrantFilter, MissingLockbox, MissingLockboxOwner, OroClient, WorkflowAnswersMissingError, buildConsultSearchIndex, createRefill, decryptConsultLockboxGrants, decryptGrants, extractAndStorePersonalWorkflowData, extractISOLocalityForConsult, extractPersonalInfoFromWorkflowData, fillWorkflowFromPopulatedWorkflow, filterTriggeredAnsweredWithKind, flattenSelectedAnswers, getImagesFromIndexDb, getInitialisedSelectedAnswers, getRefillAnswersAsWorkflow, getWorkflowDataByCategory, identificationToPersonalInformations, isTriggered, registerPatient, sessionStorePrivateKeyName, toActualObject, updatePersonalIntoPopulatedWorkflowData, wasmPath };
5300
5537
  //# sourceMappingURL=oro-sdk.esm.js.map