@icure/api 7.1.16 → 8.0.0-RC.2

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 (363) hide show
  1. package/icc-api/api/IccAccesslogApi.d.ts +12 -1
  2. package/icc-api/api/IccAccesslogApi.js +142 -98
  3. package/icc-api/api/IccAccesslogApi.js.map +1 -1
  4. package/icc-api/api/IccBemikronoApi.d.ts +81 -0
  5. package/icc-api/api/IccBemikronoApi.js +163 -0
  6. package/icc-api/api/IccBemikronoApi.js.map +1 -0
  7. package/icc-api/api/IccCalendarItemApi.d.ts +21 -1
  8. package/icc-api/api/IccCalendarItemApi.js +183 -117
  9. package/icc-api/api/IccCalendarItemApi.js.map +1 -1
  10. package/icc-api/api/IccClassificationApi.d.ts +21 -1
  11. package/icc-api/api/IccClassificationApi.js +119 -63
  12. package/icc-api/api/IccClassificationApi.js.map +1 -1
  13. package/icc-api/api/IccContactApi.d.ts +21 -1
  14. package/icc-api/api/IccContactApi.js +385 -294
  15. package/icc-api/api/IccContactApi.js.map +1 -1
  16. package/icc-api/api/IccDocumentApi.d.ts +38 -25
  17. package/icc-api/api/IccDocumentApi.js +279 -212
  18. package/icc-api/api/IccDocumentApi.js.map +1 -1
  19. package/icc-api/api/IccExchangeDataApi.d.ts +19 -0
  20. package/icc-api/api/IccExchangeDataApi.js +85 -0
  21. package/icc-api/api/IccExchangeDataApi.js.map +1 -0
  22. package/icc-api/api/IccExchangeDataMapApi.d.ts +18 -0
  23. package/icc-api/api/IccExchangeDataMapApi.js +65 -0
  24. package/icc-api/api/IccExchangeDataMapApi.js.map +1 -0
  25. package/icc-api/api/IccFormApi.d.ts +21 -1
  26. package/icc-api/api/IccFormApi.js +321 -229
  27. package/icc-api/api/IccFormApi.js.map +1 -1
  28. package/icc-api/api/IccHelementApi.d.ts +21 -1
  29. package/icc-api/api/IccHelementApi.js +207 -137
  30. package/icc-api/api/IccHelementApi.js.map +1 -1
  31. package/icc-api/api/IccInvoiceApi.d.ts +21 -1
  32. package/icc-api/api/IccInvoiceApi.js +404 -298
  33. package/icc-api/api/IccInvoiceApi.js.map +1 -1
  34. package/icc-api/api/IccMaintenanceTaskApi.d.ts +12 -1
  35. package/icc-api/api/IccMaintenanceTaskApi.js +79 -43
  36. package/icc-api/api/IccMaintenanceTaskApi.js.map +1 -1
  37. package/icc-api/api/IccMessageApi.d.ts +28 -1
  38. package/icc-api/api/IccMessageApi.js +294 -191
  39. package/icc-api/api/IccMessageApi.js.map +1 -1
  40. package/icc-api/api/IccPatientApi.d.ts +12 -1
  41. package/icc-api/api/IccPatientApi.js +447 -351
  42. package/icc-api/api/IccPatientApi.js.map +1 -1
  43. package/icc-api/api/IccReceiptApi.d.ts +22 -8
  44. package/icc-api/api/IccReceiptApi.js +121 -64
  45. package/icc-api/api/IccReceiptApi.js.map +1 -1
  46. package/icc-api/api/IccRestApiPath.js +1 -1
  47. package/icc-api/api/IccRestApiPath.js.map +1 -1
  48. package/icc-api/api/IccSecureDelegationKeyMapApi.d.ts +26 -0
  49. package/icc-api/api/IccSecureDelegationKeyMapApi.js +71 -0
  50. package/icc-api/api/IccSecureDelegationKeyMapApi.js.map +1 -0
  51. package/icc-api/api/IccTimeTableApi.d.ts +12 -1
  52. package/icc-api/api/IccTimeTableApi.js +86 -48
  53. package/icc-api/api/IccTimeTableApi.js.map +1 -1
  54. package/icc-api/api/IccTopicApi.d.ts +90 -0
  55. package/icc-api/api/IccTopicApi.js +193 -0
  56. package/icc-api/api/IccTopicApi.js.map +1 -0
  57. package/icc-api/index.d.ts +2 -0
  58. package/icc-api/index.js +2 -0
  59. package/icc-api/index.js.map +1 -1
  60. package/icc-api/model/AbstractFilterMessage.d.ts +15 -0
  61. package/icc-api/model/AbstractFilterMessage.js +21 -0
  62. package/icc-api/model/AbstractFilterMessage.js.map +1 -0
  63. package/icc-api/model/AbstractFilterTopic.d.ts +15 -0
  64. package/icc-api/model/AbstractFilterTopic.js +21 -0
  65. package/icc-api/model/AbstractFilterTopic.js.map +1 -0
  66. package/icc-api/model/AccessLog.d.ts +2 -0
  67. package/icc-api/model/AccessLog.js.map +1 -1
  68. package/icc-api/model/Article.d.ts +2 -0
  69. package/icc-api/model/Article.js.map +1 -1
  70. package/icc-api/model/CalendarItem.d.ts +2 -0
  71. package/icc-api/model/CalendarItem.js.map +1 -1
  72. package/icc-api/model/Classification.d.ts +2 -0
  73. package/icc-api/model/Classification.js.map +1 -1
  74. package/icc-api/model/ClassificationTemplate.d.ts +2 -0
  75. package/icc-api/model/ClassificationTemplate.js.map +1 -1
  76. package/icc-api/model/Connection.d.ts +1 -1
  77. package/icc-api/model/Connection.js.map +1 -1
  78. package/icc-api/model/Contact.d.ts +2 -0
  79. package/icc-api/model/Contact.js.map +1 -1
  80. package/icc-api/model/Device.d.ts +4 -4
  81. package/icc-api/model/Device.js.map +1 -1
  82. package/icc-api/model/Document.d.ts +2 -0
  83. package/icc-api/model/Document.js.map +1 -1
  84. package/icc-api/model/ExchangeDataMapCreationBatch.d.ts +13 -0
  85. package/icc-api/model/ExchangeDataMapCreationBatch.js +10 -0
  86. package/icc-api/model/ExchangeDataMapCreationBatch.js.map +1 -0
  87. package/icc-api/model/FilterChainMessage.d.ts +19 -0
  88. package/icc-api/model/FilterChainMessage.js +11 -0
  89. package/icc-api/model/FilterChainMessage.js.map +1 -0
  90. package/icc-api/model/FilterChainTopic.d.ts +19 -0
  91. package/icc-api/model/FilterChainTopic.js +11 -0
  92. package/icc-api/model/FilterChainTopic.js.map +1 -0
  93. package/icc-api/model/Form.d.ts +2 -0
  94. package/icc-api/model/Form.js.map +1 -1
  95. package/icc-api/model/HealthElement.d.ts +2 -0
  96. package/icc-api/model/HealthElement.js.map +1 -1
  97. package/icc-api/model/HealthcareParty.d.ts +2 -2
  98. package/icc-api/model/HealthcareParty.js +13 -1
  99. package/icc-api/model/HealthcareParty.js.map +1 -1
  100. package/icc-api/model/IcureStub.d.ts +2 -0
  101. package/icc-api/model/IcureStub.js.map +1 -1
  102. package/icc-api/model/Invoice.d.ts +2 -0
  103. package/icc-api/model/Invoice.js.map +1 -1
  104. package/icc-api/model/MaintenanceTask.d.ts +13 -10
  105. package/icc-api/model/MaintenanceTask.js +13 -11
  106. package/icc-api/model/MaintenanceTask.js.map +1 -1
  107. package/icc-api/model/Message.d.ts +2 -0
  108. package/icc-api/model/Message.js.map +1 -1
  109. package/icc-api/model/PaginatedListExchangeData.d.ts +9 -0
  110. package/icc-api/model/PaginatedListExchangeData.js +10 -0
  111. package/icc-api/model/PaginatedListExchangeData.js.map +1 -0
  112. package/icc-api/model/PaginatedListTopic.d.ts +20 -0
  113. package/icc-api/model/PaginatedListTopic.js +10 -0
  114. package/icc-api/model/PaginatedListTopic.js.map +1 -0
  115. package/icc-api/model/Patient.d.ts +4 -2
  116. package/icc-api/model/Patient.js.map +1 -1
  117. package/icc-api/model/PatientByHcPartyGenderEducationProfession.d.ts +31 -0
  118. package/icc-api/model/PatientByHcPartyGenderEducationProfession.js +32 -0
  119. package/icc-api/model/PatientByHcPartyGenderEducationProfession.js.map +1 -0
  120. package/icc-api/model/Receipt.d.ts +2 -0
  121. package/icc-api/model/Receipt.js.map +1 -1
  122. package/icc-api/model/SecureDelegation.d.ts +52 -0
  123. package/icc-api/model/SecureDelegation.js +16 -0
  124. package/icc-api/model/SecureDelegation.js.map +1 -0
  125. package/icc-api/model/SecurityMetadata.d.ts +33 -0
  126. package/icc-api/model/SecurityMetadata.js +13 -0
  127. package/icc-api/model/SecurityMetadata.js.map +1 -0
  128. package/icc-api/model/Service.d.ts +2 -0
  129. package/icc-api/model/Service.js.map +1 -1
  130. package/icc-api/model/TimeTable.d.ts +2 -0
  131. package/icc-api/model/TimeTable.js.map +1 -1
  132. package/icc-api/model/Topic.d.ts +95 -0
  133. package/icc-api/model/Topic.js +16 -0
  134. package/icc-api/model/Topic.js.map +1 -0
  135. package/icc-api/model/internal/ExchangeData.d.ts +64 -0
  136. package/icc-api/model/internal/ExchangeData.js +15 -0
  137. package/icc-api/model/internal/ExchangeData.js.map +1 -0
  138. package/icc-api/model/internal/ExchangeDataMap.d.ts +24 -0
  139. package/icc-api/model/internal/ExchangeDataMap.js +13 -0
  140. package/icc-api/model/internal/ExchangeDataMap.js.map +1 -0
  141. package/icc-api/model/internal/SecureDelegationKeyMap.d.ts +14 -0
  142. package/icc-api/model/internal/SecureDelegationKeyMap.js +13 -0
  143. package/icc-api/model/internal/SecureDelegationKeyMap.js.map +1 -0
  144. package/icc-api/model/models.d.ts +26 -40
  145. package/icc-api/model/models.js +19 -37
  146. package/icc-api/model/models.js.map +1 -1
  147. package/icc-api/model/requests/EntityBulkShareResult.d.ts +28 -0
  148. package/icc-api/model/requests/EntityBulkShareResult.js +16 -0
  149. package/icc-api/model/requests/EntityBulkShareResult.js.map +1 -0
  150. package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.d.ts +10 -0
  151. package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js +17 -0
  152. package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js.map +1 -0
  153. package/icc-api/model/requests/EntityShareRequest.d.ts +110 -0
  154. package/icc-api/model/requests/EntityShareRequest.js +63 -0
  155. package/icc-api/model/requests/EntityShareRequest.js.map +1 -0
  156. package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.d.ts +54 -0
  157. package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js +24 -0
  158. package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js.map +1 -0
  159. package/icc-api/model/requests/MinimalEntityBulkShareResult.d.ts +23 -0
  160. package/icc-api/model/requests/MinimalEntityBulkShareResult.js +13 -0
  161. package/icc-api/model/requests/MinimalEntityBulkShareResult.js.map +1 -0
  162. package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.d.ts +21 -0
  163. package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.js +14 -0
  164. package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.js.map +1 -0
  165. package/icc-x-api/basexapi/EncryptedEntityXApi.d.ts +55 -6
  166. package/icc-x-api/basexapi/EncryptedEntityXApi.js.map +1 -1
  167. package/icc-x-api/crypto/AES.js +1 -1
  168. package/icc-x-api/crypto/AES.js.map +1 -1
  169. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.d.ts +18 -0
  170. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js +50 -0
  171. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js.map +1 -0
  172. package/icc-x-api/crypto/AccessControlSecretUtils.d.ts +43 -0
  173. package/icc-x-api/crypto/AccessControlSecretUtils.js +97 -0
  174. package/icc-x-api/crypto/AccessControlSecretUtils.js.map +1 -0
  175. package/icc-x-api/crypto/BaseExchangeDataManager.d.ts +146 -0
  176. package/icc-x-api/crypto/BaseExchangeDataManager.js +342 -0
  177. package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -0
  178. package/icc-x-api/crypto/BaseExchangeKeysManager.d.ts +0 -18
  179. package/icc-x-api/crypto/BaseExchangeKeysManager.js +11 -85
  180. package/icc-x-api/crypto/BaseExchangeKeysManager.js.map +1 -1
  181. package/icc-x-api/crypto/ConfidentialEntities.d.ts +26 -16
  182. package/icc-x-api/crypto/ConfidentialEntities.js +30 -17
  183. package/icc-x-api/crypto/ConfidentialEntities.js.map +1 -1
  184. package/icc-x-api/crypto/CryptoStrategies.d.ts +8 -1
  185. package/icc-x-api/crypto/CryptoStrategies.js.map +1 -1
  186. package/icc-x-api/crypto/DelegationsDeAnonymization.d.ts +44 -0
  187. package/icc-x-api/crypto/DelegationsDeAnonymization.js +235 -0
  188. package/icc-x-api/crypto/DelegationsDeAnonymization.js.map +1 -0
  189. package/icc-x-api/crypto/ExchangeDataManager.d.ts +97 -0
  190. package/icc-x-api/crypto/ExchangeDataManager.js +501 -0
  191. package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -0
  192. package/icc-x-api/crypto/ExchangeDataMapManager.d.ts +32 -0
  193. package/icc-x-api/crypto/ExchangeDataMapManager.js +70 -0
  194. package/icc-x-api/crypto/ExchangeDataMapManager.js.map +1 -0
  195. package/icc-x-api/crypto/ExchangeKeysManager.d.ts +4 -16
  196. package/icc-x-api/crypto/ExchangeKeysManager.js +4 -62
  197. package/icc-x-api/crypto/ExchangeKeysManager.js.map +1 -1
  198. package/icc-x-api/crypto/ExtendedApisUtils.d.ts +326 -0
  199. package/icc-x-api/crypto/ExtendedApisUtils.js +3 -0
  200. package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -0
  201. package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +174 -0
  202. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +559 -0
  203. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -0
  204. package/icc-x-api/crypto/KeyRecovery.d.ts +5 -2
  205. package/icc-x-api/crypto/KeyRecovery.js +59 -29
  206. package/icc-x-api/crypto/KeyRecovery.js.map +1 -1
  207. package/icc-x-api/crypto/LegacyCryptoStrategies.d.ts +7 -2
  208. package/icc-x-api/crypto/LegacyCryptoStrategies.js +8 -1
  209. package/icc-x-api/crypto/LegacyCryptoStrategies.js.map +1 -1
  210. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.d.ts +33 -0
  211. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js +141 -0
  212. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js.map +1 -0
  213. package/icc-x-api/crypto/RSA.d.ts +34 -8
  214. package/icc-x-api/crypto/RSA.js +80 -13
  215. package/icc-x-api/crypto/RSA.js.map +1 -1
  216. package/icc-x-api/crypto/SecureDelegationsEncryption.d.ts +54 -0
  217. package/icc-x-api/crypto/SecureDelegationsEncryption.js +178 -0
  218. package/icc-x-api/crypto/SecureDelegationsEncryption.js.map +1 -0
  219. package/icc-x-api/crypto/SecureDelegationsManager.d.ts +66 -0
  220. package/icc-x-api/crypto/SecureDelegationsManager.js +261 -0
  221. package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -0
  222. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.d.ts +46 -0
  223. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js +312 -0
  224. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js.map +1 -0
  225. package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +97 -0
  226. package/icc-x-api/crypto/SecurityMetadataDecryptor.js +79 -0
  227. package/icc-x-api/crypto/SecurityMetadataDecryptor.js.map +1 -0
  228. package/icc-x-api/crypto/ShamirKeysManager.d.ts +5 -5
  229. package/icc-x-api/crypto/ShamirKeysManager.js +6 -9
  230. package/icc-x-api/crypto/ShamirKeysManager.js.map +1 -1
  231. package/icc-x-api/crypto/TransferKeysManager.d.ts +8 -6
  232. package/icc-x-api/crypto/TransferKeysManager.js +75 -52
  233. package/icc-x-api/crypto/TransferKeysManager.js.map +1 -1
  234. package/icc-x-api/crypto/{KeyManager.d.ts → UserEncryptionKeysManager.d.ts} +4 -6
  235. package/icc-x-api/crypto/{KeyManager.js → UserEncryptionKeysManager.js} +43 -23
  236. package/icc-x-api/crypto/UserEncryptionKeysManager.js.map +1 -0
  237. package/icc-x-api/crypto/UserSignatureKeysManager.d.ts +26 -0
  238. package/icc-x-api/crypto/UserSignatureKeysManager.js +74 -0
  239. package/icc-x-api/crypto/UserSignatureKeysManager.js.map +1 -0
  240. package/icc-x-api/crypto/utils.d.ts +61 -11
  241. package/icc-x-api/crypto/utils.js +113 -44
  242. package/icc-x-api/crypto/utils.js.map +1 -1
  243. package/icc-x-api/filters/LatestMessageByHcPartyTransportGuidFilter.d.ts +8 -0
  244. package/icc-x-api/filters/LatestMessageByHcPartyTransportGuidFilter.js +13 -0
  245. package/icc-x-api/filters/LatestMessageByHcPartyTransportGuidFilter.js.map +1 -0
  246. package/icc-x-api/filters/MessageByHcPartyFilter.d.ts +7 -0
  247. package/icc-x-api/filters/MessageByHcPartyFilter.js +13 -0
  248. package/icc-x-api/filters/MessageByHcPartyFilter.js.map +1 -0
  249. package/icc-x-api/filters/MessageByHcPartyTransportGuidFilter.d.ts +8 -0
  250. package/icc-x-api/filters/MessageByHcPartyTransportGuidFilter.js +13 -0
  251. package/icc-x-api/filters/MessageByHcPartyTransportGuidFilter.js.map +1 -0
  252. package/icc-x-api/filters/TopicByHcPartyFilter.d.ts +7 -0
  253. package/icc-x-api/filters/TopicByHcPartyFilter.js +13 -0
  254. package/icc-x-api/filters/TopicByHcPartyFilter.js.map +1 -0
  255. package/icc-x-api/filters/TopicByParticipantFilter.d.ts +7 -0
  256. package/icc-x-api/filters/TopicByParticipantFilter.js +13 -0
  257. package/icc-x-api/filters/TopicByParticipantFilter.js.map +1 -0
  258. package/icc-x-api/filters/filters.d.ts +5 -0
  259. package/icc-x-api/filters/filters.js +5 -0
  260. package/icc-x-api/filters/filters.js.map +1 -1
  261. package/icc-x-api/icc-accesslog-x-api.d.ts +49 -12
  262. package/icc-x-api/icc-accesslog-x-api.js +81 -44
  263. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  264. package/icc-x-api/icc-calendar-item-x-api.d.ts +53 -15
  265. package/icc-x-api/icc-calendar-item-x-api.js +105 -51
  266. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  267. package/icc-x-api/icc-classification-x-api.d.ts +47 -10
  268. package/icc-x-api/icc-classification-x-api.js +62 -33
  269. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  270. package/icc-x-api/icc-contact-x-api.d.ts +59 -33
  271. package/icc-x-api/icc-contact-x-api.js +101 -66
  272. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  273. package/icc-x-api/icc-crypto-x-api.d.ts +33 -333
  274. package/icc-x-api/icc-crypto-x-api.js +47 -764
  275. package/icc-x-api/icc-crypto-x-api.js.map +1 -1
  276. package/icc-x-api/icc-data-owner-x-api.d.ts +20 -8
  277. package/icc-x-api/icc-data-owner-x-api.js +31 -10
  278. package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
  279. package/icc-x-api/icc-document-x-api.d.ts +51 -12
  280. package/icc-x-api/icc-document-x-api.js +117 -66
  281. package/icc-x-api/icc-document-x-api.js.map +1 -1
  282. package/icc-x-api/icc-form-x-api.d.ts +48 -11
  283. package/icc-x-api/icc-form-x-api.js +71 -37
  284. package/icc-x-api/icc-form-x-api.js.map +1 -1
  285. package/icc-x-api/icc-hcparty-x-api.d.ts +2 -2
  286. package/icc-x-api/icc-hcparty-x-api.js +3 -3
  287. package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
  288. package/icc-x-api/icc-helement-x-api.d.ts +59 -20
  289. package/icc-x-api/icc-helement-x-api.js +78 -43
  290. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  291. package/icc-x-api/icc-icure-maintenance-x-api.d.ts +7 -2
  292. package/icc-x-api/icc-icure-maintenance-x-api.js +38 -27
  293. package/icc-x-api/icc-icure-maintenance-x-api.js.map +1 -1
  294. package/icc-x-api/icc-invoice-x-api.d.ts +53 -16
  295. package/icc-x-api/icc-invoice-x-api.js +69 -35
  296. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  297. package/icc-x-api/icc-maintenance-task-x-api.d.ts +56 -22
  298. package/icc-x-api/icc-maintenance-task-x-api.js +77 -36
  299. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  300. package/icc-x-api/icc-message-x-api.d.ts +75 -19
  301. package/icc-x-api/icc-message-x-api.js +126 -37
  302. package/icc-x-api/icc-message-x-api.js.map +1 -1
  303. package/icc-x-api/icc-patient-x-api.d.ts +86 -29
  304. package/icc-x-api/icc-patient-x-api.js +318 -379
  305. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  306. package/icc-x-api/icc-receipt-x-api.d.ts +47 -13
  307. package/icc-x-api/icc-receipt-x-api.js +72 -36
  308. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  309. package/icc-x-api/icc-time-table-x-api.d.ts +46 -13
  310. package/icc-x-api/icc-time-table-x-api.js +61 -27
  311. package/icc-x-api/icc-time-table-x-api.js.map +1 -1
  312. package/icc-x-api/icc-topic-x-api.d.ts +191 -0
  313. package/icc-x-api/icc-topic-x-api.js +307 -0
  314. package/icc-x-api/icc-topic-x-api.js.map +1 -0
  315. package/icc-x-api/icc-user-x-api.d.ts +2 -2
  316. package/icc-x-api/icc-user-x-api.js +3 -3
  317. package/icc-x-api/icc-user-x-api.js.map +1 -1
  318. package/icc-x-api/index.d.ts +18 -2
  319. package/icc-x-api/index.js +203 -156
  320. package/icc-x-api/index.js.map +1 -1
  321. package/icc-x-api/maintenance/KeyPairUpdateRequest.d.ts +1 -1
  322. package/icc-x-api/storage/DefaultStorageEntryKeysFactory.d.ts +2 -0
  323. package/icc-x-api/storage/DefaultStorageEntryKeysFactory.js +9 -2
  324. package/icc-x-api/storage/DefaultStorageEntryKeysFactory.js.map +1 -1
  325. package/icc-x-api/storage/IcureStorageFacade.d.ts +23 -2
  326. package/icc-x-api/storage/IcureStorageFacade.js +36 -2
  327. package/icc-x-api/storage/IcureStorageFacade.js.map +1 -1
  328. package/icc-x-api/storage/KeyStorageFacade.d.ts +12 -0
  329. package/icc-x-api/storage/KeyStorageFacade.js.map +1 -1
  330. package/icc-x-api/storage/KeyStorageImpl.d.ts +2 -0
  331. package/icc-x-api/storage/KeyStorageImpl.js +10 -0
  332. package/icc-x-api/storage/KeyStorageImpl.js.map +1 -1
  333. package/icc-x-api/storage/StorageEntryKeysFactory.d.ts +14 -1
  334. package/icc-x-api/storage/StorageEntryKeysFactory.js.map +1 -1
  335. package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +32 -0
  336. package/icc-x-api/utils/EntityWithDelegationTypeName.js +75 -0
  337. package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -0
  338. package/icc-x-api/utils/ShareResult.d.ts +74 -0
  339. package/icc-x-api/utils/ShareResult.js +61 -0
  340. package/icc-x-api/utils/ShareResult.js.map +1 -0
  341. package/icc-x-api/utils/binary-utils.d.ts +1 -0
  342. package/icc-x-api/utils/binary-utils.js +8 -1
  343. package/icc-x-api/utils/binary-utils.js.map +1 -1
  344. package/icc-x-api/utils/collection-utils.d.ts +5 -0
  345. package/icc-x-api/utils/collection-utils.js +26 -1
  346. package/icc-x-api/utils/collection-utils.js.map +1 -1
  347. package/icc-x-api/utils/crypto-utils.d.ts +4 -3
  348. package/icc-x-api/utils/crypto-utils.js +5 -4
  349. package/icc-x-api/utils/crypto-utils.js.map +1 -1
  350. package/icc-x-api/utils/lru-temporised-async-cache.d.ts +26 -3
  351. package/icc-x-api/utils/lru-temporised-async-cache.js +75 -15
  352. package/icc-x-api/utils/lru-temporised-async-cache.js.map +1 -1
  353. package/icc-x-api/utils/websocket.d.ts +14 -10
  354. package/icc-x-api/utils/websocket.js +26 -9
  355. package/icc-x-api/utils/websocket.js.map +1 -1
  356. package/index.d.ts +1 -1
  357. package/index.js +3 -1
  358. package/index.js.map +1 -1
  359. package/package.json +2 -3
  360. package/icc-x-api/crypto/EntitiesEncryption.d.ts +0 -275
  361. package/icc-x-api/crypto/EntitiesEncryption.js +0 -734
  362. package/icc-x-api/crypto/EntitiesEncryption.js.map +0 -1
  363. package/icc-x-api/crypto/KeyManager.js.map +0 -1
@@ -20,27 +20,24 @@ const binary_utils_1 = require("./utils/binary-utils");
20
20
  const ServiceByIdsFilter_1 = require("./filters/ServiceByIdsFilter");
21
21
  const utils_1 = require("./utils");
22
22
  const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
23
- const websocket_1 = require("./utils/websocket");
23
+ const SecureDelegation_1 = require("../icc-api/model/SecureDelegation");
24
+ var AccessLevelEnum = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
24
25
  const Connection_1 = require("../icc-api/model/Connection");
25
26
  class IccContactXApi extends icc_api_1.IccContactApi {
26
- /**
27
- *
28
- * @param host
29
- * @param headers
30
- * @param crypto
31
- * @param dataOwnerApi
32
- * @param authenticationProvider
33
- * @param fetchImpl
34
- * @param contactEncryptedKeys custom encrypted fields for Contact. Note that to customise the encryption of contained services (`services` field),
35
- * you need to use the serviceEncryptedKeys parameter.
36
- * @param serviceEncryptedKeys custom encrypted fields for Service. Note that you can't customise encryption of the `content` field
37
- */
38
- constructor(host, headers, crypto, dataOwnerApi, userApi, authApi, authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
27
+ get headers() {
28
+ return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'Contact'));
29
+ }
30
+ constructor(host, headers, crypto, dataOwnerApi, userApi, authApi, autofillAuthor, authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
39
31
  ? window.fetch
40
32
  : typeof self !== 'undefined'
41
33
  ? self.fetch
42
34
  : fetch, contactEncryptedKeys = ['descr'], serviceEncryptedKeys = []) {
43
35
  super(host, headers, authenticationProvider, fetchImpl);
36
+ this.crypto = crypto;
37
+ this.dataOwnerApi = dataOwnerApi;
38
+ this.userApi = userApi;
39
+ this.authApi = authApi;
40
+ this.autofillAuthor = autofillAuthor;
44
41
  this.i18n = contact_i18n_1.default;
45
42
  if (contactEncryptedKeys.some((key) => key.startsWith('services'))) {
46
43
  throw new Error("You can't customise encryption of the `services` field of Contact. Use the serviceEncryptedKeys parameter instead.");
@@ -68,31 +65,30 @@ class IccContactXApi extends icc_api_1.IccContactApi {
68
65
  * @param options optional parameters:
69
66
  * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
70
67
  * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with
71
- * auto-delegations, in such case the access level specified here will be used. Currently only WRITE access is supported, but in future also read
72
- * access will be possible.
73
- * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the classification. The default value will be a
74
- * secret id of patient known by the topmost parent in the current data owner hierarchy.
68
+ * auto-delegations, in such case the access level specified here will be used.
69
+ * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the contact. The default value will be a
70
+ * secret id of patient known by the topmost parent in the current data owner hierarchy if the confidential is set to false, else a secret id that
71
+ * the data owner did not share with any of his parents.
75
72
  * - confidential: if true, the entity will be created as confidential. Confidential entities are not shared with auto-delegations, and the default
76
73
  * foreign key used is any key that is not shared with any of the data owner parents. By default entities are created as non-confidential.
77
74
  * @return a new instance of contact.
78
75
  */
79
76
  newInstance(user, patient, c, options = {}) {
80
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
77
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
81
78
  return __awaiter(this, void 0, void 0, function* () {
82
- const contact = new models.Contact(Object.assign(Object.assign({}, (c !== null && c !== void 0 ? c : {})), { _type: 'org.taktik.icure.entities.Contact', id: (_a = c === null || c === void 0 ? void 0 : c.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = c === null || c === void 0 ? void 0 : c.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = c === null || c === void 0 ? void 0 : c.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), responsible: (_d = c === null || c === void 0 ? void 0 : c.responsible) !== null && _d !== void 0 ? _d : this.dataOwnerApi.getDataOwnerIdOf(user), author: (_e = c === null || c === void 0 ? void 0 : c.author) !== null && _e !== void 0 ? _e : user.id, codes: (_f = c === null || c === void 0 ? void 0 : c.codes) !== null && _f !== void 0 ? _f : [], tags: (_g = c === null || c === void 0 ? void 0 : c.tags) !== null && _g !== void 0 ? _g : [], groupId: (_h = c === null || c === void 0 ? void 0 : c.groupId) !== null && _h !== void 0 ? _h : this.crypto.primitives.randomUuid(), subContacts: (_j = c === null || c === void 0 ? void 0 : c.subContacts) !== null && _j !== void 0 ? _j : [], services: (_k = c === null || c === void 0 ? void 0 : c.services) !== null && _k !== void 0 ? _k : [], openingDate: (_l = c === null || c === void 0 ? void 0 : c.openingDate) !== null && _l !== void 0 ? _l : parseInt(moment().format('YYYYMMDDHHmmss')) }));
79
+ const contact = new models.Contact(Object.assign(Object.assign({}, (c !== null && c !== void 0 ? c : {})), { _type: 'org.taktik.icure.entities.Contact', id: (_a = c === null || c === void 0 ? void 0 : c.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = c === null || c === void 0 ? void 0 : c.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = c === null || c === void 0 ? void 0 : c.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), responsible: (_d = c === null || c === void 0 ? void 0 : c.responsible) !== null && _d !== void 0 ? _d : (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined), author: (_e = c === null || c === void 0 ? void 0 : c.author) !== null && _e !== void 0 ? _e : (this.autofillAuthor ? user.id : undefined), codes: (_f = c === null || c === void 0 ? void 0 : c.codes) !== null && _f !== void 0 ? _f : [], tags: (_g = c === null || c === void 0 ? void 0 : c.tags) !== null && _g !== void 0 ? _g : [], groupId: (_h = c === null || c === void 0 ? void 0 : c.groupId) !== null && _h !== void 0 ? _h : this.crypto.primitives.randomUuid(), subContacts: (_j = c === null || c === void 0 ? void 0 : c.subContacts) !== null && _j !== void 0 ? _j : [], services: (_k = c === null || c === void 0 ? void 0 : c.services) !== null && _k !== void 0 ? _k : [], openingDate: (_l = c === null || c === void 0 ? void 0 : c.openingDate) !== null && _l !== void 0 ? _l : parseInt(moment().format('YYYYMMDDHHmmss')) }));
83
80
  const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
84
81
  if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
85
82
  throw new Error('Can only initialise entities as current data owner.');
86
- const sfk = (_m = options.preferredSfk) !== null && _m !== void 0 ? _m : (!!options.confidential
87
- ? yield this.crypto.confidential.getConfidentialSecretId(patient)
88
- : yield this.crypto.confidential.getAnySecretIdSharedWithParents(patient));
83
+ const sfk = (_m = options.preferredSfk) !== null && _m !== void 0 ? _m : ((options === null || options === void 0 ? void 0 : options.confidential)
84
+ ? yield this.crypto.confidential.getConfidentialSecretId({ entity: patient, type: 'Patient' })
85
+ : yield this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: patient, type: 'Patient' }));
89
86
  if (!sfk)
90
- throw new Error(`Couldn't find any sfk of parent patient ${patient.id} for confidential=${!!options.confidential}`);
91
- const extraDelegations = [
92
- ...Object.keys((_o = options.additionalDelegates) !== null && _o !== void 0 ? _o : {}),
93
- ...(options.confidential ? [] : [...((_q = (_p = user.autoDelegations) === null || _p === void 0 ? void 0 : _p.all) !== null && _q !== void 0 ? _q : []), ...((_s = (_r = user.autoDelegations) === null || _r === void 0 ? void 0 : _r.medicalInformation) !== null && _s !== void 0 ? _s : [])]),
94
- ];
95
- const initialisationInfo = yield this.crypto.entities.entityWithInitialisedEncryptedMetadata(contact, patient.id, sfk, true, extraDelegations);
87
+ throw new Error(`Couldn't find any sfk of parent patient ${patient.id} for confidential=${(_o = options.confidential) !== null && _o !== void 0 ? _o : false}`);
88
+ const extraDelegations = Object.assign(Object.assign({}, (options.confidential
89
+ ? {}
90
+ : Object.fromEntries([...((_q = (_p = user.autoDelegations) === null || _p === void 0 ? void 0 : _p.all) !== null && _q !== void 0 ? _q : []), ...((_s = (_r = user.autoDelegations) === null || _r === void 0 ? void 0 : _r.medicalInformation) !== null && _s !== void 0 ? _s : [])].map((d) => [d, AccessLevelEnum.WRITE])))), ((_t = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _t !== void 0 ? _t : {}));
91
+ const initialisationInfo = yield this.crypto.xapi.entityWithInitialisedEncryptedMetadata(contact, 'Contact', patient.id, sfk, true, false, extraDelegations);
96
92
  return new models.Contact(initialisationInfo.updatedEntity);
97
93
  });
98
94
  }
@@ -114,7 +110,7 @@ class IccContactXApi extends icc_api_1.IccContactApi {
114
110
  */
115
111
  findBy(hcpartyId, patient, usingPost = false) {
116
112
  return __awaiter(this, void 0, void 0, function* () {
117
- return yield this.crypto.entities.secretIdsForHcpHierarchyOf(patient).then((keysHierarchy) => keysHierarchy && keysHierarchy.length > 0
113
+ return yield this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: 'Patient' }).then((keysHierarchy) => keysHierarchy && keysHierarchy.length > 0
118
114
  ? Promise.all(keysHierarchy
119
115
  .reduce((acc, level) => {
120
116
  return acc.concat([
@@ -136,7 +132,7 @@ class IccContactXApi extends icc_api_1.IccContactApi {
136
132
  const perHcpId = {};
137
133
  for (const patient of patients) {
138
134
  ;
139
- (yield this.crypto.entities.secretIdsForHcpHierarchyOf(patient))
135
+ (yield this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: 'Patient' }))
140
136
  .reduce((acc, level) => {
141
137
  return acc.concat([
142
138
  {
@@ -235,11 +231,11 @@ class IccContactXApi extends icc_api_1.IccContactApi {
235
231
  }
236
232
  modifyContactWithUser(user, body) {
237
233
  return __awaiter(this, void 0, void 0, function* () {
238
- return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : null;
234
+ return body ? this.modifyContactAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : null;
239
235
  });
240
236
  }
241
- modifyAs(dataOwner, contact) {
242
- return this.encryptAs(dataOwner, [_.cloneDeep(contact)])
237
+ modifyContactAs(dataOwner, body) {
238
+ return this.encryptAs(dataOwner, [_.cloneDeep(body)])
243
239
  .then((ctcs) => super.modifyContact(ctcs[0]))
244
240
  .then((ctc) => this.decrypt(dataOwner, [ctc]))
245
241
  .then((ctcs) => ctcs[0]);
@@ -322,11 +318,14 @@ class IccContactXApi extends icc_api_1.IccContactApi {
322
318
  encryptAs(hcpartyId, ctcs) {
323
319
  const bypassEncryption = false; //Used for debug
324
320
  return Promise.all(ctcs.map((ctc) => __awaiter(this, void 0, void 0, function* () {
325
- var _a;
326
- const initialisedCtc = bypassEncryption //Prevent encryption for test ctc
327
- ? ctc
328
- : (_a = (yield this.crypto.entities.ensureEncryptionKeysInitialised(ctc))) !== null && _a !== void 0 ? _a : ctc;
329
- const encryptionKey = yield this.crypto.entities.importFirstValidKey(yield this.crypto.entities.encryptionKeysOf(ctc, hcpartyId), ctc.id);
321
+ let initialisedCtc = ctc;
322
+ if (!bypassEncryption) {
323
+ const contactWithKeys = yield this.crypto.xapi.ensureEncryptionKeysInitialised(ctc, 'Contact');
324
+ if (contactWithKeys) {
325
+ initialisedCtc = contactWithKeys;
326
+ }
327
+ }
328
+ const encryptionKey = yield this.crypto.xapi.decryptAndImportAnyEncryptionKey({ entity: initialisedCtc, type: 'Contact' });
330
329
  return new models_1.Contact(yield (0, utils_1.encryptObject)(Object.assign(Object.assign({}, initialisedCtc), { services: initialisedCtc.services ? yield this.encryptServices(encryptionKey.key, encryptionKey.raw, initialisedCtc.services) : [] }), (obj) => {
331
330
  return this.crypto.primitives.AES.encrypt(encryptionKey.key, (0, binary_utils_1.utf8_2ua)(JSON.stringify(obj)), encryptionKey.raw);
332
331
  }, this.contactEncryptedFields, 'contact'));
@@ -334,25 +333,31 @@ class IccContactXApi extends icc_api_1.IccContactApi {
334
333
  }
335
334
  decrypt(hcpartyId, ctcs) {
336
335
  return Promise.all(ctcs.map((ctc) => __awaiter(this, void 0, void 0, function* () {
337
- const keys = yield this.crypto.entities.importAllValidKeys(yield this.crypto.entities.encryptionKeysOf(ctc, hcpartyId));
336
+ const keys = yield this.crypto.xapi.decryptAndImportAllDecryptionKeys({ entity: ctc, type: 'Contact' });
338
337
  if (!keys || !keys.length) {
339
338
  console.log('Cannot decrypt contact', ctc.id);
340
339
  return ctc;
341
340
  }
342
341
  return new models_1.Contact(yield (0, utils_1.decryptObject)(ctc, (encrypted) => __awaiter(this, void 0, void 0, function* () {
343
342
  var _a;
344
- return (_a = (yield this.crypto.entities.tryDecryptJson(keys, encrypted, false))) !== null && _a !== void 0 ? _a : {};
343
+ return (_a = (yield this.crypto.xapi.tryDecryptJson(keys, encrypted, false))) !== null && _a !== void 0 ? _a : {};
345
344
  })));
346
345
  })));
347
346
  }
348
347
  decryptServices(hcpartyId, svcs, keys) {
348
+ const contactKeysCache = {};
349
349
  return Promise.all(svcs.map((svc) => __awaiter(this, void 0, void 0, function* () {
350
- if (!keys) {
351
- keys = yield this.crypto.entities.importAllValidKeys(yield this.crypto.entities.encryptionKeysOf(svc, hcpartyId));
350
+ let currentKeys = keys !== null && keys !== void 0 ? keys : (svc.contactId ? contactKeysCache[svc.contactId] : undefined);
351
+ if (!currentKeys) {
352
+ const decryptedKeys = yield this.crypto.xapi.decryptAndImportAllDecryptionKeys({ entity: svc, type: 'Contact' });
353
+ if (svc.contactId) {
354
+ contactKeysCache[svc.contactId] = decryptedKeys;
355
+ }
356
+ currentKeys = decryptedKeys;
352
357
  }
353
358
  return new models_1.Service(yield (0, utils_1.decryptObject)(svc, (encrypted) => __awaiter(this, void 0, void 0, function* () {
354
359
  var _a;
355
- return (_a = (yield this.crypto.entities.tryDecryptJson(keys, encrypted, false))) !== null && _a !== void 0 ? _a : {};
360
+ return (_a = (yield this.crypto.xapi.tryDecryptJson(currentKeys, encrypted, false))) !== null && _a !== void 0 ? _a : {};
356
361
  })));
357
362
  })));
358
363
  }
@@ -718,12 +723,20 @@ class IccContactXApi extends icc_api_1.IccContactApi {
718
723
  */
719
724
  decryptPatientIdOf(contact) {
720
725
  return __awaiter(this, void 0, void 0, function* () {
721
- return this.crypto.entities.owningEntityIdsOf(contact, undefined);
726
+ return this.crypto.xapi.owningEntityIdsOf({ entity: contact, type: 'Contact' }, undefined);
727
+ });
728
+ }
729
+ /**
730
+ * @return if the logged data owner has write access to the content of the given contact
731
+ */
732
+ hasWriteAccess(contact) {
733
+ return __awaiter(this, void 0, void 0, function* () {
734
+ return this.crypto.xapi.hasWriteAccess({ entity: contact, type: 'Contact' });
722
735
  });
723
736
  }
724
737
  /**
725
738
  * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also
726
- * the encrypted content.
739
+ * the encrypted content, with read-only or read-write permissions.
727
740
  * @param delegateId the id of the data owner which will be granted access to the contact.
728
741
  * @param contact the contact to share.
729
742
  * @param options optional parameters to customize the sharing behaviour:
@@ -732,7 +745,8 @@ class IccContactXApi extends icc_api_1.IccContactApi {
732
745
  * contact does not have encrypted content.
733
746
  * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to
734
747
  * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
735
- * @return a promise which will contain the updated contact.
748
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
749
+ * @return the updated entity
736
750
  */
737
751
  shareWith(delegateId, contact, options = {}) {
738
752
  return __awaiter(this, void 0, void 0, function* () {
@@ -741,55 +755,76 @@ class IccContactXApi extends icc_api_1.IccContactApi {
741
755
  }
742
756
  /**
743
757
  * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also
744
- * the encrypted content.
758
+ * the encrypted content, with read-only or read-write permissions.
745
759
  * @param contact the contact to share.
746
- * @param delegates share options for each delegate.
760
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
747
761
  * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
748
762
  * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
749
763
  * contact does not have encrypted content.
750
764
  * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to
751
765
  * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
752
- * @return a promise which will contain the updated contact.
766
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
767
+ * @return the updated entity
753
768
  */
754
769
  shareWithMany(contact, delegates) {
770
+ return __awaiter(this, void 0, void 0, function* () {
771
+ return (yield this.tryShareWithMany(contact, delegates)).updatedEntityOrThrow;
772
+ });
773
+ }
774
+ /**
775
+ * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also
776
+ * the encrypted content, with read-only or read-write permissions.
777
+ * @param contact the contact to share.
778
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
779
+ * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
780
+ * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
781
+ * contact does not have encrypted content.
782
+ * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to
783
+ * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
784
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
785
+ * @return a promise which will contain the result of the operation: the updated entity if the operation was successful or details of the error if
786
+ * the operation failed.
787
+ */
788
+ tryShareWithMany(contact, delegates) {
755
789
  return __awaiter(this, void 0, void 0, function* () {
756
790
  const self = yield this.dataOwnerApi.getCurrentDataOwnerId();
757
- const extended = yield this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(contact, true, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
791
+ // All entities should have an encryption key.
792
+ const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(contact, 'Contact');
793
+ const updatedEntity = entityWithEncryptionKey ? yield this.modifyContactAs(self, entityWithEncryptionKey) : contact;
794
+ return this.crypto.xapi
795
+ .simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type: 'Contact' }, true, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
758
796
  delegateId,
759
797
  {
760
- shareEncryptionKey: options.shareEncryptionKey,
798
+ requestedPermissions: options.requestedPermissions,
799
+ shareEncryptionKeys: options.shareEncryptionKey,
761
800
  shareOwningEntityIds: options.sharePatientId,
801
+ shareSecretIds: undefined,
762
802
  },
763
- ])));
764
- if (!!extended) {
765
- return yield this.modifyAs(self, extended);
766
- }
767
- else
768
- return contact;
803
+ ])), (x) => this.bulkShareContacts(x))
804
+ .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])));
769
805
  });
770
806
  }
771
807
  getDataOwnersWithAccessTo(entity) {
772
- return __awaiter(this, void 0, void 0, function* () {
773
- return yield this.crypto.entities.getDataOwnersWithAccessTo(entity);
774
- });
808
+ return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: 'Contact' });
775
809
  }
776
810
  getEncryptionKeysOf(entity) {
777
- return __awaiter(this, void 0, void 0, function* () {
778
- return yield this.crypto.entities.encryptionKeysOf(entity);
779
- });
811
+ return this.crypto.xapi.encryptionKeysOf({ entity, type: 'Contact' }, undefined);
780
812
  }
781
813
  subscribeToServiceEvents(eventTypes, filter, eventFired, options = {}) {
782
814
  return __awaiter(this, void 0, void 0, function* () {
783
815
  const currentUser = yield this.userApi.getCurrentUser();
784
- return (0, websocket_1.subscribeToEntityEvents)(this.host, this.authApi, 'Service', eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decryptServices(currentUser.healthcarePartyId, [encrypted]))[0]; })).then((ws) => new Connection_1.ConnectionImpl(ws));
816
+ return (0, utils_1.subscribeToEntityEvents)(this.host, this.authApi, 'Service', eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decryptServices(currentUser.healthcarePartyId, [encrypted]))[0]; })).then((ws) => new Connection_1.ConnectionImpl(ws));
785
817
  });
786
818
  }
787
819
  subscribeToContactEvents(eventTypes, filter, eventFired, options = {}) {
788
820
  return __awaiter(this, void 0, void 0, function* () {
789
821
  const currentUser = yield this.userApi.getCurrentUser();
790
- return (0, websocket_1.subscribeToEntityEvents)(this.host, this.authApi, 'Contact', eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decrypt(currentUser.healthcarePartyId, [encrypted]))[0]; })).then((ws) => new Connection_1.ConnectionImpl(ws));
822
+ return (0, utils_1.subscribeToEntityEvents)(this.host, this.authApi, 'Contact', eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decrypt(currentUser.healthcarePartyId, [encrypted]))[0]; })).then((ws) => new Connection_1.ConnectionImpl(ws));
791
823
  });
792
824
  }
825
+ createDelegationDeAnonymizationMetadata(entity, delegates) {
826
+ return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: 'Contact' }, delegates);
827
+ }
793
828
  }
794
829
  exports.IccContactXApi = IccContactXApi;
795
830
  //# sourceMappingURL=icc-contact-x-api.js.map