oro-sdk 3.1.2-dev2 → 3.2.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.
@@ -1804,24 +1804,27 @@ function _registerPatient() {
1804
1804
  return Promise.all([].concat(grantPromises, consultIndexPromises));
1805
1805
 
1806
1806
  case 43:
1807
+ _context3.next = 45;
1808
+ return buildConsultSearchIndex(consult.uuid, workflow, oroClient)["catch"](function (err) {
1809
+ console.error('[SDK: registration] personal information not found or another error occured during search indexing', err);
1810
+ 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
1811
+
1812
+ // this statement is to avoid failing the registration due to the failure in search indexing the consult, this practically implements a soft retry
1813
+ errorsThrown.push(err);
1814
+ });
1815
+
1816
+ case 45:
1807
1817
  if (!(errorsThrown.length > 0)) {
1808
- _context3.next = 45;
1818
+ _context3.next = 47;
1809
1819
  break;
1810
1820
  }
1811
1821
 
1812
1822
  throw errorsThrown;
1813
1823
 
1814
- case 45:
1815
- _context3.next = 47;
1816
- return oroClient.consultClient.updateConsultByUUID(consult.uuid, {
1817
- statusMedical: MedicalStatus.New
1818
- });
1819
-
1820
1824
  case 47:
1821
1825
  _context3.next = 49;
1822
- return searchIndexConsultation(consult.uuid, oroClient)["catch"](function (err) {
1823
- console.error('[SDK: registration] personal information not found or another error occured during search indexing', err);
1824
- errorsThrown.push(err);
1826
+ return oroClient.consultClient.updateConsultByUUID(consult.uuid, {
1827
+ statusMedical: MedicalStatus.New
1825
1828
  });
1826
1829
 
1827
1830
  case 49:
@@ -2111,6 +2114,10 @@ function _storeImageAliases() {
2111
2114
  function extractAndStorePersonalWorkflowData(_x19, _x20, _x21, _x22, _x23) {
2112
2115
  return _extractAndStorePersonalWorkflowData.apply(this, arguments);
2113
2116
  }
2117
+ /**
2118
+ * Given workflow data, it populates it with Personal, ChildPersonal, and OtherPersonal workflow data
2119
+ * @param workflow
2120
+ */
2114
2121
 
2115
2122
  function _extractAndStorePersonalWorkflowData() {
2116
2123
  _extractAndStorePersonalWorkflowData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(workflow, lockboxUuid, consultationId, category, oroClient) {
@@ -2137,55 +2144,30 @@ function _extractAndStorePersonalWorkflowData() {
2137
2144
  return _extractAndStorePersonalWorkflowData.apply(this, arguments);
2138
2145
  }
2139
2146
 
2140
- function extractPersonalInfoFromConsultId(_x24, _x25) {
2141
- return _extractPersonalInfoFromConsultId.apply(this, arguments);
2147
+ function extractPersonalInfoFromWorkflowData(_x24) {
2148
+ return _extractPersonalInfoFromWorkflowData.apply(this, arguments);
2142
2149
  }
2150
+ /**
2151
+ * Creates the search index for the first and last name of the given consultation
2152
+ * @param consultUuid the uuid of the consult to be search indexed
2153
+ * @param workflow the workflow data
2154
+ * @param oroClient
2155
+ */
2143
2156
 
2144
- function _extractPersonalInfoFromConsultId() {
2145
- _extractPersonalInfoFromConsultId = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(consultUuid, oroClient) {
2157
+ function _extractPersonalInfoFromWorkflowData() {
2158
+ _extractPersonalInfoFromWorkflowData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(workflow) {
2146
2159
  return runtime_1.wrap(function _callee10$(_context10) {
2147
2160
  while (1) {
2148
2161
  switch (_context10.prev = _context10.next) {
2149
2162
  case 0:
2150
- return _context10.abrupt("return", Promise.all([// Retrieve MetadataCategory.Personal in any case
2151
- oroClient.getPersonalInformationsFromConsultId(consultUuid, MetadataCategory.Personal, true).then(function (personalInformations) {
2152
- if (!personalInformations[0]) {
2153
- console.error(MetadataCategory.Personal + " informations not found for consult:", consultUuid);
2154
- throw Error('No self personal information found');
2155
- }
2156
-
2157
- return personalInformations[0];
2158
- }), // Retrieve MetadataCategory.ChildPersonal in any case in parallel
2159
- oroClient.getPersonalInformationsFromConsultId(consultUuid, MetadataCategory.ChildPersonal, true).then(function (childInformations) {
2160
- if (!childInformations[0]) {
2161
- console.debug(MetadataCategory.ChildPersonal + " informations not found for consult:", consultUuid); // Retrieve MetadataCategory.OtherPersonal only if MetadataCategory.ChildPersonal does not exist
2162
-
2163
- // Retrieve MetadataCategory.OtherPersonal only if MetadataCategory.ChildPersonal does not exist
2164
- return oroClient.getPersonalInformationsFromConsultId(consultUuid, MetadataCategory.OtherPersonal, true).then(function (otherInformations) {
2165
- if (!otherInformations[0]) {
2166
- console.debug(MetadataCategory.OtherPersonal + " informations not found for consult:", consultUuid);
2167
- return {};
2168
- }
2169
-
2170
- return {
2171
- otherPersonalInformations: otherInformations[0]
2172
- };
2173
- });
2174
- }
2175
-
2163
+ return _context10.abrupt("return", Promise.all([getWorkflowDataByCategory(workflow, MetadataCategory.Personal), getWorkflowDataByCategory(workflow, MetadataCategory.ChildPersonal), getWorkflowDataByCategory(workflow, MetadataCategory.OtherPersonal)]).then(function (_ref3) {
2164
+ var personalInfoPopulatedWfData = _ref3[0],
2165
+ childPersonalInfoPopulatedWfData = _ref3[1],
2166
+ otherPersonalInfoPopulatedWfData = _ref3[2];
2176
2167
  return {
2177
- childPersonalInformations: childInformations[0]
2178
- };
2179
- })]).then(function (_ref3) {
2180
- var personalInformations = _ref3[0],
2181
- _ref3$ = _ref3[1],
2182
- childPersonalInformations = _ref3$.childPersonalInformations,
2183
- otherPersonalInformations = _ref3$.otherPersonalInformations;
2184
- return {
2185
- consultUuid: consultUuid,
2186
- personalInformations: personalInformations,
2187
- childPersonalInformations: childPersonalInformations,
2188
- otherPersonalInformations: otherPersonalInformations
2168
+ personalInfoPopulatedWfData: personalInfoPopulatedWfData,
2169
+ childPersonalInfoPopulatedWfData: childPersonalInfoPopulatedWfData,
2170
+ otherPersonalInfoPopulatedWfData: otherPersonalInfoPopulatedWfData
2189
2171
  };
2190
2172
  }));
2191
2173
 
@@ -2196,16 +2178,16 @@ function _extractPersonalInfoFromConsultId() {
2196
2178
  }
2197
2179
  }, _callee10);
2198
2180
  }));
2199
- return _extractPersonalInfoFromConsultId.apply(this, arguments);
2181
+ return _extractPersonalInfoFromWorkflowData.apply(this, arguments);
2200
2182
  }
2201
2183
 
2202
- function searchIndexConsultation(_x26, _x27) {
2203
- return _searchIndexConsultation.apply(this, arguments);
2184
+ function buildConsultSearchIndex(_x25, _x26, _x27) {
2185
+ return _buildConsultSearchIndex.apply(this, arguments);
2204
2186
  }
2205
2187
 
2206
- function _searchIndexConsultation() {
2207
- _searchIndexConsultation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(consultUuid, oroClient) {
2208
- var terms, _yield$extractPersona, personalInformations, childPersonalInformations, otherPersonalInformations, personalInfo, childPersonalInfo, otherPersonalInfo;
2188
+ function _buildConsultSearchIndex() {
2189
+ _buildConsultSearchIndex = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(consultUuid, workflow, oroClient) {
2190
+ var terms, _yield$extractPersona, personalInfoPopulatedWfData, childPersonalInfoPopulatedWfData, otherPersonalInfoPopulatedWfData, personalInfo, childPersonalInfo, otherPersonalInfo;
2209
2191
 
2210
2192
  return runtime_1.wrap(function _callee11$(_context11) {
2211
2193
  while (1) {
@@ -2213,14 +2195,16 @@ function _searchIndexConsultation() {
2213
2195
  case 0:
2214
2196
  terms = [];
2215
2197
  _context11.next = 3;
2216
- return extractPersonalInfoFromConsultId(consultUuid, oroClient);
2198
+ return extractPersonalInfoFromWorkflowData(workflow);
2217
2199
 
2218
2200
  case 3:
2219
2201
  _yield$extractPersona = _context11.sent;
2220
- personalInformations = _yield$extractPersona.personalInformations;
2221
- childPersonalInformations = _yield$extractPersona.childPersonalInformations;
2222
- otherPersonalInformations = _yield$extractPersona.otherPersonalInformations;
2223
- personalInfo = identificationToPersonalInformations(toActualObject(personalInformations.data), MetadataCategory.Personal);
2202
+ personalInfoPopulatedWfData = _yield$extractPersona.personalInfoPopulatedWfData;
2203
+ childPersonalInfoPopulatedWfData = _yield$extractPersona.childPersonalInfoPopulatedWfData;
2204
+ otherPersonalInfoPopulatedWfData = _yield$extractPersona.otherPersonalInfoPopulatedWfData;
2205
+ personalInfo = identificationToPersonalInformations(toActualObject(personalInfoPopulatedWfData), MetadataCategory.Personal);
2206
+ childPersonalInfo = identificationToPersonalInformations(toActualObject(childPersonalInfoPopulatedWfData), MetadataCategory.ChildPersonal);
2207
+ otherPersonalInfo = identificationToPersonalInformations(toActualObject(otherPersonalInfoPopulatedWfData), MetadataCategory.OtherPersonal);
2224
2208
  terms.push({
2225
2209
  kind: 'first-name',
2226
2210
  value: personalInfo.firstname
@@ -2229,8 +2213,7 @@ function _searchIndexConsultation() {
2229
2213
  value: personalInfo.name
2230
2214
  });
2231
2215
 
2232
- if (childPersonalInformations) {
2233
- childPersonalInfo = identificationToPersonalInformations(toActualObject(childPersonalInformations.data), MetadataCategory.ChildPersonal);
2216
+ if (childPersonalInfo.firstname && childPersonalInfo.name) {
2234
2217
  terms.push({
2235
2218
  kind: 'first-name',
2236
2219
  value: childPersonalInfo.firstname
@@ -2240,8 +2223,7 @@ function _searchIndexConsultation() {
2240
2223
  });
2241
2224
  }
2242
2225
 
2243
- if (otherPersonalInformations) {
2244
- otherPersonalInfo = identificationToPersonalInformations(toActualObject(otherPersonalInformations.data), MetadataCategory.OtherPersonal);
2226
+ if (otherPersonalInfo.firstname && otherPersonalInfo.name) {
2245
2227
  terms.push({
2246
2228
  kind: 'first-name',
2247
2229
  value: otherPersonalInfo.firstname
@@ -2251,17 +2233,17 @@ function _searchIndexConsultation() {
2251
2233
  });
2252
2234
  }
2253
2235
 
2254
- _context11.next = 13;
2236
+ _context11.next = 15;
2255
2237
  return oroClient.searchClient.index(consultUuid, terms);
2256
2238
 
2257
- case 13:
2239
+ case 15:
2258
2240
  case "end":
2259
2241
  return _context11.stop();
2260
2242
  }
2261
2243
  }
2262
2244
  }, _callee11);
2263
2245
  }));
2264
- return _searchIndexConsultation.apply(this, arguments);
2246
+ return _buildConsultSearchIndex.apply(this, arguments);
2265
2247
  }
2266
2248
 
2267
2249
  /**
@@ -5735,5 +5717,5 @@ var init = function init(toolbox, tellerBaseURL, vaultBaseURL, guardBaseURL, sea
5735
5717
  };
5736
5718
 
5737
5719
  export default init;
5738
- export { AssociatedLockboxNotFound, CliniaService, IncompleteAuthentication, MissingGrant, MissingLockbox, MissingLockboxOwner, OroClient, WorkflowAnswersMissingError, decryptConsultLockboxGrants, decryptGrants, extractAndStorePersonalWorkflowData, extractISOLocalityForConsult, extractPersonalInfoFromConsultId, fillWorkflowFromPopulatedWorkflow, filterTriggeredAnsweredWithKind, flattenSelectedAnswers, getImagesFromIndexDb, getInitialisedSelectedAnswers, getWorkflowDataByCategory, identificationToPersonalInformations, isTriggered, registerPatient, searchIndexConsultation, sessionStorePrivateKeyName, toActualObject, updatePersonalIntoPopulatedWorkflowData, wasmPath };
5720
+ export { AssociatedLockboxNotFound, CliniaService, IncompleteAuthentication, MissingGrant, MissingLockbox, MissingLockboxOwner, OroClient, WorkflowAnswersMissingError, buildConsultSearchIndex, decryptConsultLockboxGrants, decryptGrants, extractAndStorePersonalWorkflowData, extractISOLocalityForConsult, extractPersonalInfoFromWorkflowData, fillWorkflowFromPopulatedWorkflow, filterTriggeredAnsweredWithKind, flattenSelectedAnswers, getImagesFromIndexDb, getInitialisedSelectedAnswers, getWorkflowDataByCategory, identificationToPersonalInformations, isTriggered, registerPatient, sessionStorePrivateKeyName, toActualObject, updatePersonalIntoPopulatedWorkflowData, wasmPath };
5739
5721
  //# sourceMappingURL=oro-sdk.esm.js.map