@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
@@ -1,27 +1,35 @@
1
1
  import { IccMaintenanceTaskApi } from '../icc-api/api/IccMaintenanceTaskApi';
2
2
  import { IccCryptoXApi } from './icc-crypto-x-api';
3
3
  import * as models from '../icc-api/model/models';
4
- import { DocIdentifier, MaintenanceTask } from '../icc-api/model/models';
5
4
  import { IccHcpartyXApi } from './icc-hcparty-x-api';
5
+ import { DocIdentifier, MaintenanceTask } from '../icc-api/model/models';
6
6
  import { IccDataOwnerXApi } from './icc-data-owner-x-api';
7
7
  import { AuthenticationProvider } from './auth/AuthenticationProvider';
8
+ import { SecureDelegation } from '../icc-api/model/SecureDelegation';
9
+ import AccessLevelEnum = SecureDelegation.AccessLevelEnum;
8
10
  import { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour';
9
- import { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi';
11
+ import { ShareResult } from './utils/ShareResult';
12
+ import { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest';
13
+ import RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum;
14
+ import { XHR } from '../icc-api/api/XHR';
10
15
  import { SubscriptionOptions } from './utils';
11
- import { AbstractFilter } from "./filters/filters";
12
- import { Connection } from "../icc-api/model/Connection";
13
- import { IccUserXApi } from "./icc-user-x-api";
14
- import { IccAuthApi } from "../icc-api";
16
+ import { IccUserXApi } from '@icure/apiV6';
17
+ import { IccAuthApi } from '../icc-api';
18
+ import { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi';
19
+ import { AbstractFilter } from './filters/filters';
20
+ import { Connection } from '../icc-api/model/Connection';
15
21
  export declare class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi implements EncryptedEntityXApi<models.MaintenanceTask> {
16
- crypto: IccCryptoXApi;
17
- hcPartyApi: IccHcpartyXApi;
18
- dataOwnerApi: IccDataOwnerXApi;
22
+ private readonly crypto;
23
+ private readonly hcPartyApi;
24
+ private readonly dataOwnerApi;
19
25
  private readonly userApi;
20
26
  private readonly authApi;
27
+ private readonly autofillAuthor;
21
28
  private readonly encryptedFields;
29
+ get headers(): Promise<Array<XHR.Header>>;
22
30
  constructor(host: string, headers: {
23
31
  [key: string]: string;
24
- }, crypto: IccCryptoXApi, hcPartyApi: IccHcpartyXApi, dataOwnerApi: IccDataOwnerXApi, userApi: IccUserXApi, authApi: IccAuthApi, encryptedKeys?: Array<string>, authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
32
+ }, crypto: IccCryptoXApi, hcPartyApi: IccHcpartyXApi, dataOwnerApi: IccDataOwnerXApi, userApi: IccUserXApi, authApi: IccAuthApi, autofillAuthor: boolean, encryptedKeys?: Array<string>, authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
25
33
  /**
26
34
  * Creates a new instance of maintenance task with initialised encryption metadata (not in the database).
27
35
  * @param user the current user.
@@ -30,13 +38,12 @@ export declare class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi implem
30
38
  * @param options optional parameters:
31
39
  * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
32
40
  * 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
33
- * auto-delegations, in such case the access level specified here will be used. Currently only WRITE access is supported, but in future also read
34
- * access will be possible.
41
+ * auto-delegations, in such case the access level specified here will be used.
35
42
  * @return a new instance of maintenance task.
36
43
  */
37
44
  newInstance(user: models.User, m: any, options?: {
38
45
  additionalDelegates?: {
39
- [dataOwnerId: string]: 'WRITE';
46
+ [dataOwnerId: string]: AccessLevelEnum;
40
47
  };
41
48
  }): Promise<models.MaintenanceTask>;
42
49
  createMaintenanceTask(body?: models.MaintenanceTask): never;
@@ -49,46 +56,73 @@ export declare class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi implem
49
56
  getMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<models.MaintenanceTask | any>;
50
57
  modifyMaintenanceTask(body?: models.MaintenanceTask): never;
51
58
  modifyMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | any>;
52
- private modifyAs;
59
+ private modifyMaintenanceTaskAs;
53
60
  encrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>>;
54
61
  private encryptAs;
55
62
  decrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>>;
56
63
  private decryptAs;
64
+ /**
65
+ * @return if the logged data owner has write access to the content of the given maintenance task
66
+ */
67
+ hasWriteAccess(maintenanceTask: models.MaintenanceTask): Promise<boolean>;
57
68
  /**
58
69
  * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also
59
- * the encrypted content.
70
+ * the encrypted content, with read-only or read-write permissions.
60
71
  * @param delegateId the id of the data owner which will be granted access to the maintenance task.
61
72
  * @param maintenanceTask the maintenance task to share.
62
73
  * @param options optional parameters to customize the sharing behaviour:
63
74
  * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
64
75
  * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
65
76
  * maintenance task does not have encrypted content.
66
- * @return a promise which will contain the updated maintenance task
77
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
78
+ * @return the updated entity
67
79
  */
68
80
  shareWith(delegateId: string, maintenanceTask: models.MaintenanceTask, options?: {
81
+ requestedPermissions?: RequestedPermissionEnum;
69
82
  shareEncryptionKey?: ShareMetadataBehaviour;
70
83
  }): Promise<models.MaintenanceTask>;
71
84
  /**
72
85
  * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also
73
- * the encrypted content.
86
+ * the encrypted content, with read-only or read-write permissions.
74
87
  * @param maintenanceTask the maintenance task to share.
75
- * @param delegates sharing options for each delegate.
88
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
76
89
  * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
77
90
  * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
78
91
  * maintenance task does not have encrypted content.
79
- * @return a promise which will contain the updated maintenance task
92
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
93
+ * @return the updated entity.
80
94
  */
81
95
  shareWithMany(maintenanceTask: models.MaintenanceTask, delegates: {
82
96
  [delegateId: string]: {
97
+ requestedPermissions?: RequestedPermissionEnum;
83
98
  shareEncryptionKey?: ShareMetadataBehaviour;
84
99
  };
85
100
  }): Promise<models.MaintenanceTask>;
86
- getDataOwnersWithAccessTo(entity: MaintenanceTask): Promise<{
101
+ /**
102
+ * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also
103
+ * the encrypted content, with read-only or read-write permissions.
104
+ * @param maintenanceTask the maintenance task to share.
105
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
106
+ * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
107
+ * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
108
+ * maintenance task does not have encrypted content.
109
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
110
+ * @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
111
+ * the operation failed.
112
+ */
113
+ tryShareWithMany(maintenanceTask: models.MaintenanceTask, delegates: {
114
+ [delegateId: string]: {
115
+ requestedPermissions?: RequestedPermissionEnum;
116
+ shareEncryptionKey?: ShareMetadataBehaviour;
117
+ };
118
+ }): Promise<ShareResult<models.MaintenanceTask>>;
119
+ getDataOwnersWithAccessTo(entity: models.MaintenanceTask): Promise<{
87
120
  permissionsByDataOwnerId: {
88
- [p: string]: 'WRITE';
121
+ [p: string]: AccessLevelEnum;
89
122
  };
90
123
  hasUnknownAnonymousDataOwners: boolean;
91
124
  }>;
92
- getEncryptionKeysOf(entity: MaintenanceTask): Promise<string[]>;
125
+ getEncryptionKeysOf(entity: models.MaintenanceTask): Promise<string[]>;
93
126
  subscribeToMaintenanceTaskEvents(eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[], filter: AbstractFilter<MaintenanceTask>, eventFired: (dataSample: MaintenanceTask) => Promise<void>, options?: SubscriptionOptions): Promise<Connection>;
127
+ createDelegationDeAnonymizationMetadata(entity: MaintenanceTask, delegates: string[]): Promise<void>;
94
128
  }
@@ -12,14 +12,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.IccMaintenanceTaskXApi = void 0;
13
13
  const IccMaintenanceTaskApi_1 = require("../icc-api/api/IccMaintenanceTaskApi");
14
14
  const models = require("../icc-api/model/models");
15
- const models_1 = require("../icc-api/model/models");
16
15
  const _ = require("lodash");
16
+ const models_1 = require("../icc-api/model/models");
17
17
  const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
18
+ const SecureDelegation_1 = require("../icc-api/model/SecureDelegation");
19
+ var AccessLevelEnum = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
20
+ const ShareMetadataBehaviour_1 = require("./crypto/ShareMetadataBehaviour");
18
21
  const utils_1 = require("./utils");
19
22
  const Connection_1 = require("../icc-api/model/Connection");
20
- const websocket_1 = require("./utils/websocket");
21
23
  class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi_1.IccMaintenanceTaskApi {
22
- constructor(host, headers, crypto, hcPartyApi, dataOwnerApi, userApi, authApi, encryptedKeys = ['properties'], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
24
+ get headers() {
25
+ return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'MaintenanceTask'));
26
+ }
27
+ constructor(host, headers, crypto, hcPartyApi, dataOwnerApi, userApi, authApi, autofillAuthor, encryptedKeys = [], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
23
28
  ? window.fetch
24
29
  : typeof self !== 'undefined'
25
30
  ? self.fetch
@@ -28,9 +33,10 @@ class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi_1.IccMaintenanceTaskA
28
33
  this.crypto = crypto;
29
34
  this.hcPartyApi = hcPartyApi;
30
35
  this.dataOwnerApi = dataOwnerApi;
31
- this.encryptedFields = (0, utils_1.parseEncryptedFields)(encryptedKeys, 'MaintenanceTask.');
32
36
  this.userApi = userApi;
33
37
  this.authApi = authApi;
38
+ this.autofillAuthor = autofillAuthor;
39
+ this.encryptedFields = (0, utils_1.parseEncryptedFields)(encryptedKeys, 'MaintenanceTask.');
34
40
  }
35
41
  /**
36
42
  * Creates a new instance of maintenance task with initialised encryption metadata (not in the database).
@@ -40,18 +46,17 @@ class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi_1.IccMaintenanceTaskA
40
46
  * @param options optional parameters:
41
47
  * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
42
48
  * 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
43
- * auto-delegations, in such case the access level specified here will be used. Currently only WRITE access is supported, but in future also read
44
- * access will be possible.
49
+ * auto-delegations, in such case the access level specified here will be used.
45
50
  * @return a new instance of maintenance task.
46
51
  */
47
52
  newInstance(user, m, options = {}) {
48
53
  var _a, _b, _c, _d, _e, _f, _g, _h;
49
54
  return __awaiter(this, void 0, void 0, function* () {
50
55
  const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user);
51
- const maintenanceTask = Object.assign(Object.assign({}, (m !== null && m !== void 0 ? m : {})), { _type: 'org.taktik.icure.entities.MaintenanceTask', id: (_a = m === null || m === void 0 ? void 0 : m.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = m === null || m === void 0 ? void 0 : m.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = m === null || m === void 0 ? void 0 : m.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), responsible: (_d = m === null || m === void 0 ? void 0 : m.responsible) !== null && _d !== void 0 ? _d : dataOwnerId, author: (_e = m === null || m === void 0 ? void 0 : m.author) !== null && _e !== void 0 ? _e : user.id });
52
- const extraDelegations = [...Object.keys((_f = options.additionalDelegates) !== null && _f !== void 0 ? _f : {}), ...((_h = (_g = user.autoDelegations) === null || _g === void 0 ? void 0 : _g.all) !== null && _h !== void 0 ? _h : [])];
53
- return new models.MaintenanceTask(yield this.crypto.entities
54
- .entityWithInitialisedEncryptedMetadata(maintenanceTask, undefined, undefined, true, extraDelegations)
56
+ const maintenanceTask = Object.assign(Object.assign({}, (m !== null && m !== void 0 ? m : {})), { _type: 'org.taktik.icure.entities.MaintenanceTask', id: (_a = m === null || m === void 0 ? void 0 : m.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = m === null || m === void 0 ? void 0 : m.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = m === null || m === void 0 ? void 0 : m.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), responsible: (_d = m === null || m === void 0 ? void 0 : m.responsible) !== null && _d !== void 0 ? _d : (this.autofillAuthor ? dataOwnerId : undefined), author: (_e = m === null || m === void 0 ? void 0 : m.author) !== null && _e !== void 0 ? _e : (this.autofillAuthor ? user.id : undefined) });
57
+ const extraDelegations = Object.assign(Object.assign({}, Object.fromEntries(((_g = (_f = user.autoDelegations) === null || _f === void 0 ? void 0 : _f.all) !== null && _g !== void 0 ? _g : []).map((d) => [d, AccessLevelEnum.WRITE]))), ((_h = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _h !== void 0 ? _h : {}));
58
+ return new models.MaintenanceTask(yield this.crypto.xapi
59
+ .entityWithInitialisedEncryptedMetadata(maintenanceTask, 'MaintenanceTask', undefined, undefined, true, false, extraDelegations)
55
60
  .then((x) => x.updatedEntity));
56
61
  });
57
62
  }
@@ -93,36 +98,47 @@ class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi_1.IccMaintenanceTaskA
93
98
  throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption');
94
99
  }
95
100
  modifyMaintenanceTaskWithUser(user, body) {
96
- return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : Promise.resolve(null);
101
+ return body ? this.modifyMaintenanceTaskAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : Promise.resolve(null);
97
102
  }
98
- modifyAs(dataOwner, body) {
103
+ modifyMaintenanceTaskAs(dataOwner, body) {
99
104
  return this.encryptAs(dataOwner, [_.cloneDeep(body)])
100
105
  .then((encTasks) => super.modifyMaintenanceTask(encTasks[0]))
101
106
  .then((mt) => this.decryptAs(dataOwner, [mt]))
102
107
  .then((mts) => mts[0]);
103
108
  }
104
109
  encrypt(user, maintenanceTasks) {
105
- return this.encryptAs(this.dataOwnerApi.getDataOwnerIdOf(user), maintenanceTasks);
110
+ const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user);
111
+ return this.encryptAs(dataOwnerId, maintenanceTasks);
106
112
  }
107
- encryptAs(dataOwnerId, maintenanceTasks) {
108
- return Promise.all(maintenanceTasks.map((m) => this.crypto.entities.tryEncryptEntity(m, dataOwnerId, this.encryptedFields, true, true, (x) => new models.MaintenanceTask(x))));
113
+ encryptAs(dataOwner, maintenanceTasks) {
114
+ return Promise.all(maintenanceTasks.map((m) => this.crypto.xapi.tryEncryptEntity(m, 'MaintenanceTask', this.encryptedFields, true, false, (x) => new models.MaintenanceTask(x))));
109
115
  }
110
116
  decrypt(user, maintenanceTasks) {
111
- return this.decryptAs(this.dataOwnerApi.getDataOwnerIdOf(user), maintenanceTasks);
117
+ const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user);
118
+ return this.decryptAs(dataOwnerId, maintenanceTasks);
112
119
  }
113
- decryptAs(dataOwnerId, maintenanceTasks) {
114
- return Promise.all(maintenanceTasks.map((mT) => __awaiter(this, void 0, void 0, function* () { return this.crypto.entities.decryptEntity(mT, dataOwnerId, (x) => new models_1.MaintenanceTask(x)).then(({ entity }) => entity); })));
120
+ decryptAs(dataOwner, maintenanceTasks) {
121
+ return Promise.all(maintenanceTasks.map((mT) => __awaiter(this, void 0, void 0, function* () { return this.crypto.xapi.decryptEntity(mT, 'MaintenanceTask', (x) => new models_1.MaintenanceTask(x)).then(({ entity }) => entity); })));
122
+ }
123
+ /**
124
+ * @return if the logged data owner has write access to the content of the given maintenance task
125
+ */
126
+ hasWriteAccess(maintenanceTask) {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ return this.crypto.xapi.hasWriteAccess({ entity: maintenanceTask, type: 'MaintenanceTask' });
129
+ });
115
130
  }
116
131
  /**
117
132
  * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also
118
- * the encrypted content.
133
+ * the encrypted content, with read-only or read-write permissions.
119
134
  * @param delegateId the id of the data owner which will be granted access to the maintenance task.
120
135
  * @param maintenanceTask the maintenance task to share.
121
136
  * @param options optional parameters to customize the sharing behaviour:
122
137
  * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
123
138
  * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
124
139
  * maintenance task does not have encrypted content.
125
- * @return a promise which will contain the updated maintenance task
140
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
141
+ * @return the updated entity
126
142
  */
127
143
  shareWith(delegateId, maintenanceTask, options = {}) {
128
144
  return __awaiter(this, void 0, void 0, function* () {
@@ -131,41 +147,66 @@ class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi_1.IccMaintenanceTaskA
131
147
  }
132
148
  /**
133
149
  * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also
134
- * the encrypted content.
150
+ * the encrypted content, with read-only or read-write permissions.
135
151
  * @param maintenanceTask the maintenance task to share.
136
- * @param delegates sharing options for each delegate.
152
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
137
153
  * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
138
154
  * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
139
155
  * maintenance task does not have encrypted content.
140
- * @return a promise which will contain the updated maintenance task
156
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
157
+ * @return the updated entity.
141
158
  */
142
159
  shareWithMany(maintenanceTask, delegates) {
143
160
  return __awaiter(this, void 0, void 0, function* () {
144
- const self = yield this.dataOwnerApi.getCurrentDataOwnerId();
145
- const extended = yield this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(maintenanceTask, true, delegates);
146
- if (!!extended) {
147
- return yield this.modifyAs(self, extended);
148
- }
149
- else
150
- return maintenanceTask;
161
+ return (yield this.tryShareWithMany(maintenanceTask, delegates)).updatedEntityOrThrow;
151
162
  });
152
163
  }
153
- getDataOwnersWithAccessTo(entity) {
164
+ /**
165
+ * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also
166
+ * the encrypted content, with read-only or read-write permissions.
167
+ * @param maintenanceTask the maintenance task to share.
168
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
169
+ * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
170
+ * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
171
+ * maintenance task does not have encrypted content.
172
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
173
+ * @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
174
+ * the operation failed.
175
+ */
176
+ tryShareWithMany(maintenanceTask, delegates) {
154
177
  return __awaiter(this, void 0, void 0, function* () {
155
- return yield this.crypto.entities.getDataOwnersWithAccessTo(entity);
178
+ const self = yield this.dataOwnerApi.getCurrentDataOwnerId();
179
+ // All entities should have an encryption key.
180
+ const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(maintenanceTask, 'MaintenanceTask');
181
+ const updatedEntity = entityWithEncryptionKey ? yield this.modifyMaintenanceTaskAs(self, entityWithEncryptionKey) : maintenanceTask;
182
+ return this.crypto.xapi
183
+ .simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type: 'MaintenanceTask' }, true, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
184
+ delegateId,
185
+ {
186
+ requestedPermissions: options.requestedPermissions,
187
+ shareEncryptionKeys: options.shareEncryptionKey,
188
+ shareOwningEntityIds: ShareMetadataBehaviour_1.ShareMetadataBehaviour.NEVER,
189
+ shareSecretIds: undefined,
190
+ },
191
+ ])), (x) => this.bulkShareMaintenanceTask(x))
192
+ .then((r) => r.mapSuccessAsync((e) => this.decryptAs(self, [e]).then((es) => es[0])));
156
193
  });
157
194
  }
195
+ getDataOwnersWithAccessTo(entity) {
196
+ return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: 'MaintenanceTask' });
197
+ }
158
198
  getEncryptionKeysOf(entity) {
159
- return __awaiter(this, void 0, void 0, function* () {
160
- return yield this.crypto.entities.encryptionKeysOf(entity);
161
- });
199
+ return this.crypto.xapi.encryptionKeysOf({ entity, type: 'MaintenanceTask' }, undefined);
162
200
  }
163
201
  subscribeToMaintenanceTaskEvents(eventTypes, filter, eventFired, options = {}) {
164
202
  return __awaiter(this, void 0, void 0, function* () {
165
203
  const currentUser = yield this.userApi.getCurrentUser();
166
- return (0, websocket_1.subscribeToEntityEvents)(this.host, this.authApi, 'MaintenanceTask', eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decrypt(currentUser, [encrypted]))[0]; })).then((rs) => new Connection_1.ConnectionImpl(rs));
204
+ return (0, utils_1.subscribeToEntityEvents)(this.host, this.authApi, 'MaintenanceTask', eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decrypt(currentUser, [encrypted]))[0]; })).then((rs) => new Connection_1.ConnectionImpl(rs));
167
205
  });
168
206
  }
207
+ createDelegationDeAnonymizationMetadata(entity, delegates) {
208
+ return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: 'MaintenanceTask' }, delegates);
209
+ }
169
210
  }
170
211
  exports.IccMaintenanceTaskXApi = IccMaintenanceTaskXApi;
171
212
  //# sourceMappingURL=icc-maintenance-task-x-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"icc-maintenance-task-x-api.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from './icc-crypto-x-api'\nimport * as models from '../icc-api/model/models'\nimport { DocIdentifier, MaintenanceTask } from '../icc-api/model/models'\nimport * as _ from 'lodash'\nimport { IccHcpartyXApi } from './icc-hcparty-x-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, SubscriptionOptions} from './utils'\nimport {AbstractFilter} from \"./filters/filters\"\nimport {Connection, ConnectionImpl} from \"../icc-api/model/Connection\"\nimport {subscribeToEntityEvents} from \"./utils/websocket\"\nimport {IccUserXApi} from \"./icc-user-x-api\"\nimport {IccAuthApi} from \"../icc-api\"\n\nexport class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi implements EncryptedEntityXApi<models.MaintenanceTask> {\n crypto: IccCryptoXApi\n hcPartyApi: IccHcpartyXApi\n dataOwnerApi: IccDataOwnerXApi\n private readonly userApi: IccUserXApi\n private readonly authApi: IccAuthApi\n\n private readonly encryptedFields: EncryptedFieldsManifest\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n hcPartyApi: IccHcpartyXApi,\n dataOwnerApi: IccDataOwnerXApi,\n userApi: IccUserXApi,\n authApi: IccAuthApi,\n encryptedKeys: Array<string> = ['properties'],\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.hcPartyApi = hcPartyApi\n this.dataOwnerApi = dataOwnerApi\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'MaintenanceTask.')\n this.userApi = userApi\n this.authApi = authApi\n }\n\n /**\n * Creates a new instance of maintenance task with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param m initialised data for the maintenance task. 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 * @return a new instance of maintenance task.\n */\n async newInstance(\n user: models.User,\n m: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: 'WRITE' }\n } = {}\n ) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n const maintenanceTask = {\n ...(m ?? {}),\n _type: 'org.taktik.icure.entities.MaintenanceTask',\n id: m?.id ?? this.crypto.primitives.randomUuid(),\n created: m?.created ?? new Date().getTime(),\n modified: m?.modified ?? new Date().getTime(),\n responsible: m?.responsible ?? dataOwnerId,\n author: m?.author ?? user.id,\n }\n\n const extraDelegations = [...Object.keys(options.additionalDelegates ?? {}), ...(user.autoDelegations?.all ?? [])]\n return new models.MaintenanceTask(\n await this.crypto.entities\n .entityWithInitialisedEncryptedMetadata(maintenanceTask, undefined, undefined, true, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n createMaintenanceTask(body?: models.MaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n createMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | null> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((tasks) => super.createMaintenanceTask(tasks[0]))\n .then((mt) => this.decrypt(user, [mt]))\n .then((tasks) => tasks[0])\n : Promise.resolve(null)\n }\n\n filterMaintenanceTasksBy(startDocumentId?: string, limit?: number, body?: models.FilterChainMaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n deleteMaintenanceTask(_maintenanceTaskIds: string): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n deleteMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<Array<DocIdentifier>> | never {\n return super.deleteMaintenanceTask(maintenanceTaskId)\n }\n\n filterMaintenanceTasksByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainMaintenanceTask\n ): Promise<models.PaginatedListMaintenanceTask> {\n return super\n .filterMaintenanceTasksBy(startDocumentId, limit, body)\n .then((pl) => this.decrypt(user, pl.rows!).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n getMaintenanceTask(maintenanceTaskId: string): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n getMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<models.MaintenanceTask | any> {\n return super\n .getMaintenanceTask(maintenanceTaskId)\n .then((mt) => this.decrypt(user, [mt]))\n .then((mts) => mts[0])\n }\n\n modifyMaintenanceTask(body?: models.MaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n modifyMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | any> {\n return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : Promise.resolve(null)\n }\n\n private modifyAs(dataOwner: string, body: models.MaintenanceTask): Promise<models.MaintenanceTask | any> {\n return this.encryptAs(dataOwner, [_.cloneDeep(body)])\n .then((encTasks) => super.modifyMaintenanceTask(encTasks[0]))\n .then((mt) => this.decryptAs(dataOwner, [mt]))\n .then((mts) => mts[0])\n }\n\n encrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n return this.encryptAs(this.dataOwnerApi.getDataOwnerIdOf(user), maintenanceTasks)\n }\n\n private encryptAs(dataOwnerId: string, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n return Promise.all(\n maintenanceTasks.map((m) =>\n this.crypto.entities.tryEncryptEntity(m, dataOwnerId, this.encryptedFields, true, true, (x) => new models.MaintenanceTask(x))\n )\n )\n }\n\n decrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n return this.decryptAs(this.dataOwnerApi.getDataOwnerIdOf(user), maintenanceTasks)\n }\n\n private decryptAs(dataOwnerId: string, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n return Promise.all(\n maintenanceTasks.map(async (mT) =>\n this.crypto.entities.decryptEntity(mT, dataOwnerId, (x) => new MaintenanceTask(x)).then(({ entity }) => entity)\n )\n )\n }\n\n /**\n * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also\n * the encrypted content.\n * @param delegateId the id of the data owner which will be granted access to the maintenance task.\n * @param maintenanceTask the maintenance task 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 * maintenance task does not have encrypted content.\n * @return a promise which will contain the updated maintenance task\n */\n async shareWith(\n delegateId: string,\n maintenanceTask: models.MaintenanceTask,\n options: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.MaintenanceTask> {\n return this.shareWithMany(maintenanceTask, { [delegateId]: options })\n }\n\n /**\n * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also\n * the encrypted content.\n * @param maintenanceTask the maintenance task 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 * maintenance task does not have encrypted content.\n * @return a promise which will contain the updated maintenance task\n */\n async shareWithMany(\n maintenanceTask: models.MaintenanceTask,\n delegates: {\n [delegateId: string]: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.MaintenanceTask> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n const extended = await this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(maintenanceTask, true, delegates)\n if (!!extended) {\n return await this.modifyAs(self, extended)\n } else return maintenanceTask\n }\n\n async getDataOwnersWithAccessTo(\n entity: MaintenanceTask\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: 'WRITE' }; hasUnknownAnonymousDataOwners: boolean }> {\n return await this.crypto.entities.getDataOwnersWithAccessTo(entity)\n }\n\n async getEncryptionKeysOf(entity: MaintenanceTask): Promise<string[]> {\n return await this.crypto.entities.encryptionKeysOf(entity)\n }\n\n async subscribeToMaintenanceTaskEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<MaintenanceTask>,\n eventFired: (dataSample: MaintenanceTask) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n const currentUser = await this.userApi.getCurrentUser()\n\n return subscribeToEntityEvents(\n this.host,\n this.authApi,\n 'MaintenanceTask',\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted) => (await this.decrypt(currentUser, [encrypted]))[0]\n ).then((rs) => new ConnectionImpl(rs))\n }\n}\n"]}
1
+ {"version":3,"file":"icc-maintenance-task-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-maintenance-task-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gFAA4E;AAE5E,kDAAiD;AACjD,4BAA2B;AAE3B,oDAAwE;AAExE,0EAAgG;AAChG,wEAAoE;AACpE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AACzD,4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N,UAAU,EACV,OAAO,EACP,CAAO,SAAS,EAAE,EAAE,gDAAC,OAAA,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,GAAA,CACvE,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,2BAAc,CAAC,EAAE,CAAC,CAAC,CAAA;QACxC,CAAC;KAAA;IAED,uCAAuC,CAAC,MAAuB,EAAE,SAAmB;QAClF,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,iCAAiC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAAE,SAAS,CAAC,CAAA;IACjI,CAAC;CACF;AA/RD,wDA+RC","sourcesContent":["import { IccMaintenanceTaskApi } from '../icc-api/api/IccMaintenanceTaskApi'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport * as models from '../icc-api/model/models'\nimport * as _ from 'lodash'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { DocIdentifier, MaintenanceTask } from '../icc-api/model/models'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { ShareResult } from './utils/ShareResult'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedFieldsManifest, parseEncryptedFields, subscribeToEntityEvents, SubscriptionOptions } from './utils'\nimport { IccUserXApi } from '@icure/apiV6'\nimport { IccAuthApi } from '../icc-api'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { AbstractFilter } from './filters/filters'\nimport { Connection, ConnectionImpl } from '../icc-api/model/Connection'\n\nexport class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi implements EncryptedEntityXApi<models.MaintenanceTask> {\n private readonly encryptedFields: EncryptedFieldsManifest\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'MaintenanceTask'))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private readonly crypto: IccCryptoXApi,\n private readonly hcPartyApi: IccHcpartyXApi,\n private readonly dataOwnerApi: IccDataOwnerXApi,\n private readonly userApi: IccUserXApi,\n private readonly authApi: IccAuthApi,\n private readonly autofillAuthor: boolean,\n encryptedKeys: Array<string> = [],\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.encryptedFields = parseEncryptedFields(encryptedKeys, 'MaintenanceTask.')\n }\n\n /**\n * Creates a new instance of maintenance task with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param m initialised data for the maintenance task. 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 * @return a new instance of maintenance task.\n */\n async newInstance(\n user: models.User,\n m: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n } = {}\n ) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n const maintenanceTask = {\n ...(m ?? {}),\n _type: 'org.taktik.icure.entities.MaintenanceTask',\n id: m?.id ?? this.crypto.primitives.randomUuid(),\n created: m?.created ?? new Date().getTime(),\n modified: m?.modified ?? new Date().getTime(),\n responsible: m?.responsible ?? (this.autofillAuthor ? dataOwnerId : undefined),\n author: m?.author ?? (this.autofillAuthor ? user.id : undefined),\n }\n\n const extraDelegations = {\n ...Object.fromEntries((user.autoDelegations?.all ?? []).map((d) => [d, AccessLevelEnum.WRITE])),\n ...(options?.additionalDelegates ?? {}),\n }\n return new models.MaintenanceTask(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(maintenanceTask, 'MaintenanceTask', undefined, undefined, true, false, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n createMaintenanceTask(body?: models.MaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n createMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | null> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((tasks) => super.createMaintenanceTask(tasks[0]))\n .then((mt) => this.decrypt(user, [mt]))\n .then((tasks) => tasks[0])\n : Promise.resolve(null)\n }\n\n filterMaintenanceTasksBy(startDocumentId?: string, limit?: number, body?: models.FilterChainMaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n deleteMaintenanceTask(_maintenanceTaskIds: string): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n deleteMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<Array<DocIdentifier>> | never {\n return super.deleteMaintenanceTask(maintenanceTaskId)\n }\n\n filterMaintenanceTasksByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainMaintenanceTask\n ): Promise<models.PaginatedListMaintenanceTask> {\n return super\n .filterMaintenanceTasksBy(startDocumentId, limit, body)\n .then((pl) => this.decrypt(user, pl.rows!).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n getMaintenanceTask(maintenanceTaskId: string): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n getMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<models.MaintenanceTask | any> {\n return super\n .getMaintenanceTask(maintenanceTaskId)\n .then((mt) => this.decrypt(user, [mt]))\n .then((mts) => mts[0])\n }\n\n modifyMaintenanceTask(body?: models.MaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n modifyMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | any> {\n return body ? this.modifyMaintenanceTaskAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : Promise.resolve(null)\n }\n\n private modifyMaintenanceTaskAs(dataOwner: string, body: models.MaintenanceTask): Promise<models.MaintenanceTask> {\n return this.encryptAs(dataOwner, [_.cloneDeep(body)])\n .then((encTasks) => super.modifyMaintenanceTask(encTasks[0]))\n .then((mt) => this.decryptAs(dataOwner, [mt]))\n .then((mts) => mts[0])\n }\n\n encrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n return this.encryptAs(dataOwnerId, maintenanceTasks)\n }\n\n private encryptAs(dataOwner: string, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n return Promise.all(\n maintenanceTasks.map((m) =>\n this.crypto.xapi.tryEncryptEntity(m, 'MaintenanceTask', this.encryptedFields, true, false, (x) => new models.MaintenanceTask(x))\n )\n )\n }\n\n decrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n return this.decryptAs(dataOwnerId, maintenanceTasks)\n }\n\n private decryptAs(dataOwner: string, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n return Promise.all(\n maintenanceTasks.map(async (mT) =>\n this.crypto.xapi.decryptEntity(mT, 'MaintenanceTask', (x) => new MaintenanceTask(x)).then(({ entity }) => entity)\n )\n )\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given maintenance task\n */\n async hasWriteAccess(maintenanceTask: models.MaintenanceTask): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: maintenanceTask, type: 'MaintenanceTask' })\n }\n\n /**\n * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task 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 maintenance task.\n * @param maintenanceTask the maintenance task 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 * maintenance task does not have encrypted content.\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWith(\n delegateId: string,\n maintenanceTask: models.MaintenanceTask,\n options: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.MaintenanceTask> {\n return this.shareWithMany(maintenanceTask, { [delegateId]: options })\n }\n\n /**\n * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param maintenanceTask the maintenance task 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 * maintenance task does not have encrypted content.\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity.\n */\n async shareWithMany(\n maintenanceTask: models.MaintenanceTask,\n delegates: {\n [delegateId: string]: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.MaintenanceTask> {\n return (await this.tryShareWithMany(maintenanceTask, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param maintenanceTask the maintenance task 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 * maintenance task does not have encrypted content.\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 tryShareWithMany(\n maintenanceTask: models.MaintenanceTask,\n delegates: {\n [delegateId: string]: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.MaintenanceTask>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(maintenanceTask, 'MaintenanceTask')\n const updatedEntity = entityWithEncryptionKey ? await this.modifyMaintenanceTaskAs(self, entityWithEncryptionKey) : maintenanceTask\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n { entity: updatedEntity, type: 'MaintenanceTask' },\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: ShareMetadataBehaviour.NEVER,\n shareSecretIds: undefined,\n },\n ])\n ),\n (x) => this.bulkShareMaintenanceTask(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decryptAs(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: models.MaintenanceTask\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: 'MaintenanceTask' })\n }\n\n getEncryptionKeysOf(entity: models.MaintenanceTask): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: 'MaintenanceTask' }, undefined)\n }\n\n async subscribeToMaintenanceTaskEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<MaintenanceTask>,\n eventFired: (dataSample: MaintenanceTask) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n const currentUser = await this.userApi.getCurrentUser()\n\n return subscribeToEntityEvents(\n this.host,\n this.authApi,\n 'MaintenanceTask',\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted) => (await this.decrypt(currentUser, [encrypted]))[0]\n ).then((rs) => new ConnectionImpl(rs))\n }\n\n createDelegationDeAnonymizationMetadata(entity: MaintenanceTask, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: 'MaintenanceTask' }, delegates)\n }\n}\n"]}
@@ -1,17 +1,31 @@
1
- import { IccMessageApi } from '../icc-api';
1
+ import { IccAuthApi, IccMessageApi } from '../icc-api';
2
2
  import { IccCryptoXApi } from './icc-crypto-x-api';
3
- import { Patient, User } from '../icc-api/model/models';
3
+ import * as models from '../icc-api/model/models';
4
+ import { Message, MessagesReadStatusUpdate, PaginatedListMessage, Patient, User } from '../icc-api/model/models';
4
5
  import { IccDataOwnerXApi } from './icc-data-owner-x-api';
5
6
  import { AuthenticationProvider } from './auth/AuthenticationProvider';
6
- import * as models from '../icc-api/model/models';
7
+ import { SecureDelegation } from '../icc-api/model/SecureDelegation';
7
8
  import { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour';
9
+ import { ShareResult } from './utils/ShareResult';
10
+ import { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest';
11
+ import { XHR } from '../icc-api/api/XHR';
8
12
  import { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi';
13
+ import { FilterChainMessage } from '../icc-api/model/FilterChainMessage';
14
+ import AccessLevelEnum = SecureDelegation.AccessLevelEnum;
15
+ import RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum;
16
+ import { AbstractFilter } from './filters/filters';
17
+ import { SubscriptionOptions } from './utils';
18
+ import { Connection } from '../icc-api/model/Connection';
9
19
  export declare class IccMessageXApi extends IccMessageApi implements EncryptedEntityXApi<models.Message> {
10
- private crypto;
11
- dataOwnerApi: IccDataOwnerXApi;
20
+ private readonly crypto;
21
+ private readonly dataOwnerApi;
22
+ private readonly authApi;
23
+ private readonly autofillAuthor;
24
+ private readonly encryptedFields;
25
+ get headers(): Promise<Array<XHR.Header>>;
12
26
  constructor(host: string, headers: {
13
27
  [key: string]: string;
14
- }, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
28
+ }, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, authApi: IccAuthApi, autofillAuthor: boolean, authenticationProvider?: AuthenticationProvider, encryptedKeys?: Array<string>, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
15
29
  newInstance(user: User, m: any): Promise<models.Message>;
16
30
  /**
17
31
  * Creates a new instance of message with initialised encryption metadata (not in the database).
@@ -22,27 +36,35 @@ export declare class IccMessageXApi extends IccMessageApi implements EncryptedEn
22
36
  * @param options optional parameters:
23
37
  * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
24
38
  * 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
25
- * auto-delegations, in such case the access level specified here will be used. Currently only WRITE access is supported, but in future also read
26
- * access will be possible.
27
- * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the classification. The default value will be a
39
+ * auto-delegations, in such case the access level specified here will be used.
40
+ * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the message. The default value will be a
28
41
  * secret id of patient known by the topmost parent in the current data owner hierarchy.
29
42
  * @return a new instance of message.
30
43
  */
31
44
  newInstanceWithPatient(user: User, patient: Patient | null, m?: any, options?: {
32
45
  additionalDelegates?: {
33
- [dataOwnerId: string]: 'WRITE';
46
+ [dataOwnerId: string]: AccessLevelEnum;
34
47
  };
35
48
  preferredSfk?: string;
36
49
  }): Promise<models.Message>;
50
+ decrypt(messages: Array<models.Message>): Promise<{
51
+ entity: models.Message;
52
+ decrypted: boolean;
53
+ }[]>;
54
+ encrypt(messages: Array<models.Message>): Promise<Array<models.Message>>;
37
55
  /**
38
56
  * @param message a message
39
57
  * @return the id of the patient that the message refers to, retrieved from the encrypted metadata. Normally there should only be one element
40
58
  * in the returned array, but in case of entity merges there could be multiple values.
41
59
  */
42
60
  decryptPatientIdOf(message: models.Message): Promise<string[]>;
61
+ /**
62
+ * @return if the logged data owner has write access to the content of the given message
63
+ */
64
+ hasWriteAccess(message: models.Message): Promise<boolean>;
43
65
  /**
44
66
  * Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also
45
- * the encrypted content.
67
+ * the encrypted content, with read-only or read-write permissions.
46
68
  * @param delegateId the id of the data owner which will be granted access to the message.
47
69
  * @param message the message to share.
48
70
  * @param shareSecretIds the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the
@@ -53,33 +75,61 @@ export declare class IccMessageXApi extends IccMessageApi implements EncryptedEn
53
75
  * message does not have encrypted content.
54
76
  * - sharePatientId: specifies if the id of the patient that this message refers to should be shared with the delegate (defaults to
55
77
  * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
56
- * @return a promise which will contain the updated message
78
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
79
+ * @return the updated entity
57
80
  */
58
81
  shareWith(delegateId: string, message: models.Message, shareSecretIds: string[], options?: {
82
+ requestedPermissions?: RequestedPermissionEnum;
59
83
  shareEncryptionKey?: ShareMetadataBehaviour;
60
84
  sharePatientId?: ShareMetadataBehaviour;
61
85
  }): Promise<models.Message>;
62
86
  /**
63
87
  * Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also
64
- * the encrypted content.
88
+ * the encrypted content, with read-only or read-write permissions.
65
89
  * @param message the message to share.
66
- * @param delegates sharing options for each delegate.
90
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
91
+ * - shareSecretIds the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the
92
+ * shared Message is the owning entity id. Mandatory.
67
93
  * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
68
94
  * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
69
95
  * message does not have encrypted content.
70
96
  * - sharePatientId: specifies if the id of the patient that this message refers to should be shared with the delegate (defaults to
71
97
  * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
72
- * - shareSecretIds the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the
73
- * shared Message is the owning entity id.
74
- * @return a promise which will contain the updated message
98
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
99
+ * @return the updated entity
75
100
  */
76
- shareWithMany(message: models.Message, delegates?: {
101
+ shareWithMany(message: models.Message, delegates: {
77
102
  [delegateId: string]: {
78
103
  shareSecretIds: string[];
104
+ requestedPermissions?: RequestedPermissionEnum;
79
105
  shareEncryptionKey?: ShareMetadataBehaviour;
80
106
  sharePatientId?: ShareMetadataBehaviour;
81
107
  };
82
108
  }): Promise<models.Message>;
109
+ /**
110
+ * Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also
111
+ * the encrypted content, with read-only or read-write permissions.
112
+ * @param message the message to share.
113
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
114
+ * - shareSecretIds the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the
115
+ * shared Message is the owning entity id. Mandatory.
116
+ * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
117
+ * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
118
+ * message does not have encrypted content.
119
+ * - sharePatientId: specifies if the id of the patient that this message refers to should be shared with the delegate (defaults to
120
+ * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
121
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
122
+ * @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
123
+ * the operation failed.
124
+ */
125
+ tryShareWithMany(message: models.Message, delegates: {
126
+ [delegateId: string]: {
127
+ shareSecretIds: string[];
128
+ requestedPermissions?: RequestedPermissionEnum;
129
+ shareEncryptionKey?: ShareMetadataBehaviour;
130
+ sharePatientId?: ShareMetadataBehaviour;
131
+ };
132
+ }): Promise<ShareResult<models.Message>>;
83
133
  /**
84
134
  * @param message a message
85
135
  * @return the secret ids of the message, retrieved from the encrypted metadata. The result may be used to find entities where the message is
@@ -88,9 +138,15 @@ export declare class IccMessageXApi extends IccMessageApi implements EncryptedEn
88
138
  decryptSecretIdsOf(message: models.Message): Promise<string[]>;
89
139
  getDataOwnersWithAccessTo(entity: models.Message): Promise<{
90
140
  permissionsByDataOwnerId: {
91
- [p: string]: 'WRITE';
141
+ [p: string]: AccessLevelEnum;
92
142
  };
93
143
  hasUnknownAnonymousDataOwners: boolean;
94
144
  }>;
95
145
  getEncryptionKeysOf(entity: models.Message): Promise<string[]>;
146
+ filterMessagesBy(body: FilterChainMessage, startDocumentId?: string, limit?: number): Promise<PaginatedListMessage>;
147
+ encryptAndCreateMessage(body: Message): Promise<Message>;
148
+ setMessagesReadStatus(body?: MessagesReadStatusUpdate): Promise<Array<Message>>;
149
+ getAndDecryptMessage(messageId: string): Promise<Message>;
150
+ subscribeToMessageEvents(eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[], filter: AbstractFilter<Message> | undefined, eventFired: (message: Message) => Promise<void>, options?: SubscriptionOptions): Promise<Connection>;
151
+ createDelegationDeAnonymizationMetadata(entity: Message, delegates: string[]): Promise<void>;
96
152
  }