oro-sdk 5.3.1 → 5.3.4

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