oro-sdk 5.3.2 → 5.3.5

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