oro-sdk 3.3.1 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,12 +18,13 @@ import { OroClient, RegisterPatientOutput } from '..';
18
18
  * @param oroClient
19
19
  * @param masterKey
20
20
  * @param recoveryQA
21
+ * @param indexSearch create search index for the consultation if true
21
22
  * @returns the successful registration
22
23
  */
23
24
  export declare function registerPatient(patientUuid: Uuid, consultRequest: ConsultRequest, workflow: WorkflowData, oroClient: OroClient, masterKey?: Uuid, recoveryQA?: {
24
25
  recoverySecurityQuestions: string[];
25
26
  recoverySecurityAnswers: string[];
26
- }): Promise<RegisterPatientOutput>;
27
+ }, indexSearch?: boolean): Promise<RegisterPatientOutput>;
27
28
  /**
28
29
  * Extracts the workflow MetadataCategory for Personal, ChildPersonal and OtherPersonal
29
30
  * then stores it in the vault
@@ -1567,10 +1567,11 @@ var MAX_RETRIES = 15;
1567
1567
  * @param oroClient
1568
1568
  * @param masterKey
1569
1569
  * @param recoveryQA
1570
+ * @param indexSearch create search index for the consultation if true
1570
1571
  * @returns the successful registration
1571
1572
  */
1572
1573
 
1573
- function registerPatient(_x, _x2, _x3, _x4, _x5, _x6) {
1574
+ function registerPatient(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
1574
1575
  return _registerPatient.apply(this, arguments);
1575
1576
  }
1576
1577
  /**
@@ -1581,13 +1582,17 @@ function registerPatient(_x, _x2, _x3, _x4, _x5, _x6) {
1581
1582
  */
1582
1583
 
1583
1584
  function _registerPatient() {
1584
- _registerPatient = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(patientUuid, consultRequest, workflow, oroClient, masterKey, recoveryQA) {
1585
+ _registerPatient = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(patientUuid, consultRequest, workflow, oroClient, masterKey, recoveryQA, indexSearch) {
1585
1586
  var consult, lockboxUuid, practitionerAdmin, retry, identity, errorsThrown, _ret;
1586
1587
 
1587
1588
  return runtime_1.wrap(function _callee4$(_context4) {
1588
1589
  while (1) {
1589
1590
  switch (_context4.prev = _context4.next) {
1590
1591
  case 0:
1592
+ if (indexSearch === void 0) {
1593
+ indexSearch = true;
1594
+ }
1595
+
1591
1596
  consult = undefined;
1592
1597
  lockboxUuid = undefined;
1593
1598
  practitionerAdmin = undefined;
@@ -1595,13 +1600,13 @@ function _registerPatient() {
1595
1600
  identity = undefined;
1596
1601
  errorsThrown = [];
1597
1602
 
1598
- case 6:
1603
+ case 7:
1599
1604
  if (!(retry > 0)) {
1600
- _context4.next = 22;
1605
+ _context4.next = 23;
1601
1606
  break;
1602
1607
  }
1603
1608
 
1604
- _context4.prev = 7;
1609
+ _context4.prev = 8;
1605
1610
  return _context4.delegateYield( /*#__PURE__*/runtime_1.mark(function _callee3() {
1606
1611
  var _consultIndex, _identity, _identity2;
1607
1612
 
@@ -1707,7 +1712,7 @@ function _registerPatient() {
1707
1712
  }, _callee);
1708
1713
  }));
1709
1714
 
1710
- return function (_x28) {
1715
+ return function (_x29) {
1711
1716
  return _ref.apply(this, arguments);
1712
1717
  };
1713
1718
  }());
@@ -1740,7 +1745,7 @@ function _registerPatient() {
1740
1745
  }, _callee2);
1741
1746
  }));
1742
1747
 
1743
- return function (_x29) {
1748
+ return function (_x30) {
1744
1749
  return _ref2.apply(this, arguments);
1745
1750
  };
1746
1751
  }());
@@ -1808,7 +1813,12 @@ function _registerPatient() {
1808
1813
  return Promise.all([].concat(grantPromises, consultIndexPromises));
1809
1814
 
1810
1815
  case 43:
1811
- _context3.next = 45;
1816
+ if (!indexSearch) {
1817
+ _context3.next = 46;
1818
+ break;
1819
+ }
1820
+
1821
+ _context3.next = 46;
1812
1822
  return buildConsultSearchIndex(consult, workflow, oroClient)["catch"](function (err) {
1813
1823
  console.error('[SDK: registration] personal information not found or another error occured during search indexing', err);
1814
1824
  if (retry <= 1) return; // this statement is to avoid failing the registration due to the failure in search indexing the consult, this practically implements a soft retry
@@ -1817,89 +1827,89 @@ function _registerPatient() {
1817
1827
  errorsThrown.push(err);
1818
1828
  });
1819
1829
 
1820
- case 45:
1830
+ case 46:
1821
1831
  if (!(errorsThrown.length > 0)) {
1822
- _context3.next = 47;
1832
+ _context3.next = 48;
1823
1833
  break;
1824
1834
  }
1825
1835
 
1826
1836
  throw errorsThrown;
1827
1837
 
1828
- case 47:
1829
- _context3.next = 49;
1838
+ case 48:
1839
+ _context3.next = 50;
1830
1840
  return oroClient.consultClient.updateConsultByUUID(consult.uuid, {
1831
1841
  statusMedical: initApis.MedicalStatus.New
1832
1842
  });
1833
1843
 
1834
- case 49:
1844
+ case 50:
1835
1845
  return _context3.abrupt("return", "break");
1836
1846
 
1837
- case 50:
1847
+ case 51:
1838
1848
  case "end":
1839
1849
  return _context3.stop();
1840
1850
  }
1841
1851
  }
1842
1852
  }, _callee3);
1843
- })(), "t0", 9);
1853
+ })(), "t0", 10);
1844
1854
 
1845
- case 9:
1855
+ case 10:
1846
1856
  _ret = _context4.t0;
1847
1857
 
1848
1858
  if (!(_ret === "break")) {
1849
- _context4.next = 12;
1859
+ _context4.next = 13;
1850
1860
  break;
1851
1861
  }
1852
1862
 
1853
- return _context4.abrupt("break", 22);
1863
+ return _context4.abrupt("break", 23);
1854
1864
 
1855
- case 12:
1856
- _context4.next = 19;
1865
+ case 13:
1866
+ _context4.next = 20;
1857
1867
  break;
1858
1868
 
1859
- case 14:
1860
- _context4.prev = 14;
1861
- _context4.t1 = _context4["catch"](7);
1869
+ case 15:
1870
+ _context4.prev = 15;
1871
+ _context4.t1 = _context4["catch"](8);
1862
1872
  console.error("[SDK] Error occured during registration: " + _context4.t1 + ", retrying... Retries remaining: " + retry);
1863
1873
  errorsThrown = [];
1864
- return _context4.abrupt("continue", 19);
1874
+ return _context4.abrupt("continue", 20);
1865
1875
 
1866
- case 19:
1876
+ case 20:
1867
1877
  retry--;
1868
- _context4.next = 6;
1878
+ _context4.next = 7;
1869
1879
  break;
1870
1880
 
1871
- case 22:
1881
+ case 23:
1872
1882
  if (!(retry <= 0)) {
1873
- _context4.next = 25;
1883
+ _context4.next = 26;
1874
1884
  break;
1875
1885
  }
1876
1886
 
1877
1887
  console.error('[SDK] registration failed: MAX_RETRIES reached');
1878
1888
  throw 'RegistrationFailed';
1879
1889
 
1880
- case 25:
1890
+ case 26:
1881
1891
  console.log('Successfully Registered');
1882
- _context4.next = 28;
1892
+ _context4.next = 29;
1883
1893
  return oroClient.cleanIndex();
1884
1894
 
1885
- case 28:
1895
+ case 29:
1886
1896
  return _context4.abrupt("return", {
1887
1897
  masterKey: masterKey,
1888
1898
  consultationId: consult.uuid,
1889
1899
  lockboxUuid: lockboxUuid
1890
1900
  });
1891
1901
 
1892
- case 29:
1902
+ case 30:
1893
1903
  case "end":
1894
1904
  return _context4.stop();
1895
1905
  }
1896
1906
  }
1897
- }, _callee4, null, [[7, 14]]);
1907
+ }, _callee4, null, [[8, 15]]);
1898
1908
  }));
1899
1909
  return _registerPatient.apply(this, arguments);
1900
1910
  }
1901
1911
 
1902
- function getOrCreatePatientConsultationUuid(_x7, _x8) {
1912
+ function getOrCreatePatientConsultationUuid(_x8, _x9) {
1903
1913
  return _getOrCreatePatientConsultationUuid.apply(this, arguments);
1904
1914
  }
1905
1915
  /**
@@ -1952,7 +1962,7 @@ function _getOrCreatePatientConsultationUuid() {
1952
1962
  return _getOrCreatePatientConsultationUuid.apply(this, arguments);
1953
1963
  }
1954
1964
 
1955
- function getOrCreatePatientLockbox(_x9) {
1965
+ function getOrCreatePatientLockbox(_x10) {
1956
1966
  return _getOrCreatePatientLockbox.apply(this, arguments);
1957
1967
  }
1958
1968
  /**
@@ -2007,7 +2017,7 @@ function _getOrCreatePatientLockbox() {
2007
2017
  return _getOrCreatePatientLockbox.apply(this, arguments);
2008
2018
  }
2009
2019
 
2010
- function storePatientData(_x10, _x11, _x12, _x13, _x14) {
2020
+ function storePatientData(_x11, _x12, _x13, _x14, _x15) {
2011
2021
  return _storePatientData.apply(this, arguments);
2012
2022
  }
2013
2023
 
@@ -2055,7 +2065,7 @@ function _storePatientData() {
2055
2065
  return _storePatientData.apply(this, arguments);
2056
2066
  }
2057
2067
 
2058
- function storeImageAliases(_x15, _x16, _x17, _x18) {
2068
+ function storeImageAliases(_x16, _x17, _x18, _x19) {
2059
2069
  return _storeImageAliases.apply(this, arguments);
2060
2070
  }
2061
2071
  /**
@@ -2115,7 +2125,7 @@ function _storeImageAliases() {
2115
2125
  return _storeImageAliases.apply(this, arguments);
2116
2126
  }
2117
2127
 
2118
- function extractAndStorePersonalWorkflowData(_x19, _x20, _x21, _x22, _x23) {
2128
+ function extractAndStorePersonalWorkflowData(_x20, _x21, _x22, _x23, _x24) {
2119
2129
  return _extractAndStorePersonalWorkflowData.apply(this, arguments);
2120
2130
  }
2121
2131
  /**
@@ -2148,7 +2158,7 @@ function _extractAndStorePersonalWorkflowData() {
2148
2158
  return _extractAndStorePersonalWorkflowData.apply(this, arguments);
2149
2159
  }
2150
2160
 
2151
- function extractPersonalInfoFromWorkflowData(_x24) {
2161
+ function extractPersonalInfoFromWorkflowData(_x25) {
2152
2162
  return _extractPersonalInfoFromWorkflowData.apply(this, arguments);
2153
2163
  }
2154
2164
  /**
@@ -2185,7 +2195,7 @@ function _extractPersonalInfoFromWorkflowData() {
2185
2195
  return _extractPersonalInfoFromWorkflowData.apply(this, arguments);
2186
2196
  }
2187
2197
 
2188
- function buildConsultSearchIndex(_x25, _x26, _x27) {
2198
+ function buildConsultSearchIndex(_x26, _x27, _x28) {
2189
2199
  return _buildConsultSearchIndex.apply(this, arguments);
2190
2200
  }
2191
2201