@icure/api 4.1.17 → 4.2.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 (59) hide show
  1. package/icc-api/api/IccApplicationsettingsApi.d.ts +6 -0
  2. package/icc-api/api/IccApplicationsettingsApi.js +15 -0
  3. package/icc-api/api/IccApplicationsettingsApi.js.map +1 -1
  4. package/icc-api/api/IccGroupApi.d.ts +12 -2
  5. package/icc-api/api/IccGroupApi.js +26 -2
  6. package/icc-api/api/IccGroupApi.js.map +1 -1
  7. package/icc-api/api/IccTarificationApi.d.ts +4 -2
  8. package/icc-api/api/IccTarificationApi.js +6 -2
  9. package/icc-api/api/IccTarificationApi.js.map +1 -1
  10. package/icc-api/model/HealthcareParty.d.ts +6 -0
  11. package/icc-api/model/HealthcareParty.js.map +1 -1
  12. package/icc-x-api/filters/UserByNameEmailPhoneFilter.d.ts +18 -0
  13. package/icc-x-api/filters/UserByNameEmailPhoneFilter.js +25 -0
  14. package/icc-x-api/filters/UserByNameEmailPhoneFilter.js.map +1 -0
  15. package/icc-x-api/icc-accesslog-x-api.d.ts +3 -1
  16. package/icc-x-api/icc-accesslog-x-api.js +18 -17
  17. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  18. package/icc-x-api/icc-calendar-item-x-api.d.ts +4 -2
  19. package/icc-x-api/icc-calendar-item-x-api.js +19 -18
  20. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  21. package/icc-x-api/icc-classification-x-api.d.ts +3 -1
  22. package/icc-x-api/icc-classification-x-api.js +7 -6
  23. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  24. package/icc-x-api/icc-contact-x-api.d.ts +3 -1
  25. package/icc-x-api/icc-contact-x-api.js +25 -21
  26. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  27. package/icc-x-api/icc-crypto-x-api.d.ts +10 -10
  28. package/icc-x-api/icc-crypto-x-api.js +21 -21
  29. package/icc-x-api/icc-crypto-x-api.js.map +1 -1
  30. package/icc-x-api/icc-document-x-api.d.ts +4 -2
  31. package/icc-x-api/icc-document-x-api.js +24 -21
  32. package/icc-x-api/icc-document-x-api.js.map +1 -1
  33. package/icc-x-api/icc-form-x-api.d.ts +4 -2
  34. package/icc-x-api/icc-form-x-api.js +22 -21
  35. package/icc-x-api/icc-form-x-api.js.map +1 -1
  36. package/icc-x-api/icc-helement-x-api.d.ts +29 -4
  37. package/icc-x-api/icc-helement-x-api.js +136 -11
  38. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  39. package/icc-x-api/icc-invoice-x-api.d.ts +5 -3
  40. package/icc-x-api/icc-invoice-x-api.js +22 -21
  41. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  42. package/icc-x-api/icc-message-x-api.d.ts +3 -1
  43. package/icc-x-api/icc-message-x-api.js +7 -6
  44. package/icc-x-api/icc-message-x-api.js.map +1 -1
  45. package/icc-x-api/icc-patient-x-api.d.ts +3 -1
  46. package/icc-x-api/icc-patient-x-api.js +19 -17
  47. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  48. package/icc-x-api/icc-receipt-x-api.d.ts +4 -2
  49. package/icc-x-api/icc-receipt-x-api.js +21 -20
  50. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  51. package/icc-x-api/icc-time-table-x-api.d.ts +4 -2
  52. package/icc-x-api/icc-time-table-x-api.js +5 -4
  53. package/icc-x-api/icc-time-table-x-api.js.map +1 -1
  54. package/icc-x-api/icc-user-x-api.d.ts +2 -0
  55. package/icc-x-api/icc-user-x-api.js +8 -0
  56. package/icc-x-api/icc-user-x-api.js.map +1 -1
  57. package/icc-x-api/index.js +12 -12
  58. package/icc-x-api/index.js.map +1 -1
  59. package/package.json +1 -1
@@ -263,7 +263,7 @@ class IccCryptoXApi {
263
263
  * the delegations.
264
264
  * 3. Decrypt's delegators' keys and returns them.
265
265
  *
266
- * @param healthcarePartyId : the id of the delegate HCP
266
+ * @param dataOwnerId : the id of the delegate HCP
267
267
  * @param delegations : generic delegations (can be SPKs, CFKs, EKs) for all delegates
268
268
  * @param fallbackOnParent default true; use parent's healthCarePartyId in case there's no delegation for the `healthcarePartyId`
269
269
  * @returns - **delegatorId** : the id of the delegator HcP that shares the **key** with the `healthcarePartyId`
@@ -271,18 +271,18 @@ class IccCryptoXApi {
271
271
  */
272
272
  decryptAndImportAesHcPartyKeysInDelegations(
273
273
  //TODO: suggested name: getDecryptedHcPKeysOfDelegateAndParentsFromGenericDelegations
274
- healthcarePartyId, delegations, fallbackOnParent = true) {
274
+ dataOwnerId, delegations, fallbackOnParent = true) {
275
275
  const delegatorIds = {};
276
- const delegationsArray = delegations[healthcarePartyId];
276
+ const delegationsArray = delegations[dataOwnerId];
277
277
  if (delegationsArray && delegationsArray.length) {
278
278
  delegationsArray.forEach(function (delegationItem) {
279
279
  delegatorIds[delegationItem.owner] = true; //TODO: why is set to true?
280
280
  });
281
281
  }
282
282
  else if (fallbackOnParent) {
283
- return this.getDataOwner(healthcarePartyId).then(({ dataOwner: hcp }) => hcp.parentId ? this.decryptAndImportAesHcPartyKeysInDelegations(hcp.parentId, delegations) : Promise.resolve([]));
283
+ return this.getDataOwner(dataOwnerId).then(({ dataOwner: hcp }) => hcp.parentId ? this.decryptAndImportAesHcPartyKeysInDelegations(hcp.parentId, delegations) : Promise.resolve([]));
284
284
  }
285
- return this.decryptAndImportAesHcPartyKeysForDelegators(Object.keys(delegatorIds), healthcarePartyId);
285
+ return this.decryptAndImportAesHcPartyKeysForDelegators(Object.keys(delegatorIds), dataOwnerId);
286
286
  }
287
287
  /**
288
288
  * Retreive the owner HealthCareParty key and use it to encrypt
@@ -674,31 +674,31 @@ class IccCryptoXApi {
674
674
  }
675
675
  /**
676
676
  * Get decrypted generic secret IDs (secretIdSPKs, parentIds, secretIdEKs) from generic delegations (SPKs, CFKs, EKs)
677
- * 1. Get HealthCareParty from it's Id.
678
- * 2. Decrypt the keys of the given HCP.
677
+ * 1. Get Data Owner (HCP, Patient or Device) from it's Id.
678
+ * 2. Decrypt the keys of the given data owner.
679
679
  * 3. Decrypt the parent's key if it has parent.
680
680
  * 4. Return the decrypted key corresponding to the Health Care Party.
681
- * @param hcpartyId : the id of the delegate HcP (including its parents) for which to decrypt `extractedKeys`
681
+ * @param dataOwnerId : the id of the delegate data owner (including its parents) for which to decrypt `extractedKeys`
682
682
  * @param objectId : the id of the object/document of which delegations to decrypt ; used just to log to console a message (Cryptographic mistake) in case the object id inside SPK, CFK, EK is different from this one
683
683
  * @param delegations : generic delegations (can be SPKs, CFKs, EKs) for all delegates from where to extract `extractedKeys`
684
- * @returns - **extractedKeys** array containing secret IDs from decrypted generic delegations, from both HCP with given `hcpartyId` and its parents; can contain duplicates
685
- * - **hcpartyId** the given `hcpartyId` OR, if a parent exist, the HCP id of the top parent in the hierarchy (even if that parent has no delegations)
684
+ * @returns - **extractedKeys** array containing secret IDs from decrypted generic delegations, from both data owner with given `dataOwnerId` and its parents; can contain duplicates
685
+ * - **dataOwnerId** the given `dataOwnerId` OR, if a parent exist, the data owner id of the top parent in the hierarchy (even if that parent has no delegations)
686
686
  */
687
- //TODO: even if there are no delegations for parent HCP (but the parent exists), the returned hcpartyId will be the one of the parent
687
+ //TODO: even if there are no delegations for parent HCP (but the parent exists), the returned dataOwnerId will be the one of the parent
688
688
  extractKeysFromDelegationsForHcpHierarchy(
689
689
  //TODO suggested name: getSecretIdsOfHcpAndParentsFromGenericDelegations
690
- hcpartyId, objectId, delegations) {
691
- return this.getDataOwner(hcpartyId).then(({ dataOwner: hcp }) => (delegations[hcpartyId] && delegations[hcpartyId].length
692
- ? this.decryptAndImportAesHcPartyKeysInDelegations(hcpartyId, delegations, false).then((decryptedAndImportedAesHcPartyKeys) => {
690
+ dataOwnerId, objectId, delegations) {
691
+ return this.getDataOwner(dataOwnerId).then(({ dataOwner: hcp }) => (delegations[dataOwnerId] && delegations[dataOwnerId].length
692
+ ? this.decryptAndImportAesHcPartyKeysInDelegations(dataOwnerId, delegations, false).then((decryptedAndImportedAesHcPartyKeys) => {
693
693
  const collatedAesKeysFromDelegatorToHcpartyId = {};
694
694
  decryptedAndImportedAesHcPartyKeys.forEach((k) => (collatedAesKeysFromDelegatorToHcpartyId[k.delegatorId] = k));
695
- return this.decryptKeyInDelegationLikes(delegations[hcpartyId], collatedAesKeysFromDelegatorToHcpartyId, objectId);
695
+ return this.decryptKeyInDelegationLikes(delegations[dataOwnerId], collatedAesKeysFromDelegatorToHcpartyId, objectId);
696
696
  })
697
697
  : Promise.resolve([])).then((extractedKeys) => hcp.parentId
698
698
  ? this.extractKeysFromDelegationsForHcpHierarchy(hcp.parentId, objectId, delegations).then((parentResponse) => _.assign(parentResponse, {
699
699
  extractedKeys: parentResponse.extractedKeys.concat(extractedKeys),
700
700
  }))
701
- : { extractedKeys: extractedKeys, hcpartyId: hcpartyId }));
701
+ : { extractedKeys: extractedKeys, hcpartyId: dataOwnerId }));
702
702
  }
703
703
  /**
704
704
  * Gets an array of generic secret IDs decrypted from a list of generic delegations (SPKs, CFKs, EKs) `delegationsArray`
@@ -990,13 +990,13 @@ class IccCryptoXApi {
990
990
  })));
991
991
  }
992
992
  // noinspection JSUnusedGlobalSymbols
993
- checkPrivateKeyValidity(hcp) {
993
+ checkPrivateKeyValidity(dataOwner) {
994
994
  return new Promise((resolve) => {
995
995
  this._RSA
996
- .importKey('jwk', this._utils.spkiToJwk(binary_utils_1.hex2ua(hcp.publicKey)), ['encrypt'])
996
+ .importKey('jwk', this._utils.spkiToJwk(binary_utils_1.hex2ua(dataOwner.publicKey)), ['encrypt'])
997
997
  .then((k) => this._RSA.encrypt(k, binary_utils_1.utf8_2ua('shibboleth')))
998
998
  .then((cipher) => {
999
- const kp = this._RSA.loadKeyPairNotImported(hcp.id);
999
+ const kp = this._RSA.loadKeyPairNotImported(dataOwner.id);
1000
1000
  return this._RSA
1001
1001
  .importKeyPair('jwk', kp.privateKey, 'jwk', kp.publicKey)
1002
1002
  .then((ikp) => this._RSA.decrypt(ikp.privateKey, new Uint8Array(cipher)));
@@ -1024,10 +1024,10 @@ class IccCryptoXApi {
1024
1024
  }
1025
1025
  throw '### THIS SHOULD NOT HAPPEN: ' + argName + ' has an invalid value: ' + argValue + details;
1026
1026
  }
1027
- getEncryptionDecryptionKeys(healthcarePartyId, document) {
1027
+ getEncryptionDecryptionKeys(dataOwnerId, document) {
1028
1028
  return !document.id
1029
1029
  ? Promise.resolve(null)
1030
- : this.extractKeysFromDelegationsForHcpHierarchy(healthcarePartyId, document.id, (document.encryptionKeys && Object.keys(document.encryptionKeys).length && document.encryptionKeys) || document.delegations)
1030
+ : this.extractKeysFromDelegationsForHcpHierarchy(dataOwnerId, document.id, (document.encryptionKeys && Object.keys(document.encryptionKeys).length && document.encryptionKeys) || document.delegations)
1031
1031
  .then(({ extractedKeys }) => _.uniq(extractedKeys))
1032
1032
  .catch(() => null);
1033
1033
  }