@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
@@ -26,14 +26,22 @@ const _ = require("lodash");
26
26
  const models_1 = require("../icc-api/model/models");
27
27
  const icc_api_1 = require("../icc-api");
28
28
  const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
29
+ const EntityShareRequest_1 = require("../icc-api/model/requests/EntityShareRequest");
30
+ var RequestedPermissionEnum = EntityShareRequest_1.EntityShareRequest.RequestedPermissionEnum;
31
+ const SecureDelegation_1 = require("../icc-api/model/SecureDelegation");
32
+ var AccessLevelEnum = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
29
33
  const utils_1 = require("./utils");
30
34
  class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
31
- constructor(host, headers, crypto, dataOwnerApi, encryptedKeys = ['details', 'title', 'patientId'], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
35
+ get headers() {
36
+ return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'CalendarItem'));
37
+ }
38
+ constructor(host, headers, crypto, dataOwnerApi, autofillAuthor, encryptedKeys = ['details', 'title', 'patientId'], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
32
39
  ? window.fetch
33
40
  : typeof self !== 'undefined'
34
41
  ? self.fetch
35
42
  : fetch) {
36
43
  super(host, headers, authenticationProvider, fetchImpl);
44
+ this.autofillAuthor = autofillAuthor;
37
45
  this.i18n = i18n;
38
46
  this.crypto = crypto;
39
47
  this.dataOwnerApi = dataOwnerApi;
@@ -51,9 +59,8 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
51
59
  * @param options optional parameters:
52
60
  * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
53
61
  * 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
54
- * auto-delegations, in such case the access level specified here will be used. Currently only WRITE access is supported, but in future also read
55
- * access will be possible.
56
- * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the access log. The default value will be a
62
+ * auto-delegations, in such case the access level specified here will be used.
63
+ * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the classcalendar itemification. The default value will be a
57
64
  * secret id of patient known by the topmost parent in the current data owner hierarchy.
58
65
  * @return a new instance of calendar item.
59
66
  */
@@ -62,31 +69,29 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
62
69
  return __awaiter(this, void 0, void 0, function* () {
63
70
  if (!patient && options.preferredSfk)
64
71
  throw new Error('You need to specify parent patient in order to use secret foreign keys.');
65
- const calendarItem = Object.assign(Object.assign({}, (ci !== null && ci !== void 0 ? ci : {})), { _type: 'org.taktik.icure.entities.CalendarItem', id: (_a = ci === null || ci === void 0 ? void 0 : ci.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = ci === null || ci === void 0 ? void 0 : ci.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = ci === null || ci === void 0 ? void 0 : ci.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), responsible: (_d = ci === null || ci === void 0 ? void 0 : ci.responsible) !== null && _d !== void 0 ? _d : this.dataOwnerApi.getDataOwnerIdOf(user), author: (_e = ci === null || ci === void 0 ? void 0 : ci.author) !== null && _e !== void 0 ? _e : user.id, codes: (_f = ci === null || ci === void 0 ? void 0 : ci.codes) !== null && _f !== void 0 ? _f : [], tags: (_g = ci === null || ci === void 0 ? void 0 : ci.tags) !== null && _g !== void 0 ? _g : [] });
72
+ const calendarItem = Object.assign(Object.assign({}, (ci !== null && ci !== void 0 ? ci : {})), { _type: 'org.taktik.icure.entities.CalendarItem', id: (_a = ci === null || ci === void 0 ? void 0 : ci.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = ci === null || ci === void 0 ? void 0 : ci.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = ci === null || ci === void 0 ? void 0 : ci.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), responsible: (_d = ci === null || ci === void 0 ? void 0 : ci.responsible) !== null && _d !== void 0 ? _d : (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined), author: (_e = ci === null || ci === void 0 ? void 0 : ci.author) !== null && _e !== void 0 ? _e : (this.autofillAuthor ? user.id : undefined), codes: (_f = ci === null || ci === void 0 ? void 0 : ci.codes) !== null && _f !== void 0 ? _f : [], tags: (_g = ci === null || ci === void 0 ? void 0 : ci.tags) !== null && _g !== void 0 ? _g : [] });
66
73
  const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
67
74
  if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
68
75
  throw new Error('Can only initialise entities as current data owner.');
69
- const sfk = patient ? (_h = options.preferredSfk) !== null && _h !== void 0 ? _h : (yield this.crypto.confidential.getAnySecretIdSharedWithParents(patient)) : undefined;
76
+ const sfk = patient
77
+ ? (_h = options === null || options === void 0 ? void 0 : options.preferredSfk) !== null && _h !== void 0 ? _h : (yield this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: patient, type: 'Patient' }))
78
+ : undefined;
70
79
  if (patient && !sfk)
71
80
  throw new Error(`Couldn't find any sfk of parent patient ${patient.id}`);
72
- const extraDelegations = [
73
- ...Object.keys((_j = options.additionalDelegates) !== null && _j !== void 0 ? _j : {}),
74
- ...((_l = (_k = user.autoDelegations) === null || _k === void 0 ? void 0 : _k.all) !== null && _l !== void 0 ? _l : []),
75
- ...((_o = (_m = user.autoDelegations) === null || _m === void 0 ? void 0 : _m.medicalInformation) !== null && _o !== void 0 ? _o : []),
76
- ];
77
- return new models_1.CalendarItem(yield this.crypto.entities
78
- .entityWithInitialisedEncryptedMetadata(calendarItem, patient === null || patient === void 0 ? void 0 : patient.id, sfk, true, extraDelegations)
81
+ const extraDelegations = Object.assign(Object.assign({}, Object.fromEntries([...((_k = (_j = user.autoDelegations) === null || _j === void 0 ? void 0 : _j.all) !== null && _k !== void 0 ? _k : []), ...((_m = (_l = user.autoDelegations) === null || _l === void 0 ? void 0 : _l.medicalInformation) !== null && _m !== void 0 ? _m : [])].map((d) => [d, AccessLevelEnum.WRITE]))), ((_o = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _o !== void 0 ? _o : {}));
82
+ return new models_1.CalendarItem(yield this.crypto.xapi
83
+ .entityWithInitialisedEncryptedMetadata(calendarItem, 'CalendarItem', patient === null || patient === void 0 ? void 0 : patient.id, sfk, true, false, extraDelegations)
79
84
  .then((x) => x.updatedEntity));
80
85
  });
81
86
  }
82
87
  findBy(hcpartyId, patient, usingPost = false) {
83
88
  return __awaiter(this, void 0, void 0, function* () {
84
- const extractedKeys = yield this.crypto.entities.secretIdsOf(patient, hcpartyId);
89
+ const extractedKeys = yield this.crypto.xapi.secretIdsOf({ entity: patient, type: 'Patient' }, hcpartyId);
85
90
  const topmostParentId = (yield this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0];
86
91
  return extractedKeys && extractedKeys.length > 0
87
92
  ? usingPost
88
- ? yield this.findByHCPartyPatientSecretFKeysArray(topmostParentId, _.uniq(extractedKeys))
89
- : yield this.findByHCPartyPatientSecretFKeys(topmostParentId, _.uniq(extractedKeys).join(','))
93
+ ? this.findByHCPartyPatientSecretFKeysArray(hcpartyId, _.uniq(extractedKeys))
94
+ : this.findByHCPartyPatientSecretFKeys(hcpartyId, _.uniq(extractedKeys).join(','))
90
95
  : Promise.resolve([]);
91
96
  });
92
97
  }
@@ -182,18 +187,18 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
182
187
  }
183
188
  modifyAs(dataOwner, body) {
184
189
  return this.encryptAs(dataOwner, [_.cloneDeep(body)])
185
- .then((als) => super.modifyCalendarItem(als[0]))
186
- .then((body) => this.decrypt(dataOwner, [body]))
187
- .then((als) => als[0]);
190
+ .then((items) => super.modifyCalendarItem(items[0]))
191
+ .then((ci) => this.decrypt(dataOwner, [ci]))
192
+ .then((cis) => cis[0]);
188
193
  }
189
194
  encrypt(user, calendarItems) {
190
195
  return this.encryptAs(this.dataOwnerApi.getDataOwnerIdOf(user), calendarItems);
191
196
  }
192
- encryptAs(dataOwnerId, calendarItems) {
193
- return Promise.all(calendarItems.map((x) => this.crypto.entities.tryEncryptEntity(x, dataOwnerId, this.encryptedFields, false, true, (json) => new models_1.CalendarItem(json))));
197
+ encryptAs(dataOwner, calendarItems) {
198
+ return Promise.all(calendarItems.map((x) => this.crypto.xapi.tryEncryptEntity(x, 'CalendarItem', this.encryptedFields, false, false, (json) => new models_1.CalendarItem(json))));
194
199
  }
195
200
  decrypt(hcpId, calendarItems) {
196
- return Promise.all(calendarItems.map((x) => this.crypto.entities.decryptEntity(x, hcpId, (json) => new models_1.CalendarItem(json)).then(({ entity }) => entity)));
201
+ return Promise.all(calendarItems.map((x) => this.crypto.xapi.decryptEntity(x, 'CalendarItem', (json) => new models_1.CalendarItem(json)).then(({ entity }) => entity)));
197
202
  }
198
203
  /**
199
204
  * @param calendarItem a calendar item
@@ -202,12 +207,20 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
202
207
  */
203
208
  decryptPatientIdOf(calendarItem) {
204
209
  return __awaiter(this, void 0, void 0, function* () {
205
- return this.crypto.entities.owningEntityIdsOf(calendarItem, undefined);
210
+ return this.crypto.xapi.owningEntityIdsOf({ entity: calendarItem, type: 'CalendarItem' }, undefined);
211
+ });
212
+ }
213
+ /**
214
+ * @return if the logged data owner has write access to the content of the given calendar item
215
+ */
216
+ hasWriteAccess(calendarItem) {
217
+ return __awaiter(this, void 0, void 0, function* () {
218
+ return this.crypto.xapi.hasWriteAccess({ entity: calendarItem, type: 'CalendarItem' });
206
219
  });
207
220
  }
208
221
  /**
209
222
  * Share an existing calendar item with other data owners, allowing them to access the non-encrypted data of the calendar item and optionally also
210
- * the encrypted content.
223
+ * the encrypted content, with read-only or read-write permissions.
211
224
  * @param delegateId the id of the data owner which will be granted access to the calendar item.
212
225
  * @param calendarItem item the calendar item to share.
213
226
  * @param options optional parameters to customize the sharing behaviour:
@@ -216,7 +229,9 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
216
229
  * calendar item does not have encrypted content.
217
230
  * - sharePatientId: specifies if the id of the patient that this calendar item refers to should be shared with the delegate (defaults to
218
231
  * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
219
- * @return a promise which will contain the updated entity.
232
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
233
+ * @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
234
+ * the operation failed.
220
235
  */
221
236
  shareWith(delegateId, calendarItem, options = {}) {
222
237
  return __awaiter(this, void 0, void 0, function* () {
@@ -225,70 +240,109 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
225
240
  }
226
241
  /**
227
242
  * Share an existing calendar item with other data owners, allowing them to access the non-encrypted data of the calendar item and optionally also
228
- * the encrypted content.
243
+ * the encrypted content, with read-only or read-write permissions.
229
244
  * @param calendarItem item the calendar item to share.
230
- * @param delegates sharing options for each delegate.
245
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
231
246
  * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
232
247
  * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
233
248
  * calendar item does not have encrypted content.
234
249
  * - sharePatientId: specifies if the id of the patient that this calendar item refers to should be shared with the delegate (defaults to
235
250
  * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
236
- * @return a promise which will contain the updated entity.
251
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
252
+ * @return the updated entity
237
253
  */
238
254
  shareWithMany(calendarItem, delegates) {
255
+ return __awaiter(this, void 0, void 0, function* () {
256
+ return (yield this.tryShareWithMany(calendarItem, delegates)).updatedEntityOrThrow;
257
+ });
258
+ }
259
+ /**
260
+ * Share an existing calendar item with other data owners, allowing them to access the non-encrypted data of the calendar item and optionally also
261
+ * the encrypted content, with read-only or read-write permissions.
262
+ * @param calendarItem item the calendar item to share.
263
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
264
+ * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
265
+ * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
266
+ * calendar item does not have encrypted content.
267
+ * - sharePatientId: specifies if the id of the patient that this calendar item refers to should be shared with the delegate (defaults to
268
+ * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
269
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
270
+ * @return the updated entity
271
+ */
272
+ tryShareWithMany(calendarItem, delegates) {
239
273
  return __awaiter(this, void 0, void 0, function* () {
240
274
  const self = yield this.dataOwnerApi.getCurrentDataOwnerId();
241
- const extended = yield this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(calendarItem, true, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
275
+ // All entities should have an encryption key.
276
+ const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(calendarItem, 'CalendarItem');
277
+ const updatedEntity = entityWithEncryptionKey ? yield this.modifyAs(self, entityWithEncryptionKey) : calendarItem;
278
+ return this.crypto.xapi
279
+ .simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type: 'CalendarItem' }, true, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
242
280
  delegateId,
243
281
  {
244
- shareEncryptionKey: options.shareEncryptionKey,
282
+ requestedPermissions: options.requestedPermissions,
283
+ shareEncryptionKeys: options.shareEncryptionKey,
245
284
  shareOwningEntityIds: options.sharePatientId,
285
+ shareSecretIds: undefined,
246
286
  },
247
- ])));
248
- if (!!extended) {
249
- return yield this.modifyAs(self, extended);
250
- }
251
- else
252
- return calendarItem;
287
+ ])), (x) => this.bulkShareCalendarItems(x))
288
+ .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])));
253
289
  });
254
290
  }
255
291
  getDataOwnersWithAccessTo(entity) {
256
- return __awaiter(this, void 0, void 0, function* () {
257
- return yield this.crypto.entities.getDataOwnersWithAccessTo(entity);
258
- });
292
+ return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: 'CalendarItem' });
259
293
  }
260
294
  getEncryptionKeysOf(entity) {
261
- return __awaiter(this, void 0, void 0, function* () {
262
- return yield this.crypto.entities.encryptionKeysOf(entity);
263
- });
295
+ return this.crypto.xapi.encryptionKeysOf({ entity, type: 'CalendarItem' }, undefined);
264
296
  }
265
297
  /**
266
298
  * Links a calendar item with a patient. Note that this operation is not reversible: it is not possible to change the patient linked to a calendar
267
299
  * item.
268
300
  * @param calendarItem a calendar item
269
- * @param patient the patient which will be linked to the calendar item
270
- * @param shareLinkWithDelegates data owners other than the current data owner which will also be able to decrypt the id of the newly linked patient
301
+ * @param patient the patient which will be linked to the calendar item.
302
+ * @param shareLinkWithDelegates data owners other than the current data owner which will also be able to decrypt the id of the newly linked
303
+ * patient. If any of these data owners do not already have access to the calendar item, they will be granted read access (no write).
271
304
  * @return the updated calendar item
272
305
  */
273
306
  linkToPatient(calendarItem, patient, shareLinkWithDelegates) {
274
- var _a, _b;
307
+ var _a;
275
308
  return __awaiter(this, void 0, void 0, function* () {
276
309
  if (!!((_a = calendarItem.secretForeignKeys) === null || _a === void 0 ? void 0 : _a.length))
277
310
  throw new Error(`Calendar item ${calendarItem.id} is already linked to a patient`);
278
311
  const delegates = [...new Set([yield this.dataOwnerApi.getCurrentDataOwnerId(), ...shareLinkWithDelegates])];
279
- const sfk = yield this.crypto.confidential.getAnySecretIdSharedWithParents(patient);
312
+ const sfk = yield this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: patient, type: 'Patient' });
280
313
  if (!sfk) {
281
314
  throw new Error(`Could not find any secret id for patient ${patient.id} which is shared with the topmost ancestor of the current data owner`);
282
315
  }
283
- let updated = Object.assign(Object.assign({}, calendarItem), { secretForeignKeys: [sfk] });
284
- for (const delegate of delegates) {
285
- updated = (_b = (yield this.crypto.entities.entityWithExtendedEncryptedMetadata(updated, delegate, [], [], [patient.id]))) !== null && _b !== void 0 ? _b : updated;
316
+ const individualShareData = {
317
+ shareSecretIds: [],
318
+ shareEncryptionKeys: [],
319
+ shareOwningEntityIds: [patient.id],
320
+ requestedPermissions: RequestedPermissionEnum.FULL_READ,
321
+ };
322
+ const shared = yield this.crypto.xapi.bulkShareOrUpdateEncryptedEntityMetadata('CalendarItem', [
323
+ {
324
+ entity: calendarItem,
325
+ dataForDelegates: Object.fromEntries(delegates.map((d) => [d, individualShareData])),
326
+ },
327
+ ], (x) => this.bulkShareCalendarItems(x));
328
+ if (!shared.updatedEntities.length || shared.updatedEntities[0].id !== calendarItem.id) {
329
+ const errorsForEntity = shared.updateErrors.filter((e) => e.entityId === calendarItem.id);
330
+ if (!errorsForEntity.length || !errorsForEntity.find((x) => x.code === 409)) {
331
+ throw new Error(`Unexpected error while linking calendar item ${calendarItem.id}`);
332
+ }
333
+ else {
334
+ throw new Error(`Outdated calendar item revision ${calendarItem.id}-${calendarItem.rev}`);
335
+ }
286
336
  }
287
337
  const self = yield this.dataOwnerApi.getCurrentDataOwnerId();
288
- const saved = yield this.modifyAs(self, updated);
289
- return (yield this.decrypt(self, [saved]))[0];
338
+ const sharedDecrypted = (yield this.decrypt(self, [shared.updatedEntities[0]]))[0];
339
+ const withSfk = yield this.modifyAs(self, Object.assign(Object.assign({}, sharedDecrypted), { secretForeignKeys: [sfk] }));
340
+ return (yield this.decrypt(self, [withSfk]))[0];
290
341
  });
291
342
  }
343
+ createDelegationDeAnonymizationMetadata(entity, delegates) {
344
+ return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: 'CalendarItem' }, delegates);
345
+ }
292
346
  }
293
347
  exports.IccCalendarItemXApi = IccCalendarItemXApi;
294
348
  //# sourceMappingURL=icc-calendar-item-x-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"icc-calendar-item-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-calendar-item-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA2C;AAE3C,4BAA2B;AAE3B,oDAA4D;AAE5D,wCAA+C;AAE/C,0EAAgG;AAGhG,mCAAuE;AAEvE,MAAa,mBAAoB,SAAQ,4BAAkB;IAMzD,YACE,IAAY,EACZ,OAAkC,EAClC,MAAqB,EACrB,YAA8B,EAC9B,gBAA+B,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,CAAC,EAChE,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,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I,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,qBAAqB,EAAE,EAAE,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAA;YAC5G,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAA;YACnF,IAAI,CAAC,GAAG,EAAE;gBACR,MAAM,IAAI,KAAK,CAAC,4CAA4C,OAAO,CAAC,EAAE,sEAAsE,CAAC,CAAA;aAC9I;YACD,IAAI,OAAO,mCACN,YAAY,KACf,iBAAiB,EAAE,CAAC,GAAG,CAAC,GACzB,CAAA;YACD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;gBAChC,OAAO,GAAG,MAAA,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,mCAAmC,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,EAAG,CAAC,CAAC,CAAC,mCAAI,OAAO,CAAA;aAChI;YACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,qBAAqB,EAAE,CAAA;YAC5D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YAChD,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;;KAC9C;CACF;AA1UD,kDA0UC","sourcesContent":["import * as i18n from './rsrc/contact.i18n'\n\nimport * as _ from 'lodash'\nimport * as models from '../icc-api/model/models'\nimport { CalendarItem, User } from '../icc-api/model/models'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport { IccCalendarItemApi } from '../icc-api'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { EncryptedFieldsManifest, parseEncryptedFields } from './utils'\n\nexport class IccCalendarItemXApi extends IccCalendarItemApi implements EncryptedEntityXApi<models.CalendarItem> {\n i18n: any = i18n\n crypto: IccCryptoXApi\n dataOwnerApi: IccDataOwnerXApi\n private readonly encryptedFields: EncryptedFieldsManifest\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\n encryptedKeys: Array<string> = ['details', 'title', 'patientId'],\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.crypto = crypto\n this.dataOwnerApi = dataOwnerApi\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'CalendarItem.')\n }\n\n newInstance(user: User, ci: CalendarItem, options: { additionalDelegates?: { [dataOwnerId: string]: 'WRITE' } } = {}) {\n return this.newInstancePatient(user, null, ci, options)\n }\n\n /**\n * Creates a new instance of calendar item with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this calendar item refers to.\n * @param ci initialised data for the calendar item. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * 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\n * auto-delegations, in such case the access level specified here will be used. Currently only WRITE access is supported, but in future also read\n * access will be possible.\n * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the access log. The default value will be a\n * secret id of patient known by the topmost parent in the current data owner hierarchy.\n * @return a new instance of calendar item.\n */\n async newInstancePatient(\n user: models.User,\n patient: models.Patient | null,\n ci: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: 'WRITE' }\n preferredSfk?: string\n } = {}\n ): Promise<models.CalendarItem> {\n if (!patient && options.preferredSfk) throw new Error('You need to specify parent patient in order to use secret foreign keys.')\n const calendarItem = {\n ...(ci ?? {}),\n _type: 'org.taktik.icure.entities.CalendarItem',\n id: ci?.id ?? this.crypto.primitives.randomUuid(),\n created: ci?.created ?? new Date().getTime(),\n modified: ci?.modified ?? new Date().getTime(),\n responsible: ci?.responsible ?? this.dataOwnerApi.getDataOwnerIdOf(user),\n author: ci?.author ?? user.id,\n codes: ci?.codes ?? [],\n tags: ci?.tags ?? [],\n }\n\n const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (ownerId !== (await this.dataOwnerApi.getCurrentDataOwnerId())) throw new Error('Can only initialise entities as current data owner.')\n const sfk = patient ? options.preferredSfk ?? (await this.crypto.confidential.getAnySecretIdSharedWithParents(patient)) : undefined\n if (patient && !sfk) throw new Error(`Couldn't find any sfk of parent patient ${patient.id}`)\n const extraDelegations = [\n ...Object.keys(options.additionalDelegates ?? {}),\n ...(user.autoDelegations?.all ?? []),\n ...(user.autoDelegations?.medicalInformation ?? []),\n ]\n return new CalendarItem(\n await this.crypto.entities\n .entityWithInitialisedEncryptedMetadata(calendarItem, patient?.id, sfk, true, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n async findBy(hcpartyId: string, patient: models.Patient, usingPost: boolean = false) {\n const extractedKeys = await this.crypto.entities.secretIdsOf(patient, hcpartyId)\n const topmostParentId = (await this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0]\n return extractedKeys && extractedKeys.length > 0\n ? usingPost\n ? await this.findByHCPartyPatientSecretFKeysArray(topmostParentId, _.uniq(extractedKeys))\n : await this.findByHCPartyPatientSecretFKeys(topmostParentId, _.uniq(extractedKeys).join(','))\n : Promise.resolve([])\n }\n\n async findByHCPartyPatientSecretFKeys(hcPartyId: string, secretFKeys: string): Promise<Array<models.CalendarItem>> {\n const calendarItems = await super.findCalendarItemsByHCPartyPatientForeignKeys(hcPartyId, secretFKeys)\n return await this.decrypt(hcPartyId, calendarItems)\n }\n\n findByHCPartyPatientSecretFKeysArray(hcPartyId: string, secretFKeys: string[]): Promise<Array<models.CalendarItem> | any> {\n return super\n .findCalendarItemsByHCPartyPatientForeignKeysUsingPost(hcPartyId, secretFKeys)\n .then((calendarItems) => this.decrypt(hcPartyId, calendarItems))\n }\n\n createCalendarItem(body?: CalendarItem): never {\n throw new Error('Cannot call a method that must encrypt a calendar item without providing a user for de/encryption')\n }\n\n async createCalendarItemWithHcParty(user: models.User, body?: models.CalendarItem): Promise<models.CalendarItem | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((items) => super.createCalendarItem(items[0]))\n .then((ci) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [ci]))\n .then((cis) => cis[0])\n : null\n }\n\n getCalendarItemWithUser(user: models.User, calendarItemId: string): Promise<CalendarItem | any> {\n return super\n .getCalendarItem(calendarItemId)\n .then((calendarItem) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [calendarItem]))\n .then((cis) => cis[0])\n }\n\n getCalendarItem(calendarItemId: string): never {\n throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption')\n }\n\n getCalendarItemsWithUser(user: models.User): Promise<Array<CalendarItem> | any> {\n return super.getCalendarItems().then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, calendarItems))\n }\n\n getCalendarItems(): never {\n throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption')\n }\n\n getCalendarItemsWithIdsWithUser(user: models.User, body?: models.ListOfIds): Promise<Array<CalendarItem> | any> {\n return super.getCalendarItemsWithIds(body).then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, calendarItems))\n }\n\n getCalendarItemsWithIds(body?: models.ListOfIds): never {\n throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption')\n }\n\n getCalendarItemsByPeriodAndHcPartyIdWithUser(\n user: models.User,\n startDate: number,\n endDate: number,\n hcPartyId: string\n ): Promise<Array<CalendarItem> | any> {\n return super\n .getCalendarItemsByPeriodAndHcPartyId(startDate, endDate, hcPartyId)\n .then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, calendarItems))\n }\n\n getCalendarItemsByPeriodAndHcPartyId(startDate?: number, endDate?: number, hcPartyId?: string): never {\n throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption')\n }\n\n getCalendarsByPeriodAndAgendaIdWithUser(\n user: models.User,\n startDate: number,\n endDate: number,\n agendaId: string\n ): Promise<Array<CalendarItem> | any> {\n return super\n .getCalendarsByPeriodAndAgendaId(startDate, endDate, agendaId)\n .then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, calendarItems))\n }\n\n getCalendarsByPeriodAndAgendaId(startDate?: number, endDate?: number, agendaId?: string): never {\n throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption')\n }\n\n modifyCalendarItem(body?: CalendarItem): never {\n throw new Error('Cannot call a method that must encrypt a calendar item without providing a user for de/encryption')\n }\n\n /**\n * Remove the following delegation objects from the\n * CalendarItem instance: cryptedForeignKeys, secretForeignKeys.\n *\n * The delegations & encryptionKeys objects are not removed because\n * in the case the CalendarItem is saved in the DB & then encrypted,\n * if later we remove the patient from it, it'd reset the delegations\n * and encryptionKeys thus impossibilitating further access.\n *\n * @param calendarItem The Calendar Item object\n */\n resetCalendarDelegationObjects(calendarItem: models.CalendarItem): models.CalendarItem {\n const { cryptedForeignKeys, secretForeignKeys, ...resetCalendarItem } = calendarItem\n return resetCalendarItem\n }\n\n async modifyCalendarItemWithHcParty(user: models.User, body?: models.CalendarItem): Promise<models.CalendarItem | any> {\n return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, _.cloneDeep(body)) : null\n }\n\n private modifyAs(dataOwner: string, body: models.CalendarItem): Promise<models.CalendarItem> {\n return this.encryptAs(dataOwner, [_.cloneDeep(body)])\n .then((als) => super.modifyCalendarItem(als[0]))\n .then((body) => this.decrypt(dataOwner, [body]))\n .then((als) => als[0])\n }\n\n encrypt(user: models.User, calendarItems: Array<models.CalendarItem>): Promise<Array<models.CalendarItem>> {\n return this.encryptAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, calendarItems)\n }\n\n private encryptAs(dataOwnerId: string, calendarItems: Array<models.CalendarItem>): Promise<Array<models.CalendarItem>> {\n return Promise.all(\n calendarItems.map((x) =>\n this.crypto.entities.tryEncryptEntity(x, dataOwnerId, this.encryptedFields, false, true, (json) => new CalendarItem(json))\n )\n )\n }\n\n decrypt(hcpId: string, calendarItems: Array<models.CalendarItem>): Promise<Array<models.CalendarItem>> {\n return Promise.all(\n calendarItems.map((x) => this.crypto.entities.decryptEntity(x, hcpId, (json) => new CalendarItem(json)).then(({ entity }) => entity))\n )\n }\n\n /**\n * @param calendarItem a calendar item\n * @return the id of the patient that the calendar item refers to, retrieved from the encrypted metadata. Normally there should only be one element\n * in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(calendarItem: models.CalendarItem): Promise<string[]> {\n return this.crypto.entities.owningEntityIdsOf(calendarItem, undefined)\n }\n\n /**\n * Share an existing calendar item with other data owners, allowing them to access the non-encrypted data of the calendar item and optionally also\n * the encrypted content.\n * @param delegateId the id of the data owner which will be granted access to the calendar item.\n * @param calendarItem item the calendar item to share.\n * @param options optional parameters to customize the sharing behaviour:\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * calendar item does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this calendar item refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * @return a promise which will contain the updated entity.\n */\n async shareWith(\n delegateId: string,\n calendarItem: models.CalendarItem,\n options: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.CalendarItem> {\n return this.shareWithMany(calendarItem, { [delegateId]: options })\n }\n /**\n * Share an existing calendar item with other data owners, allowing them to access the non-encrypted data of the calendar item and optionally also\n * the encrypted content.\n * @param calendarItem item the calendar item to share.\n * @param delegates sharing options for each delegate.\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * calendar item does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this calendar item refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * @return a promise which will contain the updated entity.\n */\n async shareWithMany(\n calendarItem: models.CalendarItem,\n delegates: {\n [delegateId: string]: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.CalendarItem> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n const extended = await this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(\n calendarItem,\n true,\n Object.fromEntries(\n Object.entries(delegates).map(([delegateId, options]) => [\n delegateId,\n {\n shareEncryptionKey: options.shareEncryptionKey,\n shareOwningEntityIds: options.sharePatientId,\n },\n ])\n )\n )\n if (!!extended) {\n return await this.modifyAs(self, extended)\n } else return calendarItem\n }\n\n async getDataOwnersWithAccessTo(\n entity: CalendarItem\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: 'WRITE' }; hasUnknownAnonymousDataOwners: boolean }> {\n return await this.crypto.entities.getDataOwnersWithAccessTo(entity)\n }\n\n async getEncryptionKeysOf(entity: CalendarItem): Promise<string[]> {\n return await this.crypto.entities.encryptionKeysOf(entity)\n }\n\n /**\n * Links a calendar item with a patient. Note that this operation is not reversible: it is not possible to change the patient linked to a calendar\n * item.\n * @param calendarItem a calendar item\n * @param patient the patient which will be linked to the calendar item\n * @param shareLinkWithDelegates data owners other than the current data owner which will also be able to decrypt the id of the newly linked patient\n * @return the updated calendar item\n */\n async linkToPatient(calendarItem: models.CalendarItem, patient: models.Patient, shareLinkWithDelegates: string[]): Promise<models.CalendarItem> {\n if (!!calendarItem.secretForeignKeys?.length) throw new Error(`Calendar item ${calendarItem.id} is already linked to a patient`)\n const delegates = [...new Set([await this.dataOwnerApi.getCurrentDataOwnerId(), ...shareLinkWithDelegates])]\n const sfk = await this.crypto.confidential.getAnySecretIdSharedWithParents(patient)\n if (!sfk) {\n throw new Error(`Could not find any secret id for patient ${patient.id} which is shared with the topmost ancestor of the current data owner`)\n }\n let updated = {\n ...calendarItem,\n secretForeignKeys: [sfk],\n }\n for (const delegate of delegates) {\n updated = (await this.crypto.entities.entityWithExtendedEncryptedMetadata(updated, delegate, [], [], [patient.id!])) ?? updated\n }\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n const saved = await this.modifyAs(self, updated)\n return (await this.decrypt(self, [saved]))[0]\n }\n}\n"]}
1
+ {"version":3,"file":"icc-calendar-item-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-calendar-item-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA2C;AAE3C,4BAA2B;AAE3B,oDAA4F;AAE5F,wCAA+C;AAE/C,0EAAgG;AAGhG,qFAAiF;AACjF,IAAO,uBAAuB,GAAG,uCAAkB,CAAC,uBAAuB,CAAA;AAC3E,wEAAoE;AACpE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAEzD,mCAAuE;AAGvE,MAAa,mBAAoB,SAAQ,4BA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kCAAO,eAAe,KAAE,iBAAiB,EAAE,CAAC,GAAG,CAAC,IAAG,CAAA;YAC3F,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;;KAChD;IAED,uCAAuC,CAAC,MAAoB,EAAE,SAAmB;QAC/E,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,iCAAiC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,SAAS,CAAC,CAAA;IAC9H,CAAC;CACF;AA1ZD,kDA0ZC","sourcesContent":["import * as i18n from './rsrc/contact.i18n'\n\nimport * as _ from 'lodash'\nimport * as models from '../icc-api/model/models'\nimport { AccessLog, CalendarItem, EncryptedEntityStub, User } from '../icc-api/model/models'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport { IccCalendarItemApi } from '../icc-api'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { ShareResult } from './utils/ShareResult'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedFieldsManifest, parseEncryptedFields } from './utils'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\n\nexport class IccCalendarItemXApi extends IccCalendarItemApi implements EncryptedEntityXApi<models.CalendarItem> {\n i18n: any = i18n\n crypto: IccCryptoXApi\n dataOwnerApi: IccDataOwnerXApi\n private readonly encryptedFields: EncryptedFieldsManifest\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'CalendarItem'))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\n private readonly autofillAuthor: boolean,\n encryptedKeys: Array<string> = ['details', 'title', 'patientId'],\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.crypto = crypto\n this.dataOwnerApi = dataOwnerApi\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'CalendarItem.')\n }\n\n newInstance(\n user: User,\n ci: any | CalendarItem,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n } = {}\n ) {\n return this.newInstancePatient(user, null, ci, options)\n }\n\n /**\n * Creates a new instance of calendar item with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this calendar item refers to.\n * @param ci initialised data for the calendar item. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * 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\n * auto-delegations, in such case the access level specified here will be used.\n * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the classcalendar itemification. The default value will be a\n * secret id of patient known by the topmost parent in the current data owner hierarchy.\n * @return a new instance of calendar item.\n */\n async newInstancePatient(\n user: models.User,\n patient: models.Patient | null,\n ci: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n preferredSfk?: string\n } = {}\n ): Promise<models.CalendarItem> {\n if (!patient && options.preferredSfk) throw new Error('You need to specify parent patient in order to use secret foreign keys.')\n const calendarItem = {\n ...(ci ?? {}),\n _type: 'org.taktik.icure.entities.CalendarItem',\n id: ci?.id ?? this.crypto.primitives.randomUuid(),\n created: ci?.created ?? new Date().getTime(),\n modified: ci?.modified ?? new Date().getTime(),\n responsible: ci?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: ci?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: ci?.codes ?? [],\n tags: ci?.tags ?? [],\n }\n\n const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (ownerId !== (await this.dataOwnerApi.getCurrentDataOwnerId())) throw new Error('Can only initialise entities as current data owner.')\n const sfk = patient\n ? options?.preferredSfk ?? (await this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: patient, type: 'Patient' }))\n : undefined\n if (patient && !sfk) throw new Error(`Couldn't find any sfk of parent patient ${patient.id}`)\n const extraDelegations = {\n ...Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.medicalInformation ?? [])].map((d) => [d, AccessLevelEnum.WRITE])\n ),\n ...(options?.additionalDelegates ?? {}),\n }\n return new CalendarItem(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(calendarItem, 'CalendarItem', patient?.id, sfk, true, false, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n async findBy(hcpartyId: string, patient: models.Patient, usingPost: boolean = false) {\n const extractedKeys = await this.crypto.xapi.secretIdsOf({ entity: patient, type: 'Patient' }, hcpartyId)\n const topmostParentId = (await this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0]\n return extractedKeys && extractedKeys.length > 0\n ? usingPost\n ? this.findByHCPartyPatientSecretFKeysArray(hcpartyId!, _.uniq(extractedKeys))\n : this.findByHCPartyPatientSecretFKeys(hcpartyId!, _.uniq(extractedKeys).join(','))\n : Promise.resolve([])\n }\n\n async findByHCPartyPatientSecretFKeys(hcPartyId: string, secretFKeys: string): Promise<Array<models.CalendarItem>> {\n const calendarItems = await super.findCalendarItemsByHCPartyPatientForeignKeys(hcPartyId, secretFKeys)\n return await this.decrypt(hcPartyId, calendarItems)\n }\n\n findByHCPartyPatientSecretFKeysArray(hcPartyId: string, secretFKeys: string[]): Promise<Array<models.CalendarItem> | any> {\n return super\n .findCalendarItemsByHCPartyPatientForeignKeysUsingPost(hcPartyId, secretFKeys)\n .then((calendarItems) => this.decrypt(hcPartyId, calendarItems))\n }\n\n createCalendarItem(body?: CalendarItem): never {\n throw new Error('Cannot call a method that must encrypt a calendar item without providing a user for de/encryption')\n }\n\n async createCalendarItemWithHcParty(user: models.User, body?: models.CalendarItem): Promise<models.CalendarItem | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((items) => super.createCalendarItem(items[0]))\n .then((ci) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [ci]))\n .then((cis) => cis[0])\n : null\n }\n\n getCalendarItemWithUser(user: models.User, calendarItemId: string): Promise<CalendarItem | any> {\n return super\n .getCalendarItem(calendarItemId)\n .then((calendarItem) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [calendarItem]))\n .then((cis) => cis[0])\n }\n\n getCalendarItem(calendarItemId: string): never {\n throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption')\n }\n\n getCalendarItemsWithUser(user: models.User): Promise<Array<CalendarItem> | any> {\n return super.getCalendarItems().then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, calendarItems))\n }\n\n getCalendarItems(): never {\n throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption')\n }\n\n getCalendarItemsWithIdsWithUser(user: models.User, body?: models.ListOfIds): Promise<Array<CalendarItem> | any> {\n return super.getCalendarItemsWithIds(body).then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, calendarItems))\n }\n\n getCalendarItemsWithIds(body?: models.ListOfIds): never {\n throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption')\n }\n\n getCalendarItemsByPeriodAndHcPartyIdWithUser(\n user: models.User,\n startDate: number,\n endDate: number,\n hcPartyId: string\n ): Promise<Array<CalendarItem> | any> {\n return super\n .getCalendarItemsByPeriodAndHcPartyId(startDate, endDate, hcPartyId)\n .then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, calendarItems))\n }\n\n getCalendarItemsByPeriodAndHcPartyId(startDate?: number, endDate?: number, hcPartyId?: string): never {\n throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption')\n }\n\n getCalendarsByPeriodAndAgendaIdWithUser(\n user: models.User,\n startDate: number,\n endDate: number,\n agendaId: string\n ): Promise<Array<CalendarItem> | any> {\n return super\n .getCalendarsByPeriodAndAgendaId(startDate, endDate, agendaId)\n .then((calendarItems) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, calendarItems))\n }\n\n getCalendarsByPeriodAndAgendaId(startDate?: number, endDate?: number, agendaId?: string): never {\n throw new Error('Cannot call a method that must en/decrypt a calendar item without providing a user for de/encryption')\n }\n\n modifyCalendarItem(body?: CalendarItem): never {\n throw new Error('Cannot call a method that must encrypt a calendar item without providing a user for de/encryption')\n }\n\n /**\n * Remove the following delegation objects from the\n * CalendarItem instance: cryptedForeignKeys, secretForeignKeys.\n *\n * The delegations & encryptionKeys objects are not removed because\n * in the case the CalendarItem is saved in the DB & then encrypted,\n * if later we remove the patient from it, it'd reset the delegations\n * and encryptionKeys thus impossibilitating further access.\n *\n * @param calendarItem The Calendar Item object\n */\n resetCalendarDelegationObjects(calendarItem: models.CalendarItem): models.CalendarItem {\n const { cryptedForeignKeys, secretForeignKeys, ...resetCalendarItem } = calendarItem\n return resetCalendarItem\n }\n\n async modifyCalendarItemWithHcParty(user: models.User, body?: models.CalendarItem): Promise<models.CalendarItem | any> {\n return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, _.cloneDeep(body)) : null\n }\n\n private modifyAs(dataOwner: string, body: models.CalendarItem): Promise<models.CalendarItem> {\n return this.encryptAs(dataOwner, [_.cloneDeep(body)])\n .then((items) => super.modifyCalendarItem(items[0]))\n .then((ci) => this.decrypt(dataOwner, [ci]))\n .then((cis) => cis[0])\n }\n\n encrypt(user: models.User, calendarItems: Array<models.CalendarItem>): Promise<Array<models.CalendarItem>> {\n return this.encryptAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, calendarItems)\n }\n\n private encryptAs(dataOwner: string, calendarItems: Array<models.CalendarItem>): Promise<Array<models.CalendarItem>> {\n return Promise.all(\n calendarItems.map((x) =>\n this.crypto.xapi.tryEncryptEntity(x, 'CalendarItem', this.encryptedFields, false, false, (json) => new CalendarItem(json))\n )\n )\n }\n\n decrypt(hcpId: string, calendarItems: Array<models.CalendarItem>): Promise<Array<models.CalendarItem>> {\n return Promise.all(\n calendarItems.map((x) => this.crypto.xapi.decryptEntity(x, 'CalendarItem', (json) => new CalendarItem(json)).then(({ entity }) => entity))\n )\n }\n\n /**\n * @param calendarItem a calendar item\n * @return the id of the patient that the calendar item refers to, retrieved from the encrypted metadata. Normally there should only be one element\n * in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(calendarItem: models.CalendarItem): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: calendarItem, type: 'CalendarItem' }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given calendar item\n */\n async hasWriteAccess(calendarItem: models.CalendarItem): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: calendarItem, type: 'CalendarItem' })\n }\n\n /**\n * Share an existing calendar item with other data owners, allowing them to access the non-encrypted data of the calendar item and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param delegateId the id of the data owner which will be granted access to the calendar item.\n * @param calendarItem item the calendar item to share.\n * @param options optional parameters to customize the sharing behaviour:\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * calendar item does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this calendar item refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @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\n * the operation failed.\n */\n async shareWith(\n delegateId: string,\n calendarItem: models.CalendarItem,\n options: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.CalendarItem> {\n return this.shareWithMany(calendarItem, { [delegateId]: options })\n }\n\n /**\n * Share an existing calendar item with other data owners, allowing them to access the non-encrypted data of the calendar item and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param calendarItem item the calendar item to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * calendar item does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this calendar item refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWithMany(\n calendarItem: models.CalendarItem,\n delegates: {\n [delegateId: string]: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.CalendarItem> {\n return (await this.tryShareWithMany(calendarItem, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing calendar item with other data owners, allowing them to access the non-encrypted data of the calendar item and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param calendarItem item the calendar item to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * calendar item does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this calendar item refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async tryShareWithMany(\n calendarItem: models.CalendarItem,\n delegates: {\n [delegateId: string]: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.CalendarItem>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(calendarItem, 'CalendarItem')\n const updatedEntity = entityWithEncryptionKey ? await this.modifyAs(self, entityWithEncryptionKey) : calendarItem\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n { entity: updatedEntity, type: 'CalendarItem' },\n true,\n Object.fromEntries(\n Object.entries(delegates).map(([delegateId, options]) => [\n delegateId,\n {\n requestedPermissions: options.requestedPermissions,\n shareEncryptionKeys: options.shareEncryptionKey,\n shareOwningEntityIds: options.sharePatientId,\n shareSecretIds: undefined,\n },\n ])\n ),\n (x) => this.bulkShareCalendarItems(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: CalendarItem\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: 'CalendarItem' })\n }\n\n getEncryptionKeysOf(entity: CalendarItem): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: 'CalendarItem' }, undefined)\n }\n\n /**\n * Links a calendar item with a patient. Note that this operation is not reversible: it is not possible to change the patient linked to a calendar\n * item.\n * @param calendarItem a calendar item\n * @param patient the patient which will be linked to the calendar item.\n * @param shareLinkWithDelegates data owners other than the current data owner which will also be able to decrypt the id of the newly linked\n * patient. If any of these data owners do not already have access to the calendar item, they will be granted read access (no write).\n * @return the updated calendar item\n */\n async linkToPatient(calendarItem: models.CalendarItem, patient: models.Patient, shareLinkWithDelegates: string[]): Promise<models.CalendarItem> {\n if (!!calendarItem.secretForeignKeys?.length) throw new Error(`Calendar item ${calendarItem.id} is already linked to a patient`)\n const delegates = [...new Set([await this.dataOwnerApi.getCurrentDataOwnerId(), ...shareLinkWithDelegates])]\n const sfk = await this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: patient, type: 'Patient' })\n if (!sfk) {\n throw new Error(`Could not find any secret id for patient ${patient.id} which is shared with the topmost ancestor of the current data owner`)\n }\n const individualShareData = {\n shareSecretIds: [] as string[],\n shareEncryptionKeys: [] as string[],\n shareOwningEntityIds: [patient.id!],\n requestedPermissions: RequestedPermissionEnum.FULL_READ,\n }\n const shared = await this.crypto.xapi.bulkShareOrUpdateEncryptedEntityMetadata(\n 'CalendarItem',\n [\n {\n entity: calendarItem,\n dataForDelegates: Object.fromEntries(delegates.map((d) => [d, individualShareData])),\n },\n ],\n (x) => this.bulkShareCalendarItems(x)\n )\n if (!shared.updatedEntities.length || shared.updatedEntities[0].id !== calendarItem.id) {\n const errorsForEntity = shared.updateErrors.filter((e) => e.entityId === calendarItem.id)\n if (!errorsForEntity.length || !errorsForEntity.find((x) => x.code === 409)) {\n throw new Error(`Unexpected error while linking calendar item ${calendarItem.id}`)\n } else {\n throw new Error(`Outdated calendar item revision ${calendarItem.id}-${calendarItem.rev}`)\n }\n }\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n const sharedDecrypted = (await this.decrypt(self, [shared.updatedEntities[0]]))[0]\n const withSfk = await this.modifyAs(self, { ...sharedDecrypted, secretForeignKeys: [sfk] })\n return (await this.decrypt(self, [withSfk]))[0]\n }\n\n createDelegationDeAnonymizationMetadata(entity: CalendarItem, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: 'CalendarItem' }, delegates)\n }\n}\n"]}
@@ -3,14 +3,22 @@ import { IccCryptoXApi } from './icc-crypto-x-api';
3
3
  import * as models from '../icc-api/model/models';
4
4
  import { IccDataOwnerXApi } from './icc-data-owner-x-api';
5
5
  import { AuthenticationProvider } from './auth/AuthenticationProvider';
6
+ import { SecureDelegation } from '../icc-api/model/SecureDelegation';
6
7
  import { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour';
8
+ import { ShareResult } from './utils/ShareResult';
9
+ import { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest';
10
+ import AccessLevelEnum = SecureDelegation.AccessLevelEnum;
11
+ import RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum;
12
+ import { XHR } from '../icc-api/api/XHR';
7
13
  import { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi';
8
14
  export declare class IccClassificationXApi extends IccClassificationApi implements EncryptedEntityXApi<models.Classification> {
15
+ private readonly autofillAuthor;
9
16
  crypto: IccCryptoXApi;
10
17
  dataOwnerApi: IccDataOwnerXApi;
18
+ get headers(): Promise<Array<XHR.Header>>;
11
19
  constructor(host: string, headers: {
12
20
  [key: string]: string;
13
- }, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
21
+ }, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, autofillAuthor: boolean, authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
14
22
  /**
15
23
  * Creates a new instance of classification with initialised encryption metadata (not in the database).
16
24
  * @param user the current user.
@@ -20,15 +28,14 @@ export declare class IccClassificationXApi extends IccClassificationApi implemen
20
28
  * @param options optional parameters:
21
29
  * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
22
30
  * 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
23
- * auto-delegations, in such case the access level specified here will be used. Currently only WRITE access is supported, but in future also read
24
- * access will be possible.
31
+ * auto-delegations, in such case the access level specified here will be used.
25
32
  * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the classification. The default value will be a
26
33
  * secret id of patient known by the topmost parent in the current data owner hierarchy.
27
34
  * @return a new instance of classification.
28
35
  */
29
36
  newInstance(user: models.User, patient: models.Patient, c?: any, options?: {
30
37
  additionalDelegates?: {
31
- [dataOwnerId: string]: 'WRITE';
38
+ [dataOwnerId: string]: AccessLevelEnum;
32
39
  };
33
40
  preferredSfk?: string;
34
41
  }): Promise<models.Classification>;
@@ -39,9 +46,13 @@ export declare class IccClassificationXApi extends IccClassificationApi implemen
39
46
  * in the returned array, but in case of entity merges there could be multiple values.
40
47
  */
41
48
  decryptPatientIdOf(classification: models.Classification): Promise<string[]>;
49
+ /**
50
+ * @return if the logged data owner has write access to the content of the given classification
51
+ */
52
+ hasWriteAccess(classification: models.Classification): Promise<boolean>;
42
53
  /**
43
54
  * Share an existing classification with other data owners, allowing them to access the non-encrypted data of the classification and optionally also
44
- * the encrypted content.
55
+ * the encrypted content, with read-only or read-write permissions.
45
56
  * @param delegateId the id of the data owner which will be granted access to the classification.
46
57
  * @param classification the classification to share.
47
58
  * @param options optional parameters to customize the sharing behaviour:
@@ -50,35 +61,61 @@ export declare class IccClassificationXApi extends IccClassificationApi implemen
50
61
  * classification does not have encrypted content.
51
62
  * - sharePatientId: specifies if the id of the patient that this classification refers to should be shared with the delegate (defaults to
52
63
  * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
53
- * @return a promise which will contain the updated classification.
64
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
65
+ * @return the updated entity
54
66
  */
55
67
  shareWith(delegateId: string, classification: models.Classification, options?: {
68
+ requestedPermissions?: RequestedPermissionEnum;
56
69
  shareEncryptionKey?: ShareMetadataBehaviour;
57
70
  sharePatientId?: ShareMetadataBehaviour;
58
71
  }): Promise<models.Classification>;
59
72
  /**
60
73
  * Share an existing classification with other data owners, allowing them to access the non-encrypted data of the classification and optionally also
61
- * the encrypted content.
74
+ * the encrypted content, with read-only or read-write permissions.
62
75
  * @param classification the classification to share.
63
- * @param delegates sharing options for each delegate.
76
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
64
77
  * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
65
78
  * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
66
79
  * classification does not have encrypted content.
67
80
  * - sharePatientId: specifies if the id of the patient that this classification refers to should be shared with the delegate (defaults to
68
81
  * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
69
- * @return a promise which will contain the updated classification.
82
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
83
+ * @return the updated entity
70
84
  */
71
85
  shareWithMany(classification: models.Classification, delegates: {
72
86
  [delegateId: string]: {
87
+ requestedPermissions?: RequestedPermissionEnum;
73
88
  shareEncryptionKey?: ShareMetadataBehaviour;
74
89
  sharePatientId?: ShareMetadataBehaviour;
75
90
  };
76
91
  }): Promise<models.Classification>;
92
+ /**
93
+ * Share an existing classification with other data owners, allowing them to access the non-encrypted data of the classification and optionally also
94
+ * the encrypted content, with read-only or read-write permissions.
95
+ * @param classification the classification to share.
96
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
97
+ * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
98
+ * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
99
+ * classification does not have encrypted content.
100
+ * - sharePatientId: specifies if the id of the patient that this classification refers to should be shared with the delegate (defaults to
101
+ * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
102
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
103
+ * @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
104
+ * the operation failed.
105
+ */
106
+ tryShareWithMany(classification: models.Classification, delegates: {
107
+ [delegateId: string]: {
108
+ requestedPermissions?: RequestedPermissionEnum;
109
+ shareEncryptionKey?: ShareMetadataBehaviour;
110
+ sharePatientId?: ShareMetadataBehaviour;
111
+ };
112
+ }): Promise<ShareResult<models.Classification>>;
77
113
  getDataOwnersWithAccessTo(entity: models.Classification): Promise<{
78
114
  permissionsByDataOwnerId: {
79
- [p: string]: 'WRITE';
115
+ [p: string]: AccessLevelEnum;
80
116
  };
81
117
  hasUnknownAnonymousDataOwners: boolean;
82
118
  }>;
83
119
  getEncryptionKeysOf(entity: models.Classification): Promise<string[]>;
120
+ createDelegationDeAnonymizationMetadata(entity: models.Classification, delegates: string[]): Promise<void>;
84
121
  }