@icure/api 4.2.27 → 5.0.1

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 (103) hide show
  1. package/icc-api/api/IccDeviceApi.d.ts +3 -3
  2. package/icc-api/api/IccDeviceApi.js.map +1 -1
  3. package/icc-api/api/IccHcpartyApi.d.ts +3 -3
  4. package/icc-api/api/IccHcpartyApi.js.map +1 -1
  5. package/icc-api/api/IccPatientApi.d.ts +3 -3
  6. package/icc-api/api/IccPatientApi.js.map +1 -1
  7. package/icc-api/api/IccUserApi.js +1 -1
  8. package/icc-api/api/IccUserApi.js.map +1 -1
  9. package/icc-api/api/XHR.js +2 -1
  10. package/icc-api/api/XHR.js.map +1 -1
  11. package/icc-api/iccApi.js +5 -1
  12. package/icc-api/iccApi.js.map +1 -1
  13. package/icc-api/index.js +5 -1
  14. package/icc-api/index.js.map +1 -1
  15. package/icc-api/model/Body.js +1 -1
  16. package/icc-api/model/Body.js.map +1 -1
  17. package/icc-api/model/Body1.js +1 -1
  18. package/icc-api/model/Body1.js.map +1 -1
  19. package/icc-api/model/Body2.js +1 -1
  20. package/icc-api/model/Body2.js.map +1 -1
  21. package/icc-api/model/Body3.js +1 -1
  22. package/icc-api/model/Body3.js.map +1 -1
  23. package/icc-api/model/ByteArray.js +1 -1
  24. package/icc-api/model/ByteArray.js.map +1 -1
  25. package/icc-api/model/Content.js +1 -1
  26. package/icc-api/model/Content.js.map +1 -1
  27. package/icc-api/model/Device.js +1 -1
  28. package/icc-api/model/Device.js.map +1 -1
  29. package/icc-api/model/Document.js +1 -1
  30. package/icc-api/model/Document.js.map +1 -1
  31. package/icc-api/model/DocumentTemplate.js +1 -1
  32. package/icc-api/model/DocumentTemplate.js.map +1 -1
  33. package/icc-api/model/HealthcareParty.js +1 -1
  34. package/icc-api/model/HealthcareParty.js.map +1 -1
  35. package/icc-api/model/MimeAttachment.js +1 -1
  36. package/icc-api/model/MimeAttachment.js.map +1 -1
  37. package/icc-api/model/Patient.js +1 -1
  38. package/icc-api/model/Patient.js.map +1 -1
  39. package/icc-api/model/models.d.ts +15 -0
  40. package/icc-api/model/models.js +5 -1
  41. package/icc-api/model/models.js.map +1 -1
  42. package/icc-x-api/crypto/AES.d.ts +2 -1
  43. package/icc-x-api/crypto/AES.js +37 -10
  44. package/icc-x-api/crypto/AES.js.map +1 -1
  45. package/icc-x-api/crypto/RSA.d.ts +0 -31
  46. package/icc-x-api/crypto/RSA.js +0 -64
  47. package/icc-x-api/crypto/RSA.js.map +1 -1
  48. package/icc-x-api/crypto/shamir.js.map +1 -1
  49. package/icc-x-api/filters/filters.js +7 -3
  50. package/icc-x-api/filters/filters.js.map +1 -1
  51. package/icc-x-api/icc-accesslog-x-api.js +25 -22
  52. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  53. package/icc-x-api/icc-bekmehr-x-api.js +2 -2
  54. package/icc-x-api/icc-bekmehr-x-api.js.map +1 -1
  55. package/icc-x-api/icc-calendar-item-x-api.d.ts +2 -2
  56. package/icc-x-api/icc-calendar-item-x-api.js +43 -30
  57. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  58. package/icc-x-api/icc-contact-x-api.js +59 -45
  59. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  60. package/icc-x-api/icc-crypto-x-api.d.ts +124 -53
  61. package/icc-x-api/icc-crypto-x-api.js +777 -362
  62. package/icc-x-api/icc-crypto-x-api.js.map +1 -1
  63. package/icc-x-api/icc-doctemplate-x-api.js +2 -2
  64. package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
  65. package/icc-x-api/icc-document-x-api.js +3 -3
  66. package/icc-x-api/icc-document-x-api.js.map +1 -1
  67. package/icc-x-api/icc-form-x-api.js +3 -3
  68. package/icc-x-api/icc-form-x-api.js.map +1 -1
  69. package/icc-x-api/icc-hcparty-x-api.js +6 -11
  70. package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
  71. package/icc-x-api/icc-helement-x-api.js +8 -8
  72. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  73. package/icc-x-api/icc-maintenance-task-x-api.d.ts +5 -5
  74. package/icc-x-api/icc-maintenance-task-x-api.js +13 -14
  75. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  76. package/icc-x-api/icc-patient-x-api.d.ts +1 -1
  77. package/icc-x-api/icc-patient-x-api.js +66 -56
  78. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  79. package/icc-x-api/index.d.ts +16 -15
  80. package/icc-x-api/index.js +77 -58
  81. package/icc-x-api/index.js.map +1 -1
  82. package/icc-x-api/utils/binary-utils.js +5 -5
  83. package/icc-x-api/utils/binary-utils.js.map +1 -1
  84. package/icc-x-api/utils/crypto-utils.d.ts +61 -0
  85. package/icc-x-api/utils/crypto-utils.js +245 -0
  86. package/icc-x-api/utils/crypto-utils.js.map +1 -0
  87. package/icc-x-api/utils/formatting-util.js +3 -3
  88. package/icc-x-api/utils/formatting-util.js.map +1 -1
  89. package/icc-x-api/utils/functional-util.d.ts +1 -0
  90. package/icc-x-api/utils/functional-util.js +8 -1
  91. package/icc-x-api/utils/functional-util.js.map +1 -1
  92. package/icc-x-api/utils/index.d.ts +1 -0
  93. package/icc-x-api/utils/index.js +6 -1
  94. package/icc-x-api/utils/index.js.map +1 -1
  95. package/index.js +5 -1
  96. package/index.js.map +1 -1
  97. package/node-compat.d.ts +1 -1
  98. package/node-compat.js +3 -3
  99. package/node-compat.js.map +1 -1
  100. package/package.json +2 -2
  101. package/icc-x-api/crypto/utils.d.ts +0 -68
  102. package/icc-x-api/crypto/utils.js +0 -239
  103. package/icc-x-api/crypto/utils.js.map +0 -1
@@ -14,11 +14,10 @@ const icc_api_1 = require("../icc-api");
14
14
  const _ = require("lodash");
15
15
  const models = require("../icc-api/model/models");
16
16
  const models_1 = require("../icc-api/model/models");
17
- const utils_1 = require("./crypto/utils");
18
17
  const ModelHelper_1 = require("../icc-api/model/ModelHelper");
19
18
  const binary_utils_1 = require("./utils/binary-utils");
20
19
  const person_util_1 = require("./utils/person-util");
21
- const net_utils_1 = require("./utils/net-utils");
20
+ const utils_1 = require("./utils");
22
21
  // noinspection JSUnusedGlobalSymbols
23
22
  class IccPatientXApi extends icc_api_1.IccPatientApi {
24
23
  constructor(host, headers, crypto, contactApi, formApi, helementApi, invoiceApi, documentApi, hcpartyApi, classificationApi, userApi, calendarItemaApi, encryptedKeys = ['note'], fetchImpl = typeof window !== 'undefined'
@@ -51,44 +50,50 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
51
50
  codes: [],
52
51
  tags: [],
53
52
  }, p || {});
54
- return this.initDelegations(patient, user, undefined, delegates);
53
+ return this.initDelegationsAndEncryptionKeys(patient, user, undefined, delegates);
55
54
  }
56
55
  completeNames(patient) {
57
56
  var _a;
58
57
  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);
58
+ if (!!finalPatient.lastName && !(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Official)) {
59
+ finalPatient = (0, person_util_1.garnishPersonWithName)(finalPatient, models.PersonName.UseEnum.Official, finalPatient.lastName, finalPatient.firstName);
61
60
  }
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);
61
+ if (!!finalPatient.maidenName && !(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Maiden)) {
62
+ finalPatient = (0, person_util_1.garnishPersonWithName)(finalPatient, models.PersonName.UseEnum.Maiden, finalPatient.maidenName, finalPatient.firstName);
64
63
  }
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);
64
+ if (!!finalPatient.alias && !(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Nickname)) {
65
+ finalPatient = (0, person_util_1.garnishPersonWithName)(finalPatient, models.PersonName.UseEnum.Nickname, finalPatient.alias, finalPatient.firstName);
67
66
  }
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);
67
+ if (!finalPatient.lastName && !!(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Official)) {
68
+ let officialName = (0, person_util_1.findName)(finalPatient, models.PersonName.UseEnum.Official);
70
69
  finalPatient = Object.assign(Object.assign({}, finalPatient), { lastName: officialName.lastName, firstName: (_a = officialName.firstNames) === null || _a === void 0 ? void 0 : _a[0] });
71
70
  }
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 });
71
+ if (!finalPatient.maidenName && !!(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Maiden)) {
72
+ finalPatient = Object.assign(Object.assign({}, finalPatient), { maidenName: (0, person_util_1.findName)(finalPatient, models.PersonName.UseEnum.Maiden).lastName });
74
73
  }
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 });
74
+ if (!finalPatient.alias && !!(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Nickname)) {
75
+ finalPatient = Object.assign(Object.assign({}, finalPatient), { alias: (0, person_util_1.findName)(finalPatient, models.PersonName.UseEnum.Nickname).lastName });
77
76
  }
78
77
  return finalPatient;
79
78
  }
80
- initDelegations(patient, user, secretForeignKey = undefined, delegates = []) {
81
- const dataOwnerId = this.userApi.getDataOwnerOf(user);
82
- return this.crypto.initObjectDelegations(patient, null, dataOwnerId, secretForeignKey || null).then((initData) => {
83
- _.extend(patient, { delegations: initData.delegations });
79
+ initDelegationsAndEncryptionKeys(patient, user, secretForeignKey = undefined, delegates = []) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const dataOwnerId = this.userApi.getDataOwnerOf(user);
82
+ const dels = yield this.crypto.initObjectDelegations(patient, null, dataOwnerId, null);
83
+ const eks = yield this.crypto.initEncryptionKeys(patient, dataOwnerId);
84
+ _.extend(patient, {
85
+ delegations: dels.delegations,
86
+ encryptionKeys: eks.encryptionKeys,
87
+ });
84
88
  let promise = Promise.resolve(patient);
85
- _.uniq(delegates.concat(user.autoDelegations ? (user.autoDelegations.all || []).concat(user.autoDelegations.medicalInformation || []) : [])).forEach((delegateId) => (promise = promise
86
- .then((patient) => this.crypto.extendedDelegationsAndCryptedForeignKeys(patient, null, dataOwnerId, delegateId, initData.secretId))
87
- .then((extraData) => _.extend(patient, { delegations: extraData.delegations }))
88
- .catch((e) => {
89
+ _.uniq(delegates.concat(user.autoDelegations ? (user.autoDelegations.all || []).concat(user.autoDelegations.medicalInformation || []) : [])).forEach((delegateId) => (promise = promise.then((patient) => this.crypto.addDelegationsAndEncryptionKeys(null, patient, dataOwnerId, delegateId, dels.secretId, eks.secretId).catch((e) => {
89
90
  console.log(e);
90
91
  return patient;
91
- })));
92
+ }))));
93
+ (user.autoDelegations && user.autoDelegations.anonymousMedicalInformation ? user.autoDelegations.anonymousMedicalInformation : []).forEach((delegateId) => (promise = promise.then((patient) => this.crypto.addDelegationsAndEncryptionKeys(null, patient, dataOwnerId, delegateId, null, eks.secretId).catch((e) => {
94
+ console.log(e);
95
+ return patient;
96
+ }))));
92
97
  return promise;
93
98
  });
94
99
  }
@@ -100,7 +105,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
100
105
  return this.crypto
101
106
  .decryptAndImportAesHcPartyKeysForDelegators([dataOwnerId], dataOwnerId)
102
107
  .then((hcPartyKeys) => {
103
- return this.crypto.AES.encrypt(hcPartyKeys[0].key, binary_utils_1.string2ua(patient.id + ':' + secretId).buffer);
108
+ return this.crypto.AES.encrypt(hcPartyKeys[0].key, (0, binary_utils_1.string2ua)(patient.id + ':' + secretId).buffer);
104
109
  })
105
110
  .then((newDelegation) => {
106
111
  ;
@@ -108,7 +113,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
108
113
  owner: dataOwnerId,
109
114
  delegatedTo: dataOwnerId,
110
115
  tag: 'confidential',
111
- key: binary_utils_1.ua2hex(newDelegation),
116
+ key: (0, binary_utils_1.ua2hex)(newDelegation),
112
117
  }));
113
118
  return patient.rev ? this.modifyPatientWithUser(user, patient) : this.createPatientWithUser(user, patient);
114
119
  });
@@ -275,19 +280,26 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
275
280
  return Promise.all(pats.map((p) => (p.encryptionKeys && Object.keys(p.encryptionKeys).some((k) => !!p.encryptionKeys[k].length)
276
281
  ? Promise.resolve(p)
277
282
  : 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) => {
283
+ .then((p) => __awaiter(this, void 0, void 0, function* () {
284
+ try {
285
+ const seks = yield this.crypto.extractKeysFromDelegationsForHcpHierarchy(dataOwnerId, p.id, p.encryptionKeys);
286
+ return seks;
287
+ }
288
+ catch (e) {
289
+ console.error(e);
290
+ throw e;
291
+ }
292
+ }))
293
+ .then((seks) => this.crypto.AES.importKey('raw', (0, binary_utils_1.hex2ua)(seks.extractedKeys[0].replace(/-/g, ''))))
294
+ .then((key) => (0, utils_1.crypt)(p, (obj) => this.crypto.AES.encrypt(key, (0, binary_utils_1.utf8_2ua)(JSON.stringify(obj, (k, v) => {
281
295
  return v instanceof ArrayBuffer || v instanceof Uint8Array
282
- ? binary_utils_1.b2a(new Uint8Array(v).reduce((d, b) => d + String.fromCharCode(b), ''))
296
+ ? (0, binary_utils_1.b2a)(new Uint8Array(v).reduce((d, b) => d + String.fromCharCode(b), ''))
283
297
  : v;
284
298
  }))), this.encryptedKeys))));
285
299
  }
286
300
  decrypt(user, pats, fillDelegations = true) {
287
301
  const dataOwnerId = this.userApi.getDataOwnerOf(user);
288
- return (user.healthcarePartyId
289
- ? this.hcpartyApi.getHealthcarePartyHierarchyIds(user.healthcarePartyId)
290
- : Promise.resolve([dataOwnerId])).then((ids) => {
302
+ return (user.healthcarePartyId ? this.hcpartyApi.getHealthcarePartyHierarchyIds(user.healthcarePartyId) : Promise.resolve([dataOwnerId])).then((ids) => {
291
303
  const hcpId = ids[0];
292
304
  //First check that we have no dangling delegation
293
305
  const patsWithMissingDelegations = pats.filter((p) => p.delegations &&
@@ -296,7 +308,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
296
308
  let prom = Promise.resolve({});
297
309
  fillDelegations &&
298
310
  patsWithMissingDelegations.forEach((p) => {
299
- prom = prom.then((acc) => this.initDelegations(p, user).then((p) => this.modifyPatientWithUser(user, p).then((mp) => {
311
+ prom = prom.then((acc) => this.initDelegationsAndEncryptionKeys(p, user).then((p) => this.modifyPatientWithUser(user, p).then((mp) => {
300
312
  acc[p.id] = mp || p;
301
313
  return acc;
302
314
  })));
@@ -316,10 +328,9 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
316
328
  //console.log("Cannot decrypt contact", ctc.id)
317
329
  return Promise.resolve(p);
318
330
  }
319
- return this.crypto.AES.importKey('raw', binary_utils_1.hex2ua(sfks[0].replace(/-/g, ''))).then((key) => utils_1.utils
320
- .decrypt(p, (ec) => this.crypto.AES.decrypt(key, ec)
331
+ return this.crypto.AES.importKey('raw', (0, binary_utils_1.hex2ua)(sfks[0].replace(/-/g, ''))).then((key) => (0, utils_1.decrypt)(p, (ec) => this.crypto.AES.decrypt(key, ec)
321
332
  .then((dec) => {
322
- const jsonContent = dec && binary_utils_1.ua2utf8(dec);
333
+ const jsonContent = dec && (0, binary_utils_1.ua2utf8)(dec);
323
334
  try {
324
335
  return JSON.parse(jsonContent);
325
336
  }
@@ -331,10 +342,9 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
331
342
  .catch((err) => {
332
343
  console.log('Cannot decrypt patient', p.id, err);
333
344
  return p;
334
- }))
335
- .then((p) => {
345
+ })).then((p) => {
336
346
  if (p.picture && !(p.picture instanceof ArrayBuffer)) {
337
- p.picture = ModelHelper_1.b64_2ab(p.picture);
347
+ p.picture = (0, ModelHelper_1.b64_2ab)(p.picture);
338
348
  }
339
349
  return p;
340
350
  }));
@@ -423,7 +433,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
423
433
  },
424
434
  patient: { success: false, error: null, modified: 0 },
425
435
  };
426
- return net_utils_1.retry(() => this.getPatientWithUser(user, patId))
436
+ return (0, utils_1.retry)(() => this.getPatientWithUser(user, patId))
427
437
  .then((patient) => patient.encryptionKeys && Object.keys(patient.encryptionKeys || {}).length
428
438
  ? Promise.resolve(patient)
429
439
  : this.initEncryptionKeys(user, patient).then((patient) => this.modifyPatientWithUser(user, patient)))
@@ -438,42 +448,42 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
438
448
  return this.crypto.extractDelegationsSFKsAndEncryptionSKs(patient, ownerId).then(([delSfks, ecKeys]) => {
439
449
  return delSfks.length
440
450
  ? Promise.all([
441
- net_utils_1.retry(() => this.helementApi
451
+ (0, utils_1.retry)(() => this.helementApi
442
452
  .findHealthElementsDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
443
453
  .then((hes) => parentId
444
454
  ? this.helementApi
445
455
  .findHealthElementsDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
446
456
  .then((moreHes) => _.uniqBy(hes.concat(moreHes), 'id'))
447
457
  : hes)),
448
- net_utils_1.retry(() => this.formApi
458
+ (0, utils_1.retry)(() => this.formApi
449
459
  .findFormsDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
450
460
  .then((frms) => parentId
451
461
  ? this.formApi
452
462
  .findFormsDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
453
463
  .then((moreFrms) => _.uniqBy(frms.concat(moreFrms), 'id'))
454
464
  : frms)),
455
- net_utils_1.retry(() => this.contactApi
465
+ (0, utils_1.retry)(() => this.contactApi
456
466
  .findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))
457
467
  .then((ctcs) => parentId
458
468
  ? this.contactApi
459
469
  .findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))
460
470
  .then((moreCtcs) => _.uniqBy(ctcs.concat(moreCtcs), 'id'))
461
471
  : ctcs)),
462
- net_utils_1.retry(() => this.invoiceApi
472
+ (0, utils_1.retry)(() => this.invoiceApi
463
473
  .findInvoicesDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
464
474
  .then((ivs) => parentId
465
475
  ? this.invoiceApi
466
476
  .findInvoicesDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
467
477
  .then((moreIvs) => _.uniqBy(ivs.concat(moreIvs), 'id'))
468
478
  : ivs)),
469
- net_utils_1.retry(() => this.classificationApi
479
+ (0, utils_1.retry)(() => this.classificationApi
470
480
  .findClassificationsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
471
481
  .then((cls) => parentId
472
482
  ? this.classificationApi
473
483
  .findClassificationsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
474
484
  .then((moreCls) => _.uniqBy(cls.concat(moreCls), 'id'))
475
485
  : cls)),
476
- net_utils_1.retry(() => this.calendarItemApi
486
+ (0, utils_1.retry)(() => this.calendarItemApi
477
487
  .findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))
478
488
  .then((cls) => parentId
479
489
  ? this.calendarItemApi
@@ -498,7 +508,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
498
508
  const docIds = {};
499
509
  ctcs.forEach((c) => c.services &&
500
510
  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) => {
511
+ return (0, utils_1.retry)(() => this.documentApi.getDocuments(new models_1.ListOfIds({ ids: Object.keys(docIds) }))).then((docs) => {
502
512
  const oDocs = docs.map((x) => _.assign({}, x, cloneKeysAndDelegations(x)));
503
513
  let markerPromise = Promise.resolve(null);
504
514
  delegateIds.forEach((delegateId) => {
@@ -686,7 +696,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
686
696
  export(user, patId, ownerId) {
687
697
  return this.hcpartyApi.getHealthcareParty(ownerId).then((hcp) => {
688
698
  const parentId = hcp.parentId;
689
- return net_utils_1.retry(() => this.getPatientWithUser(user, patId))
699
+ return (0, utils_1.retry)(() => this.getPatientWithUser(user, patId))
690
700
  .then((patient) => patient.encryptionKeys && Object.keys(patient.encryptionKeys || {}).length
691
701
  ? Promise.resolve(patient)
692
702
  : this.initEncryptionKeys(user, patient).then((patient) => this.modifyPatientWithUser(user, patient)))
@@ -697,42 +707,42 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
697
707
  return this.crypto.extractDelegationsSFKsAndEncryptionSKs(patient, ownerId).then(([delSfks, ecKeys]) => {
698
708
  return delSfks.length
699
709
  ? Promise.all([
700
- net_utils_1.retry(() => this.helementApi
710
+ (0, utils_1.retry)(() => this.helementApi
701
711
  .findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))
702
712
  .then((hes) => parentId
703
713
  ? this.helementApi
704
714
  .findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))
705
715
  .then((moreHes) => _.uniqBy(hes.concat(moreHes), 'id'))
706
716
  : hes)),
707
- net_utils_1.retry(() => this.formApi
717
+ (0, utils_1.retry)(() => this.formApi
708
718
  .findFormsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
709
719
  .then((frms) => parentId
710
720
  ? this.formApi
711
721
  .findFormsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
712
722
  .then((moreFrms) => _.uniqBy(frms.concat(moreFrms), 'id'))
713
723
  : frms)),
714
- net_utils_1.retry(() => this.contactApi
724
+ (0, utils_1.retry)(() => this.contactApi
715
725
  .findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))
716
726
  .then((ctcs) => parentId
717
727
  ? this.contactApi
718
728
  .findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))
719
729
  .then((moreCtcs) => _.uniqBy(ctcs.concat(moreCtcs), 'id'))
720
730
  : ctcs)),
721
- net_utils_1.retry(() => this.invoiceApi
731
+ (0, utils_1.retry)(() => this.invoiceApi
722
732
  .findInvoicesByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
723
733
  .then((ivs) => parentId
724
734
  ? this.invoiceApi
725
735
  .findInvoicesByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
726
736
  .then((moreIvs) => _.uniqBy(ivs.concat(moreIvs), 'id'))
727
737
  : ivs)),
728
- net_utils_1.retry(() => this.classificationApi
738
+ (0, utils_1.retry)(() => this.classificationApi
729
739
  .findClassificationsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))
730
740
  .then((cls) => parentId
731
741
  ? this.classificationApi
732
742
  .findClassificationsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))
733
743
  .then((moreCls) => _.uniqBy(cls.concat(moreCls), 'id'))
734
744
  : cls)),
735
- net_utils_1.retry(() => __awaiter(this, void 0, void 0, function* () {
745
+ (0, utils_1.retry)(() => __awaiter(this, void 0, void 0, function* () {
736
746
  const delegationSFKs = _.uniq(delSfks).join(',');
737
747
  try {
738
748
  let calendarItems = yield this.calendarItemApi.findByHCPartyPatientSecretFKeys(ownerId, delegationSFKs);
@@ -751,7 +761,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
751
761
  const docIds = {};
752
762
  ctcs.forEach((c) => c.services &&
753
763
  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) => {
764
+ return (0, utils_1.retry)(() => this.documentApi.getDocuments(new models_1.ListOfIds({ ids: Object.keys(docIds) }))).then((docs) => {
755
765
  return {
756
766
  id: patId,
757
767
  patient: patient,