oro-sdk 2.10.1 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/helpers/patient-registration.d.ts +20 -0
- package/dist/oro-sdk.cjs.development.js +208 -228
- package/dist/oro-sdk.cjs.development.js.map +1 -1
- package/dist/oro-sdk.cjs.production.min.js +1 -1
- package/dist/oro-sdk.cjs.production.min.js.map +1 -1
- package/dist/oro-sdk.esm.js +208 -228
- package/dist/oro-sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/helpers/patient-registration.ts +67 -75
@@ -1541,112 +1541,139 @@ function fillWorkflowFromPopulatedWorkflow(workflow, populatedWorkflow) {
|
|
1541
1541
|
}
|
1542
1542
|
|
1543
1543
|
var MAX_RETRIES = 15;
|
1544
|
+
/**
|
1545
|
+
* Completes a registration for a user retrying the complete flow a maximum of 15 times
|
1546
|
+
*
|
1547
|
+
* @description The order of importance when registering:
|
1548
|
+
* Creates a consultation if none exist
|
1549
|
+
* Retrieves or create's a lockbox if none exist
|
1550
|
+
* Grants the lockbox (if new) to all practitioners in the practice
|
1551
|
+
* Stores or fetches the patient data (without images)
|
1552
|
+
* Indexes the lockbox to the consult for all practitioners (done after inserting since index can be rebuilt from grants)
|
1553
|
+
* Stores the image data - done last since the majority of failure cases occur here
|
1554
|
+
* Creates the recovery payloads if they don't exist
|
1555
|
+
*
|
1556
|
+
* @param patientUuid
|
1557
|
+
* @param consultRequest
|
1558
|
+
* @param workflow
|
1559
|
+
* @param oroClient
|
1560
|
+
* @param masterKey
|
1561
|
+
* @param recoveryQA
|
1562
|
+
* @returns the successful registration
|
1563
|
+
*/
|
1564
|
+
|
1544
1565
|
function registerPatient(_x, _x2, _x3, _x4, _x5, _x6) {
|
1545
1566
|
return _registerPatient.apply(this, arguments);
|
1546
1567
|
}
|
1547
1568
|
/**
|
1548
|
-
*
|
1549
|
-
*
|
1550
|
-
* @param
|
1569
|
+
* Creates a consultation if one has not been created and fails to be retrieved by the payment intent
|
1570
|
+
* @param consult
|
1571
|
+
* @param oroClient
|
1572
|
+
* @returns the consult Uuid
|
1551
1573
|
*/
|
1552
1574
|
|
1553
1575
|
function _registerPatient() {
|
1554
|
-
_registerPatient = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
1555
|
-
var consult, lockboxUuid, practitionerAdmin, retry,
|
1576
|
+
_registerPatient = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(patientUuid, consultRequest, workflow, oroClient, masterKey, recoveryQA) {
|
1577
|
+
var consult, lockboxUuid, practitionerAdmin, retry, identity, errorsThrown, _ret;
|
1556
1578
|
|
1557
|
-
return runtime_1.wrap(function
|
1579
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
1558
1580
|
while (1) {
|
1559
|
-
switch (
|
1581
|
+
switch (_context4.prev = _context4.next) {
|
1560
1582
|
case 0:
|
1561
1583
|
consult = undefined;
|
1562
1584
|
lockboxUuid = undefined;
|
1563
1585
|
practitionerAdmin = undefined;
|
1564
1586
|
retry = MAX_RETRIES;
|
1565
|
-
|
1587
|
+
identity = undefined;
|
1588
|
+
errorsThrown = [];
|
1566
1589
|
|
1567
|
-
case
|
1590
|
+
case 6:
|
1568
1591
|
if (!(retry > 0)) {
|
1569
|
-
|
1592
|
+
_context4.next = 22;
|
1570
1593
|
break;
|
1571
1594
|
}
|
1572
1595
|
|
1573
|
-
|
1574
|
-
return
|
1575
|
-
var _consultIndex,
|
1596
|
+
_context4.prev = 7;
|
1597
|
+
return _context4.delegateYield( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
1598
|
+
var _consultIndex, _identity, _identity2;
|
1576
1599
|
|
1577
|
-
var practitioners, grantPromises, consultIndex, consultIndexPromises
|
1578
|
-
return runtime_1.wrap(function
|
1600
|
+
var practitioners, grantPromises, consultIndex, consultIndexPromises;
|
1601
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
1579
1602
|
while (1) {
|
1580
|
-
switch (
|
1603
|
+
switch (_context3.prev = _context3.next) {
|
1581
1604
|
case 0:
|
1582
|
-
|
1605
|
+
_context3.next = 2;
|
1583
1606
|
return new Promise(function (resolve) {
|
1584
1607
|
return setTimeout(resolve, 2000);
|
1585
1608
|
});
|
1586
1609
|
|
1587
1610
|
case 2:
|
1588
1611
|
if (practitionerAdmin) {
|
1589
|
-
|
1612
|
+
_context3.next = 6;
|
1590
1613
|
break;
|
1591
1614
|
}
|
1592
1615
|
|
1593
|
-
|
1616
|
+
_context3.next = 5;
|
1594
1617
|
return oroClient.practiceClient.practiceGetFromUuid(consultRequest.uuidPractice);
|
1595
1618
|
|
1596
1619
|
case 5:
|
1597
|
-
practitionerAdmin =
|
1620
|
+
practitionerAdmin = _context3.sent.uuidAdmin;
|
1598
1621
|
|
1599
1622
|
case 6:
|
1600
|
-
|
1623
|
+
_context3.next = 8;
|
1601
1624
|
return oroClient.practiceClient.practiceGetPractitioners(consultRequest.uuidPractice)["catch"](function (err) {
|
1602
1625
|
console.log("Error retrieving practitioners", err);
|
1603
1626
|
return [];
|
1604
1627
|
});
|
1605
1628
|
|
1606
1629
|
case 8:
|
1607
|
-
practitioners =
|
1630
|
+
practitioners = _context3.sent;
|
1608
1631
|
|
1609
1632
|
if (consult) {
|
1610
|
-
|
1633
|
+
_context3.next = 13;
|
1611
1634
|
break;
|
1612
1635
|
}
|
1613
1636
|
|
1614
|
-
|
1637
|
+
_context3.next = 12;
|
1615
1638
|
return getOrCreatePatientConsultationUuid(consultRequest, oroClient);
|
1616
1639
|
|
1617
1640
|
case 12:
|
1618
|
-
consult =
|
1641
|
+
consult = _context3.sent;
|
1619
1642
|
|
1620
1643
|
case 13:
|
1621
1644
|
if (lockboxUuid) {
|
1622
|
-
|
1645
|
+
_context3.next = 17;
|
1623
1646
|
break;
|
1624
1647
|
}
|
1625
1648
|
|
1626
|
-
|
1649
|
+
_context3.next = 16;
|
1627
1650
|
return getOrCreatePatientLockbox(oroClient);
|
1628
1651
|
|
1629
1652
|
case 16:
|
1630
|
-
lockboxUuid =
|
1653
|
+
lockboxUuid = _context3.sent;
|
1631
1654
|
|
1632
1655
|
case 17:
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1656
|
+
if (identity) {
|
1657
|
+
_context3.next = 21;
|
1658
|
+
break;
|
1659
|
+
}
|
1660
|
+
|
1661
|
+
_context3.next = 20;
|
1662
|
+
return oroClient.guardClient.identityGet(patientUuid);
|
1638
1663
|
|
1639
|
-
case
|
1640
|
-
|
1641
|
-
|
1664
|
+
case 20:
|
1665
|
+
identity = _context3.sent;
|
1666
|
+
|
1667
|
+
case 21:
|
1668
|
+
_context3.next = 23;
|
1642
1669
|
return oroClient.grantLockbox(practitionerAdmin, lockboxUuid)["catch"](function (err) {
|
1643
1670
|
console.error("Error while granting lockbox to practitioner admin " + practitionerAdmin, err); // if we cannot grant to the admin, then the registration will fail
|
1644
1671
|
|
1645
1672
|
// if we cannot grant to the admin, then the registration will fail
|
1646
|
-
|
1673
|
+
errorsThrown.push(err);
|
1647
1674
|
});
|
1648
1675
|
|
1649
|
-
case
|
1676
|
+
case 23:
|
1650
1677
|
// Patient Grant to practice
|
1651
1678
|
grantPromises = practitioners.filter(function (practitioner) {
|
1652
1679
|
return practitioner.uuid !== practitionerAdmin;
|
@@ -1657,10 +1684,11 @@ function _registerPatient() {
|
|
1657
1684
|
switch (_context.prev = _context.next) {
|
1658
1685
|
case 0:
|
1659
1686
|
return _context.abrupt("return", oroClient.grantLockbox(practitioner.uuid, lockboxUuid)["catch"](function (err) {
|
1660
|
-
console.error("Error while granting lockbox to practitioner", err); // Acceptable to continue as admin has already been granted, but we should still
|
1687
|
+
console.error("Error while granting lockbox to practitioner", err); // Acceptable to continue as admin has already been granted, but we should still retry until the last retry remains
|
1661
1688
|
|
1662
|
-
// Acceptable to continue as admin has already been granted, but we should still
|
1663
|
-
if (retry <= 1) return;
|
1689
|
+
// Acceptable to continue as admin has already been granted, but we should still retry until the last retry remains
|
1690
|
+
if (retry <= 1) return;
|
1691
|
+
errorsThrown.push(err);
|
1664
1692
|
}));
|
1665
1693
|
|
1666
1694
|
case 1:
|
@@ -1671,22 +1699,18 @@ function _registerPatient() {
|
|
1671
1699
|
}, _callee);
|
1672
1700
|
}));
|
1673
1701
|
|
1674
|
-
return function (
|
1702
|
+
return function (_x24) {
|
1675
1703
|
return _ref.apply(this, arguments);
|
1676
1704
|
};
|
1677
1705
|
}());
|
1678
|
-
_context4.next = 25;
|
1679
|
-
return storePatientData(consult.uuid, consultRequest.isoLanguageRequired, lockboxUuid, workflow, oroClient);
|
1680
|
-
|
1681
|
-
case 25:
|
1682
|
-
// the index will identify in which lockbox a consultation live
|
1683
1706
|
consultIndex = (_consultIndex = {}, _consultIndex[initApis.IndexKey.ConsultationLockbox] = [{
|
1684
1707
|
grant: {
|
1685
1708
|
lockboxUuid: lockboxUuid,
|
1686
1709
|
lockboxOwnerUuid: patientUuid
|
1687
1710
|
},
|
1688
1711
|
consultationId: consult.uuid
|
1689
|
-
}], _consultIndex);
|
1712
|
+
}], _consultIndex); // the index will identify in which lockbox a consultation resides
|
1713
|
+
|
1690
1714
|
consultIndexPromises = practitioners.map( /*#__PURE__*/function () {
|
1691
1715
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(practitioner) {
|
1692
1716
|
return runtime_1.wrap(function _callee2$(_context2) {
|
@@ -1694,10 +1718,10 @@ function _registerPatient() {
|
|
1694
1718
|
switch (_context2.prev = _context2.next) {
|
1695
1719
|
case 0:
|
1696
1720
|
return _context2.abrupt("return", oroClient.vaultIndexAdd(consultIndex, practitioner.uuid)["catch"](function (err) {
|
1697
|
-
console.error("Error while adding to the practitioner's index " + practitioner.uuid, err);
|
1721
|
+
console.error("[SDK: registration] Error while adding to the practitioner's index " + practitioner.uuid, err); // Acceptable to continue as the index can be rebuilt, but we should still retry until the last retry remains
|
1698
1722
|
|
1699
|
-
|
1700
|
-
return;
|
1723
|
+
// Acceptable to continue as the index can be rebuilt, but we should still retry until the last retry remains
|
1724
|
+
if (retry <= 1) return;else errorsThrown.push(err);
|
1701
1725
|
}));
|
1702
1726
|
|
1703
1727
|
case 1:
|
@@ -1708,198 +1732,156 @@ function _registerPatient() {
|
|
1708
1732
|
}, _callee2);
|
1709
1733
|
}));
|
1710
1734
|
|
1711
|
-
return function (
|
1735
|
+
return function (_x25) {
|
1712
1736
|
return _ref2.apply(this, arguments);
|
1713
1737
|
};
|
1714
|
-
}());
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
lockboxUuid: lockboxUuid,
|
1719
|
-
lockboxOwnerUuid: patientUuid
|
1720
|
-
},
|
1721
|
-
consultationId: consult.uuid
|
1722
|
-
}], _deprecatedConsultInd);
|
1723
|
-
deprecatedConsultIndexPromises = practitioners.map( /*#__PURE__*/function () {
|
1724
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(practitioner) {
|
1725
|
-
return runtime_1.wrap(function _callee3$(_context3) {
|
1726
|
-
while (1) {
|
1727
|
-
switch (_context3.prev = _context3.next) {
|
1728
|
-
case 0:
|
1729
|
-
return _context3.abrupt("return", oroClient.vaultIndexAdd(deprecatedConsultIndex, practitioner.uuid)["catch"](function (err) {
|
1730
|
-
console.error("Error while adding to the practitioner's index " + practitioner.uuid, err); /// it's acceptable to continue registration
|
1731
|
-
|
1732
|
-
/// it's acceptable to continue registration
|
1733
|
-
return;
|
1734
|
-
}));
|
1738
|
+
}());
|
1739
|
+
_context3.next = 28;
|
1740
|
+
return storeImageAliases(consult.uuid, lockboxUuid, workflow, oroClient)["catch"](function (err) {
|
1741
|
+
console.error('[SDK: registration] Some errors happened during image upload', err); // Acceptable to continue as images can be requested during the consultation, but we should still retry until the last retry remains
|
1735
1742
|
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
}
|
1740
|
-
}
|
1741
|
-
}, _callee3);
|
1742
|
-
}));
|
1743
|
+
// Acceptable to continue as images can be requested during the consultation, but we should still retry until the last retry remains
|
1744
|
+
if (retry <= 1) return;else errorsThrown.push(err);
|
1745
|
+
});
|
1743
1746
|
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1747
|
+
case 28:
|
1748
|
+
_context3.next = 30;
|
1749
|
+
return storePatientData(consult.uuid, consultRequest.isoLanguageRequired, lockboxUuid, workflow, oroClient)["catch"](function (err) {
|
1750
|
+
console.error('[SDK: registration] Some errors happened during patient data upload', err);
|
1751
|
+
errorsThrown.push(err);
|
1752
|
+
});
|
1748
1753
|
|
1749
|
-
|
1750
|
-
|
1754
|
+
case 30:
|
1755
|
+
if (!(masterKey && !((_identity = identity) != null && _identity.recoveryMasterKey))) {
|
1756
|
+
_context3.next = 36;
|
1751
1757
|
break;
|
1752
1758
|
}
|
1753
1759
|
|
1754
|
-
|
1760
|
+
_context3.next = 33;
|
1755
1761
|
return oroClient.updateMasterKey(patientUuid, masterKey, lockboxUuid)["catch"](function (err) {
|
1756
|
-
console.error("Error while updating master key", err); /// it's acceptable to continue registration
|
1762
|
+
console.error("[SDK: registration] Error while updating master key", err); /// it's acceptable to continue registration (return old identity)
|
1757
1763
|
|
1758
|
-
/// it's acceptable to continue registration
|
1759
|
-
return;
|
1764
|
+
/// it's acceptable to continue registration (return old identity)
|
1765
|
+
if (retry <= 1) return;
|
1766
|
+
errorsThrown.push(err);
|
1767
|
+
return identity;
|
1760
1768
|
});
|
1761
1769
|
|
1762
|
-
case
|
1763
|
-
|
1770
|
+
case 33:
|
1771
|
+
identity = _context3.sent;
|
1772
|
+
_context3.next = 37;
|
1764
1773
|
break;
|
1765
1774
|
|
1766
|
-
case
|
1775
|
+
case 36:
|
1767
1776
|
// we did not set the master key so we do not return it
|
1768
1777
|
masterKey = undefined;
|
1769
1778
|
|
1770
|
-
case
|
1771
|
-
if (!(recoveryQA && !
|
1772
|
-
|
1779
|
+
case 37:
|
1780
|
+
if (!(recoveryQA && !((_identity2 = identity) != null && _identity2.recoverySecurityQuestions))) {
|
1781
|
+
_context3.next = 41;
|
1773
1782
|
break;
|
1774
1783
|
}
|
1775
1784
|
|
1776
|
-
|
1785
|
+
_context3.next = 40;
|
1777
1786
|
return oroClient.updateSecurityQuestions(patientUuid, recoveryQA.recoverySecurityQuestions, recoveryQA.recoverySecurityAnswers, 2)["catch"](function (err) {
|
1778
|
-
console.error("Error while updating security questions", err); /// it's acceptable to continue registration
|
1787
|
+
console.error("[SDK: registration] Error while updating security questions", err); /// it's acceptable to continue registration (return old identity)
|
1779
1788
|
|
1780
|
-
/// it's acceptable to continue registration
|
1781
|
-
return;
|
1789
|
+
/// it's acceptable to continue registration (return old identity)
|
1790
|
+
if (retry <= 1) return;
|
1791
|
+
errorsThrown.push(err);
|
1792
|
+
return identity;
|
1782
1793
|
});
|
1783
1794
|
|
1784
|
-
case 38:
|
1785
|
-
_context4.next = 40;
|
1786
|
-
return Promise.all([].concat(grantPromises, consultIndexPromises, deprecatedConsultIndexPromises));
|
1787
|
-
|
1788
1795
|
case 40:
|
1789
|
-
|
1796
|
+
identity = _context3.sent;
|
1797
|
+
|
1798
|
+
case 41:
|
1799
|
+
_context3.next = 43;
|
1800
|
+
return Promise.all([].concat(grantPromises, consultIndexPromises));
|
1801
|
+
|
1802
|
+
case 43:
|
1803
|
+
if (!(errorsThrown.length > 0)) {
|
1804
|
+
_context3.next = 45;
|
1805
|
+
break;
|
1806
|
+
}
|
1807
|
+
|
1808
|
+
throw errorsThrown;
|
1809
|
+
|
1810
|
+
case 45:
|
1811
|
+
_context3.next = 47;
|
1790
1812
|
return oroClient.consultClient.updateConsultByUUID(consult.uuid, {
|
1791
1813
|
statusMedical: initApis.MedicalStatus.New
|
1792
1814
|
});
|
1793
1815
|
|
1794
|
-
case
|
1795
|
-
return
|
1816
|
+
case 47:
|
1817
|
+
return _context3.abrupt("return", "break");
|
1796
1818
|
|
1797
|
-
case
|
1819
|
+
case 48:
|
1798
1820
|
case "end":
|
1799
|
-
return
|
1821
|
+
return _context3.stop();
|
1800
1822
|
}
|
1801
1823
|
}
|
1802
|
-
},
|
1803
|
-
})(), "t0",
|
1824
|
+
}, _callee3);
|
1825
|
+
})(), "t0", 9);
|
1804
1826
|
|
1805
|
-
case
|
1806
|
-
_ret =
|
1827
|
+
case 9:
|
1828
|
+
_ret = _context4.t0;
|
1807
1829
|
|
1808
1830
|
if (!(_ret === "break")) {
|
1809
|
-
|
1831
|
+
_context4.next = 12;
|
1810
1832
|
break;
|
1811
1833
|
}
|
1812
1834
|
|
1813
|
-
return
|
1835
|
+
return _context4.abrupt("break", 22);
|
1814
1836
|
|
1815
|
-
case
|
1816
|
-
|
1837
|
+
case 12:
|
1838
|
+
_context4.next = 19;
|
1817
1839
|
break;
|
1818
1840
|
|
1819
|
-
case
|
1820
|
-
|
1821
|
-
|
1822
|
-
console.error("Error occured during registration, retrying... Retries remaining: " + retry);
|
1823
|
-
|
1841
|
+
case 14:
|
1842
|
+
_context4.prev = 14;
|
1843
|
+
_context4.t1 = _context4["catch"](7);
|
1844
|
+
console.error("[SDK] Error occured during registration: " + _context4.t1 + ", retrying... Retries remaining: " + retry);
|
1845
|
+
errorsThrown = [];
|
1846
|
+
return _context4.abrupt("continue", 19);
|
1824
1847
|
|
1825
|
-
case
|
1848
|
+
case 19:
|
1826
1849
|
retry--;
|
1827
|
-
|
1850
|
+
_context4.next = 6;
|
1828
1851
|
break;
|
1829
1852
|
|
1830
|
-
case
|
1853
|
+
case 22:
|
1831
1854
|
if (!(retry <= 0)) {
|
1832
|
-
|
1855
|
+
_context4.next = 25;
|
1833
1856
|
break;
|
1834
1857
|
}
|
1835
1858
|
|
1836
|
-
console.error('registration failed: MAX_RETRIES reached');
|
1859
|
+
console.error('[SDK] registration failed: MAX_RETRIES reached');
|
1837
1860
|
throw 'RegistrationFailed';
|
1838
1861
|
|
1839
|
-
case
|
1862
|
+
case 25:
|
1840
1863
|
console.log('Successfully Registered');
|
1841
|
-
|
1864
|
+
_context4.next = 28;
|
1842
1865
|
return oroClient.cleanIndex();
|
1843
1866
|
|
1844
|
-
case
|
1845
|
-
return
|
1867
|
+
case 28:
|
1868
|
+
return _context4.abrupt("return", {
|
1846
1869
|
masterKey: masterKey,
|
1847
1870
|
consultationId: consult.uuid,
|
1848
1871
|
lockboxUuid: lockboxUuid
|
1849
1872
|
});
|
1850
1873
|
|
1851
|
-
case
|
1874
|
+
case 29:
|
1852
1875
|
case "end":
|
1853
|
-
return
|
1876
|
+
return _context4.stop();
|
1854
1877
|
}
|
1855
1878
|
}
|
1856
|
-
},
|
1879
|
+
}, _callee4, null, [[7, 14]]);
|
1857
1880
|
}));
|
1858
1881
|
return _registerPatient.apply(this, arguments);
|
1859
1882
|
}
|
1860
1883
|
|
1861
|
-
function
|
1862
|
-
return _patientConsultExists.apply(this, arguments);
|
1863
|
-
}
|
1864
|
-
/**
|
1865
|
-
* Creates a consultation if one has not been created and fails to be retrieved by the payment intent
|
1866
|
-
* @param consult
|
1867
|
-
* @param oroClient
|
1868
|
-
* @returns the consult Uuid
|
1869
|
-
*/
|
1870
|
-
|
1871
|
-
|
1872
|
-
function _patientConsultExists() {
|
1873
|
-
_patientConsultExists = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(currentConsultation, lockboxUuid, oroClient) {
|
1874
|
-
var publicMetadata, manifest;
|
1875
|
-
return runtime_1.wrap(function _callee6$(_context6) {
|
1876
|
-
while (1) {
|
1877
|
-
switch (_context6.prev = _context6.next) {
|
1878
|
-
case 0:
|
1879
|
-
publicMetadata = {
|
1880
|
-
category: initApis.MetadataCategory.Consultation,
|
1881
|
-
documentType: initApis.DocumentType.PopulatedWorkflowData
|
1882
|
-
};
|
1883
|
-
_context6.next = 3;
|
1884
|
-
return oroClient.vaultClient.lockboxMetadataGet(lockboxUuid, ['consultationId'], [], publicMetadata);
|
1885
|
-
|
1886
|
-
case 3:
|
1887
|
-
manifest = _context6.sent;
|
1888
|
-
return _context6.abrupt("return", manifest[0].findIndex(function (v) {
|
1889
|
-
return v.consultationId != null && v.consultationId !== currentConsultation.uuid;
|
1890
|
-
}) !== -1);
|
1891
|
-
|
1892
|
-
case 5:
|
1893
|
-
case "end":
|
1894
|
-
return _context6.stop();
|
1895
|
-
}
|
1896
|
-
}
|
1897
|
-
}, _callee6);
|
1898
|
-
}));
|
1899
|
-
return _patientConsultExists.apply(this, arguments);
|
1900
|
-
}
|
1901
|
-
|
1902
|
-
function getOrCreatePatientConsultationUuid(_x10, _x11) {
|
1884
|
+
function getOrCreatePatientConsultationUuid(_x7, _x8) {
|
1903
1885
|
return _getOrCreatePatientConsultationUuid.apply(this, arguments);
|
1904
1886
|
}
|
1905
1887
|
/**
|
@@ -1910,49 +1892,49 @@ function getOrCreatePatientConsultationUuid(_x10, _x11) {
|
|
1910
1892
|
|
1911
1893
|
|
1912
1894
|
function _getOrCreatePatientConsultationUuid() {
|
1913
|
-
_getOrCreatePatientConsultationUuid = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
1895
|
+
_getOrCreatePatientConsultationUuid = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(consult, oroClient) {
|
1914
1896
|
var payment;
|
1915
|
-
return runtime_1.wrap(function
|
1897
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
1916
1898
|
while (1) {
|
1917
|
-
switch (
|
1899
|
+
switch (_context5.prev = _context5.next) {
|
1918
1900
|
case 0:
|
1919
|
-
|
1901
|
+
_context5.next = 2;
|
1920
1902
|
return oroClient.practiceClient.practiceGetPayment(consult.uuidPractice, consult.idStripeInvoiceOrPaymentIntent);
|
1921
1903
|
|
1922
1904
|
case 2:
|
1923
|
-
payment =
|
1905
|
+
payment = _context5.sent;
|
1924
1906
|
|
1925
1907
|
if (!(payment && payment.uuidConsult)) {
|
1926
|
-
|
1908
|
+
_context5.next = 7;
|
1927
1909
|
break;
|
1928
1910
|
}
|
1929
1911
|
|
1930
|
-
return
|
1912
|
+
return _context5.abrupt("return", oroClient.consultClient.getConsultByUUID(payment.uuidConsult)["catch"](function (err) {
|
1931
1913
|
console.error('Error while retrieving consult', err);
|
1932
1914
|
throw err;
|
1933
1915
|
}));
|
1934
1916
|
|
1935
1917
|
case 7:
|
1936
|
-
|
1918
|
+
_context5.next = 9;
|
1937
1919
|
return oroClient.consultClient.consultCreate(consult)["catch"](function (err) {
|
1938
1920
|
console.error('Error while creating consult', err);
|
1939
1921
|
throw err;
|
1940
1922
|
});
|
1941
1923
|
|
1942
1924
|
case 9:
|
1943
|
-
return
|
1925
|
+
return _context5.abrupt("return", _context5.sent);
|
1944
1926
|
|
1945
1927
|
case 10:
|
1946
1928
|
case "end":
|
1947
|
-
return
|
1929
|
+
return _context5.stop();
|
1948
1930
|
}
|
1949
1931
|
}
|
1950
|
-
},
|
1932
|
+
}, _callee5);
|
1951
1933
|
}));
|
1952
1934
|
return _getOrCreatePatientConsultationUuid.apply(this, arguments);
|
1953
1935
|
}
|
1954
1936
|
|
1955
|
-
function getOrCreatePatientLockbox(
|
1937
|
+
function getOrCreatePatientLockbox(_x9) {
|
1956
1938
|
return _getOrCreatePatientLockbox.apply(this, arguments);
|
1957
1939
|
}
|
1958
1940
|
/**
|
@@ -1967,59 +1949,57 @@ function getOrCreatePatientLockbox(_x12) {
|
|
1967
1949
|
|
1968
1950
|
|
1969
1951
|
function _getOrCreatePatientLockbox() {
|
1970
|
-
_getOrCreatePatientLockbox = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
1952
|
+
_getOrCreatePatientLockbox = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(oroClient) {
|
1971
1953
|
var grants;
|
1972
|
-
return runtime_1.wrap(function
|
1954
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
1973
1955
|
while (1) {
|
1974
|
-
switch (
|
1956
|
+
switch (_context6.prev = _context6.next) {
|
1975
1957
|
case 0:
|
1976
|
-
|
1958
|
+
_context6.next = 2;
|
1977
1959
|
return oroClient.getGrants(undefined, true);
|
1978
1960
|
|
1979
1961
|
case 2:
|
1980
|
-
grants =
|
1962
|
+
grants = _context6.sent;
|
1981
1963
|
|
1982
1964
|
if (!(grants.length > 0)) {
|
1983
|
-
|
1965
|
+
_context6.next = 8;
|
1984
1966
|
break;
|
1985
1967
|
}
|
1986
1968
|
|
1987
1969
|
console.log('The grant has already been created, skipping lockbox create step');
|
1988
|
-
return
|
1970
|
+
return _context6.abrupt("return", grants[0].lockboxUuid);
|
1989
1971
|
|
1990
1972
|
case 8:
|
1991
|
-
|
1973
|
+
_context6.next = 10;
|
1992
1974
|
return oroClient.vaultClient.lockboxCreate()["catch"](function (err) {
|
1993
1975
|
console.error('Error while creating lockbox', err);
|
1994
1976
|
throw err;
|
1995
1977
|
});
|
1996
1978
|
|
1997
1979
|
case 10:
|
1998
|
-
return
|
1980
|
+
return _context6.abrupt("return", _context6.sent.lockboxUuid);
|
1999
1981
|
|
2000
1982
|
case 11:
|
2001
1983
|
case "end":
|
2002
|
-
return
|
1984
|
+
return _context6.stop();
|
2003
1985
|
}
|
2004
1986
|
}
|
2005
|
-
},
|
1987
|
+
}, _callee6);
|
2006
1988
|
}));
|
2007
1989
|
return _getOrCreatePatientLockbox.apply(this, arguments);
|
2008
1990
|
}
|
2009
1991
|
|
2010
|
-
function storePatientData(
|
1992
|
+
function storePatientData(_x10, _x11, _x12, _x13, _x14) {
|
2011
1993
|
return _storePatientData.apply(this, arguments);
|
2012
1994
|
}
|
2013
1995
|
|
2014
1996
|
function _storePatientData() {
|
2015
|
-
_storePatientData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
2016
|
-
return runtime_1.wrap(function
|
1997
|
+
_storePatientData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(consultationId, isoLanguage, lockboxUuid, workflow, oroClient) {
|
1998
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
2017
1999
|
while (1) {
|
2018
|
-
switch (
|
2000
|
+
switch (_context7.prev = _context7.next) {
|
2019
2001
|
case 0:
|
2020
|
-
return
|
2021
|
-
console.error('[SDK] Some errors happened during image upload', err);
|
2022
|
-
}), // Storing Raw data first
|
2002
|
+
return _context7.abrupt("return", Promise.all([// Storing Raw data first
|
2023
2003
|
oroClient.getOrInsertJsonData(lockboxUuid, workflow, {
|
2024
2004
|
category: initApis.MetadataCategory.Raw,
|
2025
2005
|
contentType: 'application/json',
|
@@ -2049,15 +2029,15 @@ function _storePatientData() {
|
|
2049
2029
|
|
2050
2030
|
case 1:
|
2051
2031
|
case "end":
|
2052
|
-
return
|
2032
|
+
return _context7.stop();
|
2053
2033
|
}
|
2054
2034
|
}
|
2055
|
-
},
|
2035
|
+
}, _callee7);
|
2056
2036
|
}));
|
2057
2037
|
return _storePatientData.apply(this, arguments);
|
2058
2038
|
}
|
2059
2039
|
|
2060
|
-
function storeImageAliases(
|
2040
|
+
function storeImageAliases(_x15, _x16, _x17, _x18) {
|
2061
2041
|
return _storeImageAliases.apply(this, arguments);
|
2062
2042
|
}
|
2063
2043
|
/**
|
@@ -2072,23 +2052,23 @@ function storeImageAliases(_x18, _x19, _x20, _x21) {
|
|
2072
2052
|
|
2073
2053
|
|
2074
2054
|
function _storeImageAliases() {
|
2075
|
-
_storeImageAliases = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
2055
|
+
_storeImageAliases = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(consultationId, lockboxUuid, workflow, oroClient) {
|
2076
2056
|
var images, nonNullImages, promises;
|
2077
|
-
return runtime_1.wrap(function
|
2057
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
2078
2058
|
while (1) {
|
2079
|
-
switch (
|
2059
|
+
switch (_context8.prev = _context8.next) {
|
2080
2060
|
case 0:
|
2081
|
-
|
2082
|
-
|
2061
|
+
_context8.t0 = getImagesFromIndexDb;
|
2062
|
+
_context8.next = 3;
|
2083
2063
|
return filterTriggeredAnsweredWithKind(workflow, 'images-alias');
|
2084
2064
|
|
2085
2065
|
case 3:
|
2086
|
-
|
2087
|
-
|
2088
|
-
return (0,
|
2066
|
+
_context8.t1 = _context8.sent.flat();
|
2067
|
+
_context8.next = 6;
|
2068
|
+
return (0, _context8.t0)(_context8.t1);
|
2089
2069
|
|
2090
2070
|
case 6:
|
2091
|
-
images =
|
2071
|
+
images = _context8.sent;
|
2092
2072
|
nonNullImages = images.filter(function (img) {
|
2093
2073
|
return !!img;
|
2094
2074
|
});
|
@@ -2105,29 +2085,29 @@ function _storeImageAliases() {
|
|
2105
2085
|
idbId: image.idbId
|
2106
2086
|
}, {});
|
2107
2087
|
});
|
2108
|
-
return
|
2088
|
+
return _context8.abrupt("return", Promise.all(promises));
|
2109
2089
|
|
2110
2090
|
case 11:
|
2111
2091
|
case "end":
|
2112
|
-
return
|
2092
|
+
return _context8.stop();
|
2113
2093
|
}
|
2114
2094
|
}
|
2115
|
-
},
|
2095
|
+
}, _callee8);
|
2116
2096
|
}));
|
2117
2097
|
return _storeImageAliases.apply(this, arguments);
|
2118
2098
|
}
|
2119
2099
|
|
2120
|
-
function extractAndStorePersonalWorkflowData(
|
2100
|
+
function extractAndStorePersonalWorkflowData(_x19, _x20, _x21, _x22, _x23) {
|
2121
2101
|
return _extractAndStorePersonalWorkflowData.apply(this, arguments);
|
2122
2102
|
}
|
2123
2103
|
|
2124
2104
|
function _extractAndStorePersonalWorkflowData() {
|
2125
|
-
_extractAndStorePersonalWorkflowData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
2126
|
-
return runtime_1.wrap(function
|
2105
|
+
_extractAndStorePersonalWorkflowData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(workflow, lockboxUuid, consultationId, category, oroClient) {
|
2106
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
2127
2107
|
while (1) {
|
2128
|
-
switch (
|
2108
|
+
switch (_context9.prev = _context9.next) {
|
2129
2109
|
case 0:
|
2130
|
-
return
|
2110
|
+
return _context9.abrupt("return", getWorkflowDataByCategory(workflow, category).then(function (data) {
|
2131
2111
|
if (Object.keys(data.fields).length === 0) return;
|
2132
2112
|
return oroClient.getOrInsertJsonData(lockboxUuid, data, {
|
2133
2113
|
category: category,
|
@@ -2138,10 +2118,10 @@ function _extractAndStorePersonalWorkflowData() {
|
|
2138
2118
|
|
2139
2119
|
case 1:
|
2140
2120
|
case "end":
|
2141
|
-
return
|
2121
|
+
return _context9.stop();
|
2142
2122
|
}
|
2143
2123
|
}
|
2144
|
-
},
|
2124
|
+
}, _callee9);
|
2145
2125
|
}));
|
2146
2126
|
return _extractAndStorePersonalWorkflowData.apply(this, arguments);
|
2147
2127
|
}
|