@icure/api 4.2.27 → 4.2.32

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.
Files changed (83) hide show
  1. package/icc-api/api/IccAuthApi.js +3 -1
  2. package/icc-api/api/IccAuthApi.js.map +1 -1
  3. package/icc-api/api/XHR.js +1 -1
  4. package/icc-api/api/XHR.js.map +1 -1
  5. package/icc-api/iccApi.js +5 -1
  6. package/icc-api/iccApi.js.map +1 -1
  7. package/icc-api/index.js +5 -1
  8. package/icc-api/index.js.map +1 -1
  9. package/icc-api/model/Body.js +1 -1
  10. package/icc-api/model/Body.js.map +1 -1
  11. package/icc-api/model/Body1.js +1 -1
  12. package/icc-api/model/Body1.js.map +1 -1
  13. package/icc-api/model/Body2.js +1 -1
  14. package/icc-api/model/Body2.js.map +1 -1
  15. package/icc-api/model/Body3.js +1 -1
  16. package/icc-api/model/Body3.js.map +1 -1
  17. package/icc-api/model/ByteArray.js +1 -1
  18. package/icc-api/model/ByteArray.js.map +1 -1
  19. package/icc-api/model/Content.js +1 -1
  20. package/icc-api/model/Content.js.map +1 -1
  21. package/icc-api/model/Device.js +1 -1
  22. package/icc-api/model/Device.js.map +1 -1
  23. package/icc-api/model/Document.js +1 -1
  24. package/icc-api/model/Document.js.map +1 -1
  25. package/icc-api/model/DocumentTemplate.js +1 -1
  26. package/icc-api/model/DocumentTemplate.js.map +1 -1
  27. package/icc-api/model/HealthcareParty.js +1 -1
  28. package/icc-api/model/HealthcareParty.js.map +1 -1
  29. package/icc-api/model/MimeAttachment.js +1 -1
  30. package/icc-api/model/MimeAttachment.js.map +1 -1
  31. package/icc-api/model/Patient.js +1 -1
  32. package/icc-api/model/Patient.js.map +1 -1
  33. package/icc-api/model/models.js +5 -1
  34. package/icc-api/model/models.js.map +1 -1
  35. package/icc-x-api/crypto/AES.js +1 -1
  36. package/icc-x-api/crypto/AES.js.map +1 -1
  37. package/icc-x-api/crypto/RSA.js.map +1 -1
  38. package/icc-x-api/crypto/utils.d.ts +1 -0
  39. package/icc-x-api/crypto/utils.js +43 -27
  40. package/icc-x-api/crypto/utils.js.map +1 -1
  41. package/icc-x-api/filters/filters.js +7 -3
  42. package/icc-x-api/filters/filters.js.map +1 -1
  43. package/icc-x-api/icc-accesslog-x-api.js +4 -4
  44. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  45. package/icc-x-api/icc-bekmehr-x-api.js +2 -2
  46. package/icc-x-api/icc-bekmehr-x-api.js.map +1 -1
  47. package/icc-x-api/icc-calendar-item-x-api.js +4 -4
  48. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  49. package/icc-x-api/icc-contact-x-api.js +11 -11
  50. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  51. package/icc-x-api/icc-crypto-x-api.js +46 -46
  52. package/icc-x-api/icc-crypto-x-api.js.map +1 -1
  53. package/icc-x-api/icc-doctemplate-x-api.js +2 -2
  54. package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
  55. package/icc-x-api/icc-document-x-api.js +3 -3
  56. package/icc-x-api/icc-document-x-api.js.map +1 -1
  57. package/icc-x-api/icc-form-x-api.js +3 -3
  58. package/icc-x-api/icc-form-x-api.js.map +1 -1
  59. package/icc-x-api/icc-hcparty-x-api.js +6 -11
  60. package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
  61. package/icc-x-api/icc-helement-x-api.js +5 -5
  62. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  63. package/icc-x-api/icc-maintenance-task-x-api.d.ts +5 -5
  64. package/icc-x-api/icc-maintenance-task-x-api.js +13 -13
  65. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  66. package/icc-x-api/icc-patient-x-api.d.ts +3 -1
  67. package/icc-x-api/icc-patient-x-api.js +58 -50
  68. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  69. package/icc-x-api/index.d.ts +16 -14
  70. package/icc-x-api/index.js +76 -54
  71. package/icc-x-api/index.js.map +1 -1
  72. package/icc-x-api/utils/binary-utils.js +5 -5
  73. package/icc-x-api/utils/binary-utils.js.map +1 -1
  74. package/icc-x-api/utils/formatting-util.js +3 -3
  75. package/icc-x-api/utils/formatting-util.js.map +1 -1
  76. package/icc-x-api/utils/index.js +5 -1
  77. package/icc-x-api/utils/index.js.map +1 -1
  78. package/index.js +5 -1
  79. package/index.js.map +1 -1
  80. package/node-compat.d.ts +1 -2
  81. package/node-compat.js +3 -4
  82. package/node-compat.js.map +1 -1
  83. package/package.json +1 -1
@@ -56,24 +56,24 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
56
56
  completeNames(patient) {
57
57
  var _a;
58
58
  let finalPatient = patient;
59
- if (!!finalPatient.lastName && !person_util_1.hasName(finalPatient, models.PersonName.UseEnum.Official)) {
60
- finalPatient = person_util_1.garnishPersonWithName(finalPatient, models.PersonName.UseEnum.Official, finalPatient.lastName, finalPatient.firstName);
59
+ if (!!finalPatient.lastName && !(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Official)) {
60
+ finalPatient = (0, person_util_1.garnishPersonWithName)(finalPatient, models.PersonName.UseEnum.Official, finalPatient.lastName, finalPatient.firstName);
61
61
  }
62
- if (!!finalPatient.maidenName && !person_util_1.hasName(finalPatient, models.PersonName.UseEnum.Maiden)) {
63
- finalPatient = person_util_1.garnishPersonWithName(finalPatient, models.PersonName.UseEnum.Maiden, finalPatient.maidenName, finalPatient.firstName);
62
+ if (!!finalPatient.maidenName && !(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Maiden)) {
63
+ finalPatient = (0, person_util_1.garnishPersonWithName)(finalPatient, models.PersonName.UseEnum.Maiden, finalPatient.maidenName, finalPatient.firstName);
64
64
  }
65
- if (!!finalPatient.alias && !person_util_1.hasName(finalPatient, models.PersonName.UseEnum.Nickname)) {
66
- finalPatient = person_util_1.garnishPersonWithName(finalPatient, models.PersonName.UseEnum.Nickname, finalPatient.alias, finalPatient.firstName);
65
+ if (!!finalPatient.alias && !(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Nickname)) {
66
+ finalPatient = (0, person_util_1.garnishPersonWithName)(finalPatient, models.PersonName.UseEnum.Nickname, finalPatient.alias, finalPatient.firstName);
67
67
  }
68
- if (!finalPatient.lastName && !!person_util_1.hasName(finalPatient, models.PersonName.UseEnum.Official)) {
69
- let officialName = person_util_1.findName(finalPatient, models.PersonName.UseEnum.Official);
68
+ if (!finalPatient.lastName && !!(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Official)) {
69
+ let officialName = (0, person_util_1.findName)(finalPatient, models.PersonName.UseEnum.Official);
70
70
  finalPatient = Object.assign(Object.assign({}, finalPatient), { lastName: officialName.lastName, firstName: (_a = officialName.firstNames) === null || _a === void 0 ? void 0 : _a[0] });
71
71
  }
72
- if (!finalPatient.maidenName && !!person_util_1.hasName(finalPatient, models.PersonName.UseEnum.Maiden)) {
73
- finalPatient = Object.assign(Object.assign({}, finalPatient), { maidenName: person_util_1.findName(finalPatient, models.PersonName.UseEnum.Maiden).lastName });
72
+ if (!finalPatient.maidenName && !!(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Maiden)) {
73
+ finalPatient = Object.assign(Object.assign({}, finalPatient), { maidenName: (0, person_util_1.findName)(finalPatient, models.PersonName.UseEnum.Maiden).lastName });
74
74
  }
75
- if (!finalPatient.alias && !!person_util_1.hasName(finalPatient, models.PersonName.UseEnum.Nickname)) {
76
- finalPatient = Object.assign(Object.assign({}, finalPatient), { alias: person_util_1.findName(finalPatient, models.PersonName.UseEnum.Nickname).lastName });
75
+ if (!finalPatient.alias && !!(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Nickname)) {
76
+ finalPatient = Object.assign(Object.assign({}, finalPatient), { alias: (0, person_util_1.findName)(finalPatient, models.PersonName.UseEnum.Nickname).lastName });
77
77
  }
78
78
  return finalPatient;
79
79
  }
@@ -100,7 +100,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
100
100
  return this.crypto
101
101
  .decryptAndImportAesHcPartyKeysForDelegators([dataOwnerId], dataOwnerId)
102
102
  .then((hcPartyKeys) => {
103
- return this.crypto.AES.encrypt(hcPartyKeys[0].key, binary_utils_1.string2ua(patient.id + ':' + secretId).buffer);
103
+ return this.crypto.AES.encrypt(hcPartyKeys[0].key, (0, binary_utils_1.string2ua)(patient.id + ':' + secretId).buffer);
104
104
  })
105
105
  .then((newDelegation) => {
106
106
  ;
@@ -108,7 +108,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
108
108
  owner: dataOwnerId,
109
109
  delegatedTo: dataOwnerId,
110
110
  tag: 'confidential',
111
- key: binary_utils_1.ua2hex(newDelegation),
111
+ key: (0, binary_utils_1.ua2hex)(newDelegation),
112
112
  }));
113
113
  return patient.rev ? this.modifyPatientWithUser(user, patient) : this.createPatientWithUser(user, patient);
114
114
  });
@@ -272,22 +272,27 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
272
272
  }
273
273
  encrypt(user, pats) {
274
274
  const dataOwnerId = this.userApi.getDataOwnerOf(user);
275
- return Promise.all(pats.map((p) => (p.encryptionKeys && Object.keys(p.encryptionKeys).some((k) => !!p.encryptionKeys[k].length)
276
- ? Promise.resolve(p)
277
- : this.initEncryptionKeys(user, p))
278
- .then((p) => this.crypto.extractKeysFromDelegationsForHcpHierarchy(dataOwnerId, p.id, p.encryptionKeys))
279
- .then((sfks) => this.crypto.AES.importKey('raw', binary_utils_1.hex2ua(sfks.extractedKeys[0].replace(/-/g, ''))))
280
- .then((key) => utils_1.utils.crypt(p, (obj) => this.crypto.AES.encrypt(key, binary_utils_1.utf8_2ua(JSON.stringify(obj, (k, v) => {
281
- return v instanceof ArrayBuffer || v instanceof Uint8Array
282
- ? binary_utils_1.b2a(new Uint8Array(v).reduce((d, b) => d + String.fromCharCode(b), ''))
283
- : v;
284
- }))), this.encryptedKeys))));
275
+ const fixEncryptionKeys = (p) => {
276
+ if (p.delegations && p.delegations[dataOwnerId])
277
+ return this.initEncryptionKeys(user, p, Object.keys(p.delegations));
278
+ else
279
+ throw new Error(`Patient ${p.id} has no delegation or encryption key for hcp ${dataOwnerId}`);
280
+ };
281
+ return Promise.all(pats.map((p) => {
282
+ var _a;
283
+ return (p.encryptionKeys && ((_a = p.encryptionKeys[dataOwnerId]) === null || _a === void 0 ? void 0 : _a.length) ? Promise.resolve(p) : fixEncryptionKeys(p))
284
+ .then((p) => this.crypto.extractKeysFromDelegationsForHcpHierarchy(dataOwnerId, p.id, p.encryptionKeys))
285
+ .then((sfks) => this.crypto.AES.importKey('raw', (0, binary_utils_1.hex2ua)(sfks.extractedKeys[0].replace(/-/g, ''))))
286
+ .then((key) => utils_1.utils.crypt(p, (obj) => this.crypto.AES.encrypt(key, (0, binary_utils_1.utf8_2ua)(JSON.stringify(obj, (k, v) => {
287
+ return v instanceof ArrayBuffer || v instanceof Uint8Array
288
+ ? (0, binary_utils_1.b2a)(new Uint8Array(v).reduce((d, b) => d + String.fromCharCode(b), ''))
289
+ : v;
290
+ }))), this.encryptedKeys));
291
+ }));
285
292
  }
286
293
  decrypt(user, pats, fillDelegations = true) {
287
294
  const dataOwnerId = this.userApi.getDataOwnerOf(user);
288
- return (user.healthcarePartyId
289
- ? this.hcpartyApi.getHealthcarePartyHierarchyIds(user.healthcarePartyId)
290
- : Promise.resolve([dataOwnerId])).then((ids) => {
295
+ return (user.healthcarePartyId ? this.hcpartyApi.getHealthcarePartyHierarchyIds(user.healthcarePartyId) : Promise.resolve([dataOwnerId])).then((ids) => {
291
296
  const hcpId = ids[0];
292
297
  //First check that we have no dangling delegation
293
298
  const patsWithMissingDelegations = pats.filter((p) => p.delegations &&
@@ -316,10 +321,10 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
316
321
  //console.log("Cannot decrypt contact", ctc.id)
317
322
  return Promise.resolve(p);
318
323
  }
319
- return this.crypto.AES.importKey('raw', binary_utils_1.hex2ua(sfks[0].replace(/-/g, ''))).then((key) => utils_1.utils
324
+ return this.crypto.AES.importKey('raw', (0, binary_utils_1.hex2ua)(sfks[0].replace(/-/g, ''))).then((key) => utils_1.utils
320
325
  .decrypt(p, (ec) => this.crypto.AES.decrypt(key, ec)
321
326
  .then((dec) => {
322
- const jsonContent = dec && binary_utils_1.ua2utf8(dec);
327
+ const jsonContent = dec && (0, binary_utils_1.ua2utf8)(dec);
323
328
  try {
324
329
  return JSON.parse(jsonContent);
325
330
  }
@@ -334,7 +339,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
334
339
  }))
335
340
  .then((p) => {
336
341
  if (p.picture && !(p.picture instanceof ArrayBuffer)) {
337
- p.picture = ModelHelper_1.b64_2ab(p.picture);
342
+ p.picture = (0, ModelHelper_1.b64_2ab)(p.picture);
338
343
  }
339
344
  return p;
340
345
  }));
@@ -344,13 +349,16 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
344
349
  });
345
350
  });
346
351
  }
347
- initEncryptionKeys(user, pat) {
352
+ /** By default, an encryptionKey will be added for every hcp in the autoDelegations of the provided user.
353
+ * In optional field additionalDelegateIds, you can ask the method to create encryptionKeys for additional hcps */
354
+ initEncryptionKeys(user, pat, additionalDelegateIds) {
348
355
  const dataOwnerId = this.userApi.getDataOwnerOf(user);
356
+ const userAutoDelegations = user.autoDelegations ? (user.autoDelegations.all || []).concat(user.autoDelegations.medicalInformation || []) : [];
349
357
  return this.crypto.initEncryptionKeys(pat, dataOwnerId).then((eks) => {
350
358
  let promise = Promise.resolve(_.extend(pat, {
351
359
  encryptionKeys: eks.encryptionKeys,
352
360
  }));
353
- (user.autoDelegations ? (user.autoDelegations.all || []).concat(user.autoDelegations.medicalInformation || []) : []).forEach((delegateId) => (promise = promise.then((patient) => this.crypto
361
+ new Set([...userAutoDelegations, ...(additionalDelegateIds || [])]).forEach((delegateId) => (promise = promise.then((patient) => this.crypto
354
362
  .appendEncryptionKeys(patient, dataOwnerId, delegateId, eks.secretId)
355
363
  .then((extraEks) => {
356
364
  return _.extend(patient, {
@@ -423,7 +431,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
423
431
  },
424
432
  patient: { success: false, error: null, modified: 0 },
425
433
  };
426
- return net_utils_1.retry(() => this.getPatientWithUser(user, patId))
434
+ return (0, net_utils_1.retry)(() => this.getPatientWithUser(user, patId))
427
435
  .then((patient) => patient.encryptionKeys && Object.keys(patient.encryptionKeys || {}).length
428
436
  ? Promise.resolve(patient)
429
437
  : this.initEncryptionKeys(user, patient).then((patient) => this.modifyPatientWithUser(user, patient)))
@@ -438,42 +446,42 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
438
446
  return this.crypto.extractDelegationsSFKsAndEncryptionSKs(patient, ownerId).then(([delSfks, ecKeys]) => {
439
447
  return delSfks.length
440
448
  ? Promise.all([
441
- net_utils_1.retry(() => this.helementApi
449
+ (0, net_utils_1.retry)(() => this.helementApi
442
450
  .findHealthElementsDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
443
451
  .then((hes) => parentId
444
452
  ? this.helementApi
445
453
  .findHealthElementsDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
446
454
  .then((moreHes) => _.uniqBy(hes.concat(moreHes), 'id'))
447
455
  : hes)),
448
- net_utils_1.retry(() => this.formApi
456
+ (0, net_utils_1.retry)(() => this.formApi
449
457
  .findFormsDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
450
458
  .then((frms) => parentId
451
459
  ? this.formApi
452
460
  .findFormsDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
453
461
  .then((moreFrms) => _.uniqBy(frms.concat(moreFrms), 'id'))
454
462
  : frms)),
455
- net_utils_1.retry(() => this.contactApi
463
+ (0, net_utils_1.retry)(() => this.contactApi
456
464
  .findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))
457
465
  .then((ctcs) => parentId
458
466
  ? this.contactApi
459
467
  .findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))
460
468
  .then((moreCtcs) => _.uniqBy(ctcs.concat(moreCtcs), 'id'))
461
469
  : ctcs)),
462
- net_utils_1.retry(() => this.invoiceApi
470
+ (0, net_utils_1.retry)(() => this.invoiceApi
463
471
  .findInvoicesDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
464
472
  .then((ivs) => parentId
465
473
  ? this.invoiceApi
466
474
  .findInvoicesDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
467
475
  .then((moreIvs) => _.uniqBy(ivs.concat(moreIvs), 'id'))
468
476
  : ivs)),
469
- net_utils_1.retry(() => this.classificationApi
477
+ (0, net_utils_1.retry)(() => this.classificationApi
470
478
  .findClassificationsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
471
479
  .then((cls) => parentId
472
480
  ? this.classificationApi
473
481
  .findClassificationsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
474
482
  .then((moreCls) => _.uniqBy(cls.concat(moreCls), 'id'))
475
483
  : cls)),
476
- net_utils_1.retry(() => this.calendarItemApi
484
+ (0, net_utils_1.retry)(() => this.calendarItemApi
477
485
  .findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))
478
486
  .then((cls) => parentId
479
487
  ? this.calendarItemApi
@@ -497,8 +505,8 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
497
505
  const oCis = cis.map((x) => _.assign(new models_1.CalendarItem({}), x, cloneKeysAndDelegations(x)));
498
506
  const docIds = {};
499
507
  ctcs.forEach((c) => c.services &&
500
- c.services.forEach((s) => s.content && Object.values(s.content).forEach((c) => c.documentId && (docIds[c.documentId] = 1))));
501
- return net_utils_1.retry(() => this.documentApi.getDocuments(new models_1.ListOfIds({ ids: Object.keys(docIds) }))).then((docs) => {
508
+ c.services.forEach((s) => s.content && Object.values(s.content).forEach((c) => c && c.documentId && (docIds[c.documentId] = 1))));
509
+ return (0, net_utils_1.retry)(() => this.documentApi.getDocuments(new models_1.ListOfIds({ ids: Object.keys(docIds) }))).then((docs) => {
502
510
  const oDocs = docs.map((x) => _.assign({}, x, cloneKeysAndDelegations(x)));
503
511
  let markerPromise = Promise.resolve(null);
504
512
  delegateIds.forEach((delegateId) => {
@@ -686,7 +694,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
686
694
  export(user, patId, ownerId) {
687
695
  return this.hcpartyApi.getHealthcareParty(ownerId).then((hcp) => {
688
696
  const parentId = hcp.parentId;
689
- return net_utils_1.retry(() => this.getPatientWithUser(user, patId))
697
+ return (0, net_utils_1.retry)(() => this.getPatientWithUser(user, patId))
690
698
  .then((patient) => patient.encryptionKeys && Object.keys(patient.encryptionKeys || {}).length
691
699
  ? Promise.resolve(patient)
692
700
  : this.initEncryptionKeys(user, patient).then((patient) => this.modifyPatientWithUser(user, patient)))
@@ -697,42 +705,42 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
697
705
  return this.crypto.extractDelegationsSFKsAndEncryptionSKs(patient, ownerId).then(([delSfks, ecKeys]) => {
698
706
  return delSfks.length
699
707
  ? Promise.all([
700
- net_utils_1.retry(() => this.helementApi
708
+ (0, net_utils_1.retry)(() => this.helementApi
701
709
  .findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))
702
710
  .then((hes) => parentId
703
711
  ? this.helementApi
704
712
  .findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))
705
713
  .then((moreHes) => _.uniqBy(hes.concat(moreHes), 'id'))
706
714
  : hes)),
707
- net_utils_1.retry(() => this.formApi
715
+ (0, net_utils_1.retry)(() => this.formApi
708
716
  .findFormsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
709
717
  .then((frms) => parentId
710
718
  ? this.formApi
711
719
  .findFormsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
712
720
  .then((moreFrms) => _.uniqBy(frms.concat(moreFrms), 'id'))
713
721
  : frms)),
714
- net_utils_1.retry(() => this.contactApi
722
+ (0, net_utils_1.retry)(() => this.contactApi
715
723
  .findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))
716
724
  .then((ctcs) => parentId
717
725
  ? this.contactApi
718
726
  .findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))
719
727
  .then((moreCtcs) => _.uniqBy(ctcs.concat(moreCtcs), 'id'))
720
728
  : ctcs)),
721
- net_utils_1.retry(() => this.invoiceApi
729
+ (0, net_utils_1.retry)(() => this.invoiceApi
722
730
  .findInvoicesByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
723
731
  .then((ivs) => parentId
724
732
  ? this.invoiceApi
725
733
  .findInvoicesByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
726
734
  .then((moreIvs) => _.uniqBy(ivs.concat(moreIvs), 'id'))
727
735
  : ivs)),
728
- net_utils_1.retry(() => this.classificationApi
736
+ (0, net_utils_1.retry)(() => this.classificationApi
729
737
  .findClassificationsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
730
738
  .then((cls) => parentId
731
739
  ? this.classificationApi
732
740
  .findClassificationsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
733
741
  .then((moreCls) => _.uniqBy(cls.concat(moreCls), 'id'))
734
742
  : cls)),
735
- net_utils_1.retry(() => __awaiter(this, void 0, void 0, function* () {
743
+ (0, net_utils_1.retry)(() => __awaiter(this, void 0, void 0, function* () {
736
744
  const delegationSFKs = _.uniq(delSfks).join(',');
737
745
  try {
738
746
  let calendarItems = yield this.calendarItemApi.findByHCPartyPatientSecretFKeys(ownerId, delegationSFKs);
@@ -750,8 +758,8 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
750
758
  ]).then(([hes, frms, ctcs, ivs, cls, cis]) => {
751
759
  const docIds = {};
752
760
  ctcs.forEach((c) => c.services &&
753
- c.services.forEach((s) => s.content && Object.values(s.content).forEach((c) => c.documentId && (docIds[c.documentId] = 1))));
754
- return net_utils_1.retry(() => this.documentApi.getDocuments(new models_1.ListOfIds({ ids: Object.keys(docIds) }))).then((docs) => {
761
+ c.services.forEach((s) => s.content && Object.values(s.content).forEach((c) => c && c.documentId && (docIds[c.documentId] = 1))));
762
+ return (0, net_utils_1.retry)(() => this.documentApi.getDocuments(new models_1.ListOfIds({ ids: Object.keys(docIds) }))).then((docs) => {
755
763
  return {
756
764
  id: patId,
757
765
  patient: patient,