@icure/api 8.0.0-RC.1 → 8.0.0-RC.3

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 (345) hide show
  1. package/icc-api/api/IccAccesslogApi.d.ts +12 -4
  2. package/icc-api/api/IccAccesslogApi.js +23 -18
  3. package/icc-api/api/IccAccesslogApi.js.map +1 -1
  4. package/icc-api/api/IccAgendaApi.d.ts +13 -4
  5. package/icc-api/api/IccAgendaApi.js +42 -19
  6. package/icc-api/api/IccAgendaApi.js.map +1 -1
  7. package/icc-api/api/IccApplicationsettingsApi.d.ts +1 -1
  8. package/icc-api/api/IccApplicationsettingsApi.js +2 -2
  9. package/icc-api/api/IccApplicationsettingsApi.js.map +1 -1
  10. package/icc-api/api/IccArticleApi.d.ts +13 -4
  11. package/icc-api/api/IccArticleApi.js +50 -26
  12. package/icc-api/api/IccArticleApi.js.map +1 -1
  13. package/icc-api/api/IccAuthApi.d.ts +1 -1
  14. package/icc-api/api/IccAuthApi.js +2 -2
  15. package/icc-api/api/IccAuthApi.js.map +1 -1
  16. package/icc-api/api/IccCalendarItemApi.d.ts +8 -4
  17. package/icc-api/api/IccCalendarItemApi.js +15 -22
  18. package/icc-api/api/IccCalendarItemApi.js.map +1 -1
  19. package/icc-api/api/IccCalendarItemTypeApi.d.ts +6 -4
  20. package/icc-api/api/IccCalendarItemTypeApi.js +60 -45
  21. package/icc-api/api/IccCalendarItemTypeApi.js.map +1 -1
  22. package/icc-api/api/IccClassificationApi.d.ts +14 -5
  23. package/icc-api/api/IccClassificationApi.js +22 -12
  24. package/icc-api/api/IccClassificationApi.js.map +1 -1
  25. package/icc-api/api/IccClassificationTemplateApi.d.ts +14 -5
  26. package/icc-api/api/IccClassificationTemplateApi.js +102 -70
  27. package/icc-api/api/IccClassificationTemplateApi.js.map +1 -1
  28. package/icc-api/api/IccCodeApi.d.ts +1 -1
  29. package/icc-api/api/IccCodeApi.js +2 -2
  30. package/icc-api/api/IccCodeApi.js.map +1 -1
  31. package/icc-api/api/IccContactApi.d.ts +11 -4
  32. package/icc-api/api/IccContactApi.js +20 -13
  33. package/icc-api/api/IccContactApi.js.map +1 -1
  34. package/icc-api/api/IccDataownerApi.d.ts +1 -1
  35. package/icc-api/api/IccDataownerApi.js +44 -27
  36. package/icc-api/api/IccDataownerApi.js.map +1 -1
  37. package/icc-api/api/IccDeviceApi.d.ts +1 -1
  38. package/icc-api/api/IccDeviceApi.js +43 -32
  39. package/icc-api/api/IccDeviceApi.js.map +1 -1
  40. package/icc-api/api/IccDoctemplateApi.d.ts +10 -8
  41. package/icc-api/api/IccDoctemplateApi.js +121 -101
  42. package/icc-api/api/IccDoctemplateApi.js.map +1 -1
  43. package/icc-api/api/IccDocumentApi.d.ts +19 -5
  44. package/icc-api/api/IccDocumentApi.js +38 -13
  45. package/icc-api/api/IccDocumentApi.js.map +1 -1
  46. package/icc-api/api/IccEntityrefApi.d.ts +1 -1
  47. package/icc-api/api/IccEntityrefApi.js +27 -16
  48. package/icc-api/api/IccEntityrefApi.js.map +1 -1
  49. package/icc-api/api/IccEntitytemplateApi.d.ts +6 -4
  50. package/icc-api/api/IccEntitytemplateApi.js +118 -97
  51. package/icc-api/api/IccEntitytemplateApi.js.map +1 -1
  52. package/icc-api/api/IccExchangeDataApi.d.ts +2 -2
  53. package/icc-api/api/IccExchangeDataApi.js +73 -52
  54. package/icc-api/api/IccExchangeDataApi.js.map +1 -1
  55. package/icc-api/api/IccExchangeDataMapApi.d.ts +2 -2
  56. package/icc-api/api/IccExchangeDataMapApi.js +53 -34
  57. package/icc-api/api/IccExchangeDataMapApi.js.map +1 -1
  58. package/icc-api/api/IccFormApi.d.ts +13 -5
  59. package/icc-api/api/IccFormApi.js +24 -18
  60. package/icc-api/api/IccFormApi.js.map +1 -1
  61. package/icc-api/api/IccFrontendmigrationApi.d.ts +1 -1
  62. package/icc-api/api/IccFrontendmigrationApi.js +19 -10
  63. package/icc-api/api/IccFrontendmigrationApi.js.map +1 -1
  64. package/icc-api/api/IccGroupApi.d.ts +16 -2
  65. package/icc-api/api/IccGroupApi.js +29 -3
  66. package/icc-api/api/IccGroupApi.js.map +1 -1
  67. package/icc-api/api/IccHcpartyApi.d.ts +25 -10
  68. package/icc-api/api/IccHcpartyApi.js +84 -53
  69. package/icc-api/api/IccHcpartyApi.js.map +1 -1
  70. package/icc-api/api/IccHelementApi.d.ts +13 -5
  71. package/icc-api/api/IccHelementApi.js +25 -21
  72. package/icc-api/api/IccHelementApi.js.map +1 -1
  73. package/icc-api/api/IccIcureApi.d.ts +1 -1
  74. package/icc-api/api/IccIcureApi.js +2 -2
  75. package/icc-api/api/IccIcureApi.js.map +1 -1
  76. package/icc-api/api/IccInsuranceApi.d.ts +1 -1
  77. package/icc-api/api/IccInsuranceApi.js +67 -50
  78. package/icc-api/api/IccInsuranceApi.js.map +1 -1
  79. package/icc-api/api/IccInvoiceApi.d.ts +1 -1
  80. package/icc-api/api/IccInvoiceApi.js +5 -11
  81. package/icc-api/api/IccInvoiceApi.js.map +1 -1
  82. package/icc-api/api/IccKeywordApi.d.ts +6 -5
  83. package/icc-api/api/IccKeywordApi.js +59 -45
  84. package/icc-api/api/IccKeywordApi.js.map +1 -1
  85. package/icc-api/api/IccMaintenanceTaskApi.d.ts +13 -4
  86. package/icc-api/api/IccMaintenanceTaskApi.js +22 -12
  87. package/icc-api/api/IccMaintenanceTaskApi.js.map +1 -1
  88. package/icc-api/api/IccMedexApi.d.ts +1 -1
  89. package/icc-api/api/IccMedexApi.js +19 -10
  90. package/icc-api/api/IccMedexApi.js.map +1 -1
  91. package/icc-api/api/IccMedicallocationApi.d.ts +6 -4
  92. package/icc-api/api/IccMedicallocationApi.js +52 -39
  93. package/icc-api/api/IccMedicallocationApi.js.map +1 -1
  94. package/icc-api/api/IccMessageApi.d.ts +25 -7
  95. package/icc-api/api/IccMessageApi.js +52 -22
  96. package/icc-api/api/IccMessageApi.js.map +1 -1
  97. package/icc-api/api/IccPatientApi.d.ts +13 -5
  98. package/icc-api/api/IccPatientApi.js +23 -13
  99. package/icc-api/api/IccPatientApi.js.map +1 -1
  100. package/icc-api/api/IccPermissionApi.d.ts +1 -1
  101. package/icc-api/api/IccPermissionApi.js +19 -10
  102. package/icc-api/api/IccPermissionApi.js.map +1 -1
  103. package/icc-api/api/IccPlaceApi.d.ts +7 -5
  104. package/icc-api/api/IccPlaceApi.js +53 -40
  105. package/icc-api/api/IccPlaceApi.js.map +1 -1
  106. package/icc-api/api/IccReceiptApi.d.ts +13 -4
  107. package/icc-api/api/IccReceiptApi.js +23 -13
  108. package/icc-api/api/IccReceiptApi.js.map +1 -1
  109. package/icc-api/api/IccReplicationApi.d.ts +1 -1
  110. package/icc-api/api/IccReplicationApi.js +3 -5
  111. package/icc-api/api/IccReplicationApi.js.map +1 -1
  112. package/icc-api/api/IccRoleApi.d.ts +16 -0
  113. package/icc-api/api/IccRoleApi.js +42 -0
  114. package/icc-api/api/IccRoleApi.js.map +1 -0
  115. package/icc-api/api/IccSecureDelegationKeyMapApi.d.ts +26 -0
  116. package/icc-api/api/IccSecureDelegationKeyMapApi.js +71 -0
  117. package/icc-api/api/IccSecureDelegationKeyMapApi.js.map +1 -0
  118. package/icc-api/api/IccTarificationApi.d.ts +1 -1
  119. package/icc-api/api/IccTarificationApi.js +19 -10
  120. package/icc-api/api/IccTarificationApi.js.map +1 -1
  121. package/icc-api/api/IccTimeTableApi.d.ts +13 -4
  122. package/icc-api/api/IccTimeTableApi.js +21 -9
  123. package/icc-api/api/IccTimeTableApi.js.map +1 -1
  124. package/icc-api/api/IccTopicApi.d.ts +97 -0
  125. package/icc-api/api/IccTopicApi.js +208 -0
  126. package/icc-api/api/IccTopicApi.js.map +1 -0
  127. package/icc-api/api/IccUserApi.d.ts +31 -1
  128. package/icc-api/api/IccUserApi.js +65 -2
  129. package/icc-api/api/IccUserApi.js.map +1 -1
  130. package/icc-api/index.d.ts +1 -0
  131. package/icc-api/index.js +1 -0
  132. package/icc-api/index.js.map +1 -1
  133. package/icc-api/model/AbstractFilterMessage.d.ts +15 -0
  134. package/icc-api/model/AbstractFilterMessage.js +21 -0
  135. package/icc-api/model/AbstractFilterMessage.js.map +1 -0
  136. package/icc-api/model/AbstractFilterTopic.d.ts +15 -0
  137. package/icc-api/model/AbstractFilterTopic.js +21 -0
  138. package/icc-api/model/AbstractFilterTopic.js.map +1 -0
  139. package/icc-api/model/AccessLog.d.ts +0 -2
  140. package/icc-api/model/AccessLog.js +0 -1
  141. package/icc-api/model/AccessLog.js.map +1 -1
  142. package/icc-api/model/Article.d.ts +0 -2
  143. package/icc-api/model/Article.js +0 -1
  144. package/icc-api/model/Article.js.map +1 -1
  145. package/icc-api/model/CalendarItem.d.ts +0 -2
  146. package/icc-api/model/CalendarItem.js +0 -1
  147. package/icc-api/model/CalendarItem.js.map +1 -1
  148. package/icc-api/model/Classification.d.ts +0 -2
  149. package/icc-api/model/Classification.js +0 -1
  150. package/icc-api/model/Classification.js.map +1 -1
  151. package/icc-api/model/Connection.d.ts +1 -1
  152. package/icc-api/model/Connection.js.map +1 -1
  153. package/icc-api/model/Contact.d.ts +0 -2
  154. package/icc-api/model/Contact.js +0 -1
  155. package/icc-api/model/Contact.js.map +1 -1
  156. package/icc-api/model/Document.d.ts +0 -2
  157. package/icc-api/model/Document.js +0 -1
  158. package/icc-api/model/Document.js.map +1 -1
  159. package/icc-api/model/FilterChainMessage.d.ts +19 -0
  160. package/icc-api/model/FilterChainMessage.js +11 -0
  161. package/icc-api/model/FilterChainMessage.js.map +1 -0
  162. package/icc-api/model/FilterChainTopic.d.ts +19 -0
  163. package/icc-api/model/FilterChainTopic.js +11 -0
  164. package/icc-api/model/FilterChainTopic.js.map +1 -0
  165. package/icc-api/model/Form.d.ts +0 -2
  166. package/icc-api/model/Form.js +0 -1
  167. package/icc-api/model/Form.js.map +1 -1
  168. package/icc-api/model/Group.d.ts +4 -0
  169. package/icc-api/model/Group.js.map +1 -1
  170. package/icc-api/model/HealthElement.d.ts +0 -2
  171. package/icc-api/model/HealthElement.js +0 -1
  172. package/icc-api/model/HealthElement.js.map +1 -1
  173. package/icc-api/model/HealthcareParty.js +13 -1
  174. package/icc-api/model/HealthcareParty.js.map +1 -1
  175. package/icc-api/model/Invoice.d.ts +0 -2
  176. package/icc-api/model/Invoice.js +0 -1
  177. package/icc-api/model/Invoice.js.map +1 -1
  178. package/icc-api/model/MaintenanceTask.d.ts +11 -10
  179. package/icc-api/model/MaintenanceTask.js +13 -12
  180. package/icc-api/model/MaintenanceTask.js.map +1 -1
  181. package/icc-api/model/Message.d.ts +5 -2
  182. package/icc-api/model/Message.js +0 -1
  183. package/icc-api/model/Message.js.map +1 -1
  184. package/icc-api/model/MessageAttachment.d.ts +10 -0
  185. package/icc-api/model/MessageAttachment.js +10 -0
  186. package/icc-api/model/MessageAttachment.js.map +1 -0
  187. package/icc-api/model/PaginatedListExchangeData.d.ts +1 -1
  188. package/icc-api/model/PaginatedListExchangeData.js.map +1 -1
  189. package/icc-api/model/PaginatedListTopic.d.ts +20 -0
  190. package/icc-api/model/PaginatedListTopic.js +10 -0
  191. package/icc-api/model/PaginatedListTopic.js.map +1 -0
  192. package/icc-api/model/Patient.d.ts +0 -2
  193. package/icc-api/model/Patient.js +0 -1
  194. package/icc-api/model/Patient.js.map +1 -1
  195. package/icc-api/model/Receipt.d.ts +0 -2
  196. package/icc-api/model/Receipt.js +0 -1
  197. package/icc-api/model/Receipt.js.map +1 -1
  198. package/icc-api/model/Role.d.ts +11 -0
  199. package/icc-api/model/Role.js +10 -0
  200. package/icc-api/model/Role.js.map +1 -0
  201. package/icc-api/model/RoleConfiguration.d.ts +6 -0
  202. package/icc-api/model/RoleConfiguration.js +10 -0
  203. package/icc-api/model/RoleConfiguration.js.map +1 -0
  204. package/icc-api/model/RoleSourceEnum.d.ts +11 -0
  205. package/icc-api/model/RoleSourceEnum.js +16 -0
  206. package/icc-api/model/RoleSourceEnum.js.map +1 -0
  207. package/icc-api/model/TimeTable.d.ts +0 -2
  208. package/icc-api/model/TimeTable.js +0 -1
  209. package/icc-api/model/TimeTable.js.map +1 -1
  210. package/icc-api/model/Topic.d.ts +95 -0
  211. package/icc-api/model/Topic.js +16 -0
  212. package/icc-api/model/Topic.js.map +1 -0
  213. package/icc-api/model/UserTypeEnum.d.ts +9 -0
  214. package/icc-api/model/UserTypeEnum.js +14 -0
  215. package/icc-api/model/UserTypeEnum.js.map +1 -0
  216. package/icc-api/model/{ExchangeData.d.ts → internal/ExchangeData.d.ts} +3 -0
  217. package/icc-api/model/{ExchangeData.js → internal/ExchangeData.js} +3 -0
  218. package/icc-api/model/internal/ExchangeData.js.map +1 -0
  219. package/icc-api/model/{ExchangeDataMap.d.ts → internal/ExchangeDataMap.d.ts} +3 -0
  220. package/icc-api/model/{ExchangeDataMap.js → internal/ExchangeDataMap.js} +3 -0
  221. package/icc-api/model/internal/ExchangeDataMap.js.map +1 -0
  222. package/icc-api/model/internal/SecureDelegationKeyMap.d.ts +14 -0
  223. package/icc-api/model/internal/SecureDelegationKeyMap.js +13 -0
  224. package/icc-api/model/internal/SecureDelegationKeyMap.js.map +1 -0
  225. package/icc-api/model/models.d.ts +11 -1
  226. package/icc-api/model/models.js +9 -0
  227. package/icc-api/model/models.js.map +1 -1
  228. package/icc-x-api/basexapi/EncryptedEntityXApi.d.ts +52 -4
  229. package/icc-x-api/basexapi/EncryptedEntityXApi.js.map +1 -1
  230. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.d.ts +2 -0
  231. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js +13 -4
  232. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js.map +1 -1
  233. package/icc-x-api/crypto/AccessControlSecretUtils.d.ts +1 -0
  234. package/icc-x-api/crypto/AccessControlSecretUtils.js +11 -0
  235. package/icc-x-api/crypto/AccessControlSecretUtils.js.map +1 -1
  236. package/icc-x-api/crypto/BaseExchangeDataManager.d.ts +1 -1
  237. package/icc-x-api/crypto/BaseExchangeDataManager.js +1 -1
  238. package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -1
  239. package/icc-x-api/crypto/DelegationsDeAnonymization.d.ts +44 -0
  240. package/icc-x-api/crypto/DelegationsDeAnonymization.js +235 -0
  241. package/icc-x-api/crypto/DelegationsDeAnonymization.js.map +1 -0
  242. package/icc-x-api/crypto/ExchangeDataManager.d.ts +3 -1
  243. package/icc-x-api/crypto/ExchangeDataManager.js +27 -19
  244. package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
  245. package/icc-x-api/crypto/ExchangeDataMapManager.d.ts +1 -1
  246. package/icc-x-api/crypto/ExchangeDataMapManager.js.map +1 -1
  247. package/icc-x-api/crypto/ExtendedApisUtils.d.ts +0 -10
  248. package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -1
  249. package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +0 -7
  250. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +4 -7
  251. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -1
  252. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.d.ts +0 -6
  253. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js +0 -9
  254. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js.map +1 -1
  255. package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -1
  256. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.d.ts +14 -5
  257. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js +44 -26
  258. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js.map +1 -1
  259. package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +1 -18
  260. package/icc-x-api/crypto/SecurityMetadataDecryptor.js +4 -23
  261. package/icc-x-api/crypto/SecurityMetadataDecryptor.js.map +1 -1
  262. package/icc-x-api/crypto/UserSignatureKeysManager.d.ts +1 -1
  263. package/icc-x-api/crypto/UserSignatureKeysManager.js +2 -2
  264. package/icc-x-api/crypto/UserSignatureKeysManager.js.map +1 -1
  265. package/icc-x-api/filters/LatestMessageByHcPartyTransportGuidFilter.d.ts +8 -0
  266. package/icc-x-api/filters/LatestMessageByHcPartyTransportGuidFilter.js +13 -0
  267. package/icc-x-api/filters/LatestMessageByHcPartyTransportGuidFilter.js.map +1 -0
  268. package/icc-x-api/filters/MessageByHcPartyFilter.d.ts +7 -0
  269. package/icc-x-api/filters/MessageByHcPartyFilter.js +13 -0
  270. package/icc-x-api/filters/MessageByHcPartyFilter.js.map +1 -0
  271. package/icc-x-api/filters/MessageByHcPartyTransportGuidFilter.d.ts +8 -0
  272. package/icc-x-api/filters/MessageByHcPartyTransportGuidFilter.js +13 -0
  273. package/icc-x-api/filters/MessageByHcPartyTransportGuidFilter.js.map +1 -0
  274. package/icc-x-api/filters/TopicByHcPartyFilter.d.ts +7 -0
  275. package/icc-x-api/filters/TopicByHcPartyFilter.js +13 -0
  276. package/icc-x-api/filters/TopicByHcPartyFilter.js.map +1 -0
  277. package/icc-x-api/filters/TopicByParticipantFilter.d.ts +7 -0
  278. package/icc-x-api/filters/TopicByParticipantFilter.js +13 -0
  279. package/icc-x-api/filters/TopicByParticipantFilter.js.map +1 -0
  280. package/icc-x-api/filters/filters.d.ts +5 -0
  281. package/icc-x-api/filters/filters.js +5 -0
  282. package/icc-x-api/filters/filters.js.map +1 -1
  283. package/icc-x-api/icc-accesslog-x-api.d.ts +3 -1
  284. package/icc-x-api/icc-accesslog-x-api.js +7 -3
  285. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  286. package/icc-x-api/icc-calendar-item-x-api.d.ts +3 -1
  287. package/icc-x-api/icc-calendar-item-x-api.js +7 -3
  288. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  289. package/icc-x-api/icc-classification-x-api.d.ts +3 -1
  290. package/icc-x-api/icc-classification-x-api.js +7 -3
  291. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  292. package/icc-x-api/icc-contact-x-api.d.ts +3 -1
  293. package/icc-x-api/icc-contact-x-api.js +8 -4
  294. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  295. package/icc-x-api/icc-crypto-x-api.d.ts +7 -1
  296. package/icc-x-api/icc-crypto-x-api.js +8 -1
  297. package/icc-x-api/icc-crypto-x-api.js.map +1 -1
  298. package/icc-x-api/icc-document-x-api.d.ts +3 -1
  299. package/icc-x-api/icc-document-x-api.js +8 -4
  300. package/icc-x-api/icc-document-x-api.js.map +1 -1
  301. package/icc-x-api/icc-form-x-api.d.ts +3 -1
  302. package/icc-x-api/icc-form-x-api.js +7 -3
  303. package/icc-x-api/icc-form-x-api.js.map +1 -1
  304. package/icc-x-api/icc-helement-x-api.d.ts +4 -2
  305. package/icc-x-api/icc-helement-x-api.js +8 -8
  306. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  307. package/icc-x-api/icc-invoice-x-api.d.ts +3 -1
  308. package/icc-x-api/icc-invoice-x-api.js +7 -3
  309. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  310. package/icc-x-api/icc-maintenance-task-x-api.d.ts +8 -4
  311. package/icc-x-api/icc-maintenance-task-x-api.js +14 -4
  312. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  313. package/icc-x-api/icc-message-x-api.d.ts +24 -6
  314. package/icc-x-api/icc-message-x-api.js +66 -6
  315. package/icc-x-api/icc-message-x-api.js.map +1 -1
  316. package/icc-x-api/icc-patient-x-api.d.ts +3 -1
  317. package/icc-x-api/icc-patient-x-api.js +7 -3
  318. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  319. package/icc-x-api/icc-receipt-x-api.d.ts +3 -1
  320. package/icc-x-api/icc-receipt-x-api.js +7 -3
  321. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  322. package/icc-x-api/icc-time-table-x-api.d.ts +3 -1
  323. package/icc-x-api/icc-time-table-x-api.js +7 -3
  324. package/icc-x-api/icc-time-table-x-api.js.map +1 -1
  325. package/icc-x-api/icc-topic-x-api.d.ts +191 -0
  326. package/icc-x-api/icc-topic-x-api.js +307 -0
  327. package/icc-x-api/icc-topic-x-api.js.map +1 -0
  328. package/icc-x-api/index.d.ts +17 -0
  329. package/icc-x-api/index.js +104 -70
  330. package/icc-x-api/index.js.map +1 -1
  331. package/icc-x-api/maintenance/KeyPairUpdateRequest.d.ts +1 -1
  332. package/icc-x-api/storage/KeyStorageImpl.d.ts +1 -0
  333. package/icc-x-api/storage/KeyStorageImpl.js +20 -12
  334. package/icc-x-api/storage/KeyStorageImpl.js.map +1 -1
  335. package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +1 -1
  336. package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -1
  337. package/icc-x-api/utils/websocket.d.ts +4 -0
  338. package/icc-x-api/utils/websocket.js +8 -0
  339. package/icc-x-api/utils/websocket.js.map +1 -1
  340. package/package.json +1 -1
  341. package/icc-api/api/IccDocumentTemplateApi.d.ts +0 -106
  342. package/icc-api/api/IccDocumentTemplateApi.js +0 -223
  343. package/icc-api/api/IccDocumentTemplateApi.js.map +0 -1
  344. package/icc-api/model/ExchangeData.js.map +0 -1
  345. package/icc-api/model/ExchangeDataMap.js.map +0 -1
@@ -73,6 +73,11 @@ export * from './MaintenanceTaskByHcPartyAndIdentifiersFilter';
73
73
  export * from './MaintenanceTaskByHcPartyAndTypeFilter';
74
74
  export * from './MaintenanceTaskByIdsFilter';
75
75
  export * from './MaintenanceTaskAfterDateFilter';
76
+ export * from './TopicByHcPartyFilter';
77
+ export * from './TopicByParticipantFilter';
78
+ export * from './MessageByHcPartyFilter';
79
+ export * from './MessageByHcPartyTransportGuidFilter';
80
+ export * from './LatestMessageByHcPartyTransportGuidFilter';
76
81
  export declare class Filter {
77
82
  static patient(): PatientFilterBuilder;
78
83
  }
@@ -81,6 +81,11 @@ __exportStar(require("./MaintenanceTaskByHcPartyAndIdentifiersFilter"), exports)
81
81
  __exportStar(require("./MaintenanceTaskByHcPartyAndTypeFilter"), exports);
82
82
  __exportStar(require("./MaintenanceTaskByIdsFilter"), exports);
83
83
  __exportStar(require("./MaintenanceTaskAfterDateFilter"), exports);
84
+ __exportStar(require("./TopicByHcPartyFilter"), exports);
85
+ __exportStar(require("./TopicByParticipantFilter"), exports);
86
+ __exportStar(require("./MessageByHcPartyFilter"), exports);
87
+ __exportStar(require("./MessageByHcPartyTransportGuidFilter"), exports);
88
+ __exportStar(require("./LatestMessageByHcPartyTransportGuidFilter"), exports);
84
89
  class Filter {
85
90
  static patient() {
86
91
  return new PatientFilterBuilder();
@@ -1 +1 @@
1
- {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../icc-x-api/filters/filters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAA+C;AAO/C,6DAAuD;AACvD,+CAAyC;AACzC,yDAAmD;AACnD,uFAAiF;AACjF,yFAAmF;AACnF,+FAAyF;AACzF,qFAA+E;AAC/E,yGAAmG;AACnG,2FAAqF;AAErF,uCAAoC;AACpC,qEAA+D;AAC/D,uHAAiH;AACjH,6DAAuD;AACvD,uGAAiG;AAGjG,qEAA+D;AAgB/D,mDAAgC;AAChC,qDAAkC;AAClC,+DAA4C;AAC5C,mDAAgC;AAChC,oDAAiC;AACjC,wEAAqD;AACrD,qDAAkC;AAClC,mDAAgC;AAChC,2DAAwC;AACxC,6EAA0D;AAC1D,sEAAmD;AACnD,8DAA2C;AAC3C,0DAAuC;AACvC,sDAAmC;AACnC,iEAA8C;AAC9C,4EAAyD;AACzD,kFAA+D;AAC/D,wEAAqD;AACrD,6DAA0C;AAC1C,+DAA4C;AAC5C,gEAA6C;AAC7C,mEAAgD;AAChD,uDAAoC;AACpC,mEAAgD;AAChD,oEAAiD;AACjD,qEAAkD;AAClD,wEAAqD;AACrD,yEAAsD;AACtD,kEAA+C;AAC/C,mEAAgD;AAChD,6EAA0D;AAC1D,sEAAmD;AACnD,2DAAwC;AACxC,oFAAiE;AACjE,4EAAyD;AACzD,+DAA4C;AAC5C,uDAAoC;AACpC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,CAAC,IAAA,iBAAM,EAAC,IAAA,cAAG,EAAC,IAAI,IAAI,EAAE,EAAE,EAAC,KAAK,EAAE,CAAC,GAAG,EAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA;IAC5G,CAAC;IAED,2BAA2B,CAAC,MAAmB,EAAE,SAAkB,EAAE,UAAmB;QACtF,OAAO,IAAI,CAAC,QAAQ,CAClB,IAAI,EACJ,IAAI,oBAAoB,CACtB,GAAG,EAAE,CACH,IAAI,iGAA+C,CAAC;YAClD,iBAAiB,EAAE,IAAI,CAAC,KAAK;YAC7B,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,SAAS;YACpB,UAAU,EAAE,UAAU;SACvB,CAAC,EACJ,IAAI,CAAC,KAAK,CACX,CACsB,CAAA;IAC3B,CAAC;IAED,KAAK,CAAC,GAAa;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,oBAAoB,CAAC,GAAG,EAAE,CAAC,IAAI,uCAAkB,CAAC,EAAC,GAAG,EAAE,GAAG,EAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAyB,CAAA;IACpI,CAAC;IAED,YAAY,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC,QAAQ,CAClB,IAAI,EACJ,IAAI,oBAAoB,CACtB,GAAG,EAAE,CACH,IAAI,iFAAuC,CAAC;YAC1C,iBAAiB,EAAE,IAAI,CAAC,KAAK;YAC7B,YAAY,EAAE,IAAI;SACnB,CAAC,EACJ,IAAI,CAAC,KAAK,CACX,CACsB,CAAA;IAC3B,CAAC;IAED,KAAK;;QACH,OAAO,CAAA,MAAA,IAAI,CAAC,cAAc,oDAAI,KAAI,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAA;IACtD,CAAC;CACF","sourcesContent":["import {ConstantFilter} from './ConstantFilter'\nimport {Patient} from '../../icc-api/model/Patient'\nimport {AbstractFilterPatient} from '../../icc-api/model/AbstractFilterPatient'\nimport {AbstractFilterContact} from '../../icc-api/model/AbstractFilterContact'\nimport {AbstractFilterService} from '../../icc-api/model/AbstractFilterService'\nimport {Service} from '../../icc-api/model/Service'\nimport {Contact} from '../../icc-api/model/Contact'\nimport {IntersectionFilter} from './IntersectionFilter'\nimport {UnionFilter} from './UnionFilter'\nimport {ComplementFilter} from './ComplementFilter'\nimport {PatientByHcPartyAndActiveFilter} from './PatientByHcPartyAndActiveFilter'\nimport {PatientByHcPartyAndAddressFilter} from './PatientByHcPartyAndAddressFilter'\nimport {PatientByHcPartyAndExternalIdFilter} from './PatientByHcPartyAndExternalIdFilter'\nimport {PatientByHcPartyAndSsinsFilter} from './PatientByHcPartyAndSsinsFilter'\nimport {PatientByHcPartyDateOfBirthBetweenFilter} from './PatientByHcPartyDateOfBirthBetweenFilter'\nimport {PatientByHcPartyDateOfBirthFilter} from './PatientByHcPartyDateOfBirthFilter'\n\nimport {add, format} from 'date-fns'\nimport {PatientByHcPartyFilter} from './PatientByHcPartyFilter'\nimport {PatientByHcPartyGenderEducationProfessionFilter} from './PatientByHcPartyGenderEducationProfessionFilter'\nimport {PatientByIdsFilter} from './PatientByIdsFilter'\nimport {PatientByHcPartyNameContainsFuzzyFilter} from './PatientByHcPartyNameContainsFuzzyFilter'\n\nimport GenderEnum = Patient.GenderEnum\nimport {ContactByHcPartyFilter} from './ContactByHcPartyFilter'\nimport {Device} from '../../icc-api/model/Device'\nimport {AbstractFilterDevice} from '../../icc-api/model/AbstractFilterDevice'\nimport {MaintenanceTask} from '../../icc-api/model/MaintenanceTask'\nimport {AbstractFilterMaintenanceTask} from '../../icc-api/model/AbstractFilterMaintenanceTask'\nimport {Code} from '../../icc-api/model/Code'\nimport {AbstractFilterCode} from '../../icc-api/model/AbstractFilterCode'\nimport {HealthElement} from '../../icc-api/model/HealthElement'\nimport {AbstractFilterHealthElement} from '../../icc-api/model/AbstractFilterHealthElement'\nimport {Invoice} from '../../icc-api/model/Invoice'\nimport {AbstractFilterInvoice} from '../../icc-api/model/AbstractFilterInvoice'\nimport {User} from '../../icc-api/model/User'\nimport {AbstractFilterUser} from '../../icc-api/model/AbstractFilterUser'\nimport {HealthcareParty} from \"../../icc-api/model/HealthcareParty\"\nimport {AbstractFilterHealthcareParty} from \"../../icc-api/model/AbstractFilterHealthcareParty\"\n\nexport * from './AllCodesFilter'\nexport * from './AllDevicesFilter'\nexport * from './AllHealthcarePartiesFilter'\nexport * from './AllUsersFilter'\nexport * from './CodeByIdsFilter'\nexport * from './CodeByRegionTypeLabelLanguageFilter'\nexport * from './ComplementFilter'\nexport * from './ConstantFilter'\nexport * from './ContactByHcPartyFilter'\nexport * from './ContactByHcPartyPatientTagCodeDateFilter'\nexport * from './ContactByHcPartyTagCodeDateFilter'\nexport * from './ContactByServiceIdsFilter'\nexport * from './DeviceByHcPartyFilter'\nexport * from './DeviceByIdsFilter'\nexport * from './HealthElementByHcPartyFilter'\nexport * from './HealthElementByHcPartyIdentifiersFilter'\nexport * from './HealthElementByHcPartySecretForeignKeysFilter'\nexport * from './HealthElementByHcPartyTagCodeFilter'\nexport * from './HealthElementByIdsFilter'\nexport * from './HealthcarePartyByIdsFilter'\nexport * from './HealthcarePartyByNameFilter'\nexport * from './HealthcarePartyByTagCodeFilter'\nexport * from './IntersectionFilter'\nexport * from './InvoiceByHcPartyCodeDateFilter'\nexport * from './PatientByHcPartyAndActiveFilter'\nexport * from './PatientByHcPartyAndAddressFilter'\nexport * from './PatientByHcPartyAndExternalIdFilter'\nexport * from './PatientByHcPartyAndIdentifiersFilter'\nexport * from './PatientByHcPartyAndSsinFilter'\nexport * from './PatientByHcPartyAndSsinsFilter'\nexport * from './PatientByHcPartyDateOfBirthBetweenFilter'\nexport * from './PatientByHcPartyDateOfBirthFilter'\nexport * from './PatientByHcPartyFilter'\nexport * from './PatientByHcPartyGenderEducationProfessionFilter'\nexport * from './PatientByHcPartyNameContainsFuzzyFilter'\nexport * from './PatientByHcPartyNameFilter'\nexport * from './PatientByIdsFilter'\nexport * from './ServiceByContactsAndSubcontactsFilter'\nexport * from './ServiceByHcPartyFilter'\nexport * from './ServiceByHcPartyIdentifiersFilter'\nexport * from './ServiceByHcPartyHealthElementIdsFilter'\nexport * from './ServiceByHcPartyTagCodeDateFilter'\nexport * from './ServiceByIdsFilter'\nexport * from './ServiceBySecretForeignKeys'\nexport * from './UnionFilter'\nexport * from './UserByIdsFilter'\nexport * from './MaintenanceTaskByHcPartyAndIdentifiersFilter'\nexport * from './MaintenanceTaskByHcPartyAndTypeFilter'\nexport * from './MaintenanceTaskByIdsFilter'\nexport * from './MaintenanceTaskAfterDateFilter'\n\nexport class Filter {\n public static patient(): PatientFilterBuilder {\n return new PatientFilterBuilder()\n }\n}\n\nexport type AbstractFilter<T> =\n | (T extends Patient\n ? AbstractFilterPatient\n : T extends Contact\n ? AbstractFilterContact\n : T extends Service\n ? AbstractFilterService\n : T extends HealthcareParty\n ? AbstractFilterHealthcareParty\n : T extends Device\n ? AbstractFilterDevice\n : T extends MaintenanceTask\n ? AbstractFilterMaintenanceTask\n : T extends Code\n ? AbstractFilterCode\n : T extends HealthElement\n ? AbstractFilterHealthElement\n : T extends Invoice\n ? AbstractFilterInvoice\n : T extends User\n ? AbstractFilterUser\n : never)\n | ConstantFilter<T>\n | IntersectionFilter<T>\n | UnionFilter<T>\n | ComplementFilter<T>\n\nconst f: AbstractFilterContact = new ComplementFilter<Contact>(new ContactByHcPartyFilter({}), new ContactByHcPartyFilter({}))\n\nabstract class FilterBuilder<T> {\n // This is the current generator for the filter, when we call build(), filterProvider() is going to be called\n filterProvider?: () => AbstractFilter<T>\n // This is the method that is called each time we chain a filter to another filter. The default behaviour is to\n // return a FilterBuilder with the provider set to the last element in the chain, except when we use combination\n // operators like or()/and()/… . After one of those, the composer is set to a function that will return a FilterBuilder\n\n protected constructor(\n filterProvider?: () => AbstractFilter<T>,\n composer?: (thisFilterBuilder: FilterBuilder<T>, otherFilterBuilder: FilterBuilder<T>) => FilterBuilder<T>\n ) {\n this.filterProvider = filterProvider\n composer && (this.composer = composer)\n }\n\n // that combines the existing filterBuilder with the filter definition we just added.\n composer: (thisFilterBuilder: FilterBuilder<T>, otherFilterBuilder: FilterBuilder<T>) => FilterBuilder<T> = (\n thisFilterBuilder: FilterBuilder<T>,\n otherFilterBuilder: FilterBuilder<T>\n ) => otherFilterBuilder\n\n abstract build(): AbstractFilter<T>\n\n abstract clone(\n filterProvider?: () => AbstractFilter<T>,\n composer?: (thisFilterBuilder: FilterBuilder<T>, otherFilterBuilder: FilterBuilder<T>) => FilterBuilder<T>\n ): FilterBuilder<T>\n\n listOf(elements: T[]): FilterBuilder<T> {\n return this.clone(() => new ConstantFilter<T>(elements) as AbstractFilter<T>)\n }\n\n /**\n * There are two ways of doing and, or, …\n *\n * 1) for (...) or (...) we use the syntax ... .or((builder) => builder...)\n * ex: youngerThan(65).or((b) => b.olderThan(18).and().gender(M)) means any gender < 65 or male > 18\n * 2) for ((...) or ...) we use the syntax ... .or().…\n * ex: youngerThan(65).or().olderThan(18).and().gender(M) means males between 18 and 65\n *\n * When 1) is used we do not have to wait for anything to provide a resolved builder that can later be combined with extra elements in the chain.\n * In other words, we can build the current filter chain up to the or/and/… and we can build what is inside the or/and/… brackets and we can set\n * the filterProvider of the returned Builder to () => UnionFilter([leftHand.build(), innerBrackets.build()]).\n *\n * When 2) is used, things get more tricky because we will have to do an or/and/… between what we have on the leftHand and with what we do not have\n * yet on the right hand. What we do in that situation is to set the filterProvider() to undefined because calling build() without having provided a\n * rightHand doesn't make sense. We set a composer that is going to be called the next time we chain a filter.\n *\n * @param filterBuilderFactory\n */\n\n and(filterBuilderFactory?: (it: FilterBuilder<T>) => FilterBuilder<T>): FilterBuilder<T> {\n const combiner = (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () =>\n new IntersectionFilter<T>([leftHandFilter, rightHandFilter]) as AbstractFilter<T>\n\n return filterBuilderFactory ? this.makeEagerLeftRightFilterBuilder(filterBuilderFactory, combiner) : this.makeLazyLeftRightFilterBuilder(combiner)\n }\n\n or(filterBuilderFactory?: (it: FilterBuilder<T>) => FilterBuilder<T>): FilterBuilder<T> {\n const combiner = (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () =>\n new UnionFilter<T>([leftHandFilter, rightHandFilter]) as AbstractFilter<T>\n\n return filterBuilderFactory ? this.makeEagerLeftRightFilterBuilder(filterBuilderFactory, combiner) : this.makeLazyLeftRightFilterBuilder(combiner)\n }\n\n minus(filterBuilderFactory?: (it: FilterBuilder<T>) => FilterBuilder<T>): FilterBuilder<T> {\n const combiner = (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () =>\n new ComplementFilter<T>(leftHandFilter, rightHandFilter) as AbstractFilter<T>\n\n return filterBuilderFactory ? this.makeEagerLeftRightFilterBuilder(filterBuilderFactory, combiner) : this.makeLazyLeftRightFilterBuilder(combiner)\n }\n\n private makeLazyLeftRightFilterBuilder(\n leftHandRightHandFiltersCombiner: (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () => AbstractFilter<T>\n ) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const leftHandFilterBuilder: FilterBuilder<T> = this\n const leftHandFilter = leftHandFilterBuilder.build() // Freeze the leftHand filter\n\n return leftHandFilterBuilder.filterProvider\n ? this.clone(\n undefined, //filter provider is indeterminate until we have performed a composition\n (unused: FilterBuilder<T>, rightHandFilterBuilder: FilterBuilder<T>) => {\n // because we freeze the leftHand in the state it is right now, we are not going to use its value when the composition occurs\n const rightHandFilter = rightHandFilterBuilder.build()\n\n return rightHandFilter\n ? this.clone(leftHandRightHandFiltersCombiner(leftHandFilter, rightHandFilter), rightHandFilterBuilder.composer)\n : rightHandFilterBuilder //Can this happen ?\n }\n )\n : this\n }\n\n private makeEagerLeftRightFilterBuilder(\n rightHandFilterBuilderFactory: (it: FilterBuilder<T>) => FilterBuilder<T>,\n leftHandRightHandFiltersCombiner: (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () => AbstractFilter<T>\n ) {\n const rightHandFilterBuilder = rightHandFilterBuilderFactory(this)\n return this.filterProvider ? this.clone(leftHandRightHandFiltersCombiner(this.build(), rightHandFilterBuilder.build())) : this\n }\n}\n\nclass PatientFilterBuilder extends FilterBuilder<Patient> {\n hcpId?: string\n\n constructor(\n filterProvider?: () => AbstractFilter<Patient>,\n hcpId?: string,\n composer?: (thisFilterBuilder: FilterBuilder<Patient>, otherFilterBuilder: FilterBuilder<Patient>) => FilterBuilder<Patient>\n ) {\n super(filterProvider, composer)\n this.hcpId = hcpId\n }\n\n clone(\n filterProvider?: () => AbstractFilter<Patient>,\n composer?: (thisFilterBuilder: FilterBuilder<Patient>, otherFilterBuilder: FilterBuilder<Patient>) => FilterBuilder<Patient>\n ): FilterBuilder<Patient> {\n return new PatientFilterBuilder(filterProvider, this.hcpId, composer)\n }\n\n listOf(elements: Patient[]): PatientFilterBuilder {\n return new PatientFilterBuilder(() => new ConstantFilter<Patient>(elements) as AbstractFilter<Patient>)\n }\n\n and(filterBuilderFactory?: (it: PatientFilterBuilder) => PatientFilterBuilder): PatientFilterBuilder {\n return super.and(filterBuilderFactory as any) as PatientFilterBuilder\n }\n\n or(filterBuilderFactory?: (it: PatientFilterBuilder) => PatientFilterBuilder): PatientFilterBuilder {\n return super.or(filterBuilderFactory as any) as PatientFilterBuilder\n }\n\n minus(filterBuilderFactory?: (it: PatientFilterBuilder) => PatientFilterBuilder): PatientFilterBuilder {\n return super.minus(filterBuilderFactory as any) as PatientFilterBuilder\n }\n\n forHcp(hcpId: string): PatientFilterBuilder {\n return this.composer(this, new PatientFilterBuilder(this.filterProvider, hcpId)) as PatientFilterBuilder\n }\n\n all(): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyFilter({ healthcarePartyId: this.hcpId }), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n activePatients(): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyAndActiveFilter({healthcarePartyId: this.hcpId, active: true}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n inactivePatients(): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyAndActiveFilter({healthcarePartyId: this.hcpId, active: false}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n byAddress(searchString?: string, postalCode?: string, houseNumber?: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyAndAddressFilter({\n healthcarePartyId: this.hcpId,\n searchString,\n postalCode,\n houseNumber,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n withExternalId(externalId: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyAndExternalIdFilter({\n healthcarePartyId: this.hcpId,\n externalId: externalId,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n withSsins(ssins: string[]): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyAndSsinsFilter({healthcarePartyId: this.hcpId, ssins: ssins}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n withDateOfBirthBetween(from?: number, to?: number): PatientFilterBuilder {\n return this.composer(\n this,\n this.clone(\n () =>\n new PatientByHcPartyDateOfBirthBetweenFilter({\n healthcarePartyId: this.hcpId,\n minDateOfBirth: from,\n maxDateOfBirth: to,\n })\n )\n ) as PatientFilterBuilder\n }\n\n byDateOfBirth(dateOfBirth: number): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyDateOfBirthFilter({\n healthcarePartyId: this.hcpId,\n dateOfBirth: dateOfBirth,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n olderThan(age: number): PatientFilterBuilder {\n return this.withDateOfBirthBetween(10000101, parseInt(format(add(new Date(), {years: -age}), 'yyyyMMdd')))\n }\n\n youngerThan(age: number): PatientFilterBuilder {\n return this.withDateOfBirthBetween(parseInt(format(add(new Date(), {years: -age}), 'yyyyMMdd')), 99991231)\n }\n\n byGenderEducationProfession(gender?: GenderEnum, education?: string, profession?: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyGenderEducationProfessionFilter({\n healthcarePartyId: this.hcpId,\n gender: gender,\n education: education,\n profession: profession,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n byIds(ids: string[]): PatientFilterBuilder {\n return this.composer(this, new PatientFilterBuilder(() => new PatientByIdsFilter({ids: ids}), this.hcpId)) as PatientFilterBuilder\n }\n\n searchByName(name: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyNameContainsFuzzyFilter({\n healthcarePartyId: this.hcpId,\n searchString: name,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n build(): AbstractFilter<Patient> {\n return this.filterProvider?.() || this.all().build()\n }\n}\n"]}
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../icc-x-api/filters/filters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAA+C;AAO/C,6DAAuD;AACvD,+CAAyC;AACzC,yDAAmD;AACnD,uFAAiF;AACjF,yFAAmF;AACnF,+FAAyF;AACzF,qFAA+E;AAC/E,yGAAmG;AACnG,2FAAqF;AAErF,uCAAoC;AACpC,qEAA+D;AAC/D,uHAAiH;AACjH,6DAAuD;AACvD,uGAAiG;AAGjG,qEAA+D;AAgB/D,mDAAgC;AAChC,qDAAkC;AAClC,+DAA4C;AAC5C,mDAAgC;AAChC,oDAAiC;AACjC,wEAAqD;AACrD,qDAAkC;AAClC,mDAAgC;AAChC,2DAAwC;AACxC,6EAA0D;AAC1D,sEAAmD;AACnD,8DAA2C;AAC3C,0DAAuC;AACvC,sDAAmC;AACnC,iEAA8C;AAC9C,4EAAyD;AACzD,k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iFAAuC,CAAC;YAC1C,iBAAiB,EAAE,IAAI,CAAC,KAAK;YAC7B,YAAY,EAAE,IAAI;SACnB,CAAC,EACJ,IAAI,CAAC,KAAK,CACX,CACsB,CAAA;IAC3B,CAAC;IAED,KAAK;;QACH,OAAO,CAAA,MAAA,IAAI,CAAC,cAAc,oDAAI,KAAI,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAA;IACtD,CAAC;CACF","sourcesContent":["import {ConstantFilter} from './ConstantFilter'\nimport {Patient} from '../../icc-api/model/Patient'\nimport {AbstractFilterPatient} from '../../icc-api/model/AbstractFilterPatient'\nimport {AbstractFilterContact} from '../../icc-api/model/AbstractFilterContact'\nimport {AbstractFilterService} from '../../icc-api/model/AbstractFilterService'\nimport {Service} from '../../icc-api/model/Service'\nimport {Contact} from '../../icc-api/model/Contact'\nimport {IntersectionFilter} from './IntersectionFilter'\nimport {UnionFilter} from './UnionFilter'\nimport {ComplementFilter} from './ComplementFilter'\nimport {PatientByHcPartyAndActiveFilter} from './PatientByHcPartyAndActiveFilter'\nimport {PatientByHcPartyAndAddressFilter} from './PatientByHcPartyAndAddressFilter'\nimport {PatientByHcPartyAndExternalIdFilter} from './PatientByHcPartyAndExternalIdFilter'\nimport {PatientByHcPartyAndSsinsFilter} from './PatientByHcPartyAndSsinsFilter'\nimport {PatientByHcPartyDateOfBirthBetweenFilter} from './PatientByHcPartyDateOfBirthBetweenFilter'\nimport {PatientByHcPartyDateOfBirthFilter} from './PatientByHcPartyDateOfBirthFilter'\n\nimport {add, format} from 'date-fns'\nimport {PatientByHcPartyFilter} from './PatientByHcPartyFilter'\nimport {PatientByHcPartyGenderEducationProfessionFilter} from './PatientByHcPartyGenderEducationProfessionFilter'\nimport {PatientByIdsFilter} from './PatientByIdsFilter'\nimport {PatientByHcPartyNameContainsFuzzyFilter} from './PatientByHcPartyNameContainsFuzzyFilter'\n\nimport GenderEnum = Patient.GenderEnum\nimport {ContactByHcPartyFilter} from './ContactByHcPartyFilter'\nimport {Device} from '../../icc-api/model/Device'\nimport {AbstractFilterDevice} from '../../icc-api/model/AbstractFilterDevice'\nimport {MaintenanceTask} from '../../icc-api/model/MaintenanceTask'\nimport {AbstractFilterMaintenanceTask} from '../../icc-api/model/AbstractFilterMaintenanceTask'\nimport {Code} from '../../icc-api/model/Code'\nimport {AbstractFilterCode} from '../../icc-api/model/AbstractFilterCode'\nimport {HealthElement} from '../../icc-api/model/HealthElement'\nimport {AbstractFilterHealthElement} from '../../icc-api/model/AbstractFilterHealthElement'\nimport {Invoice} from '../../icc-api/model/Invoice'\nimport {AbstractFilterInvoice} from '../../icc-api/model/AbstractFilterInvoice'\nimport {User} from '../../icc-api/model/User'\nimport {AbstractFilterUser} from '../../icc-api/model/AbstractFilterUser'\nimport {HealthcareParty} from \"../../icc-api/model/HealthcareParty\"\nimport {AbstractFilterHealthcareParty} from \"../../icc-api/model/AbstractFilterHealthcareParty\"\n\nexport * from './AllCodesFilter'\nexport * from './AllDevicesFilter'\nexport * from './AllHealthcarePartiesFilter'\nexport * from './AllUsersFilter'\nexport * from './CodeByIdsFilter'\nexport * from './CodeByRegionTypeLabelLanguageFilter'\nexport * from './ComplementFilter'\nexport * from './ConstantFilter'\nexport * from './ContactByHcPartyFilter'\nexport * from './ContactByHcPartyPatientTagCodeDateFilter'\nexport * from './ContactByHcPartyTagCodeDateFilter'\nexport * from './ContactByServiceIdsFilter'\nexport * from './DeviceByHcPartyFilter'\nexport * from './DeviceByIdsFilter'\nexport * from './HealthElementByHcPartyFilter'\nexport * from './HealthElementByHcPartyIdentifiersFilter'\nexport * from './HealthElementByHcPartySecretForeignKeysFilter'\nexport * from './HealthElementByHcPartyTagCodeFilter'\nexport * from './HealthElementByIdsFilter'\nexport * from './HealthcarePartyByIdsFilter'\nexport * from './HealthcarePartyByNameFilter'\nexport * from './HealthcarePartyByTagCodeFilter'\nexport * from './IntersectionFilter'\nexport * from './InvoiceByHcPartyCodeDateFilter'\nexport * from './PatientByHcPartyAndActiveFilter'\nexport * from './PatientByHcPartyAndAddressFilter'\nexport * from './PatientByHcPartyAndExternalIdFilter'\nexport * from './PatientByHcPartyAndIdentifiersFilter'\nexport * from './PatientByHcPartyAndSsinFilter'\nexport * from './PatientByHcPartyAndSsinsFilter'\nexport * from './PatientByHcPartyDateOfBirthBetweenFilter'\nexport * from './PatientByHcPartyDateOfBirthFilter'\nexport * from './PatientByHcPartyFilter'\nexport * from './PatientByHcPartyGenderEducationProfessionFilter'\nexport * from './PatientByHcPartyNameContainsFuzzyFilter'\nexport * from './PatientByHcPartyNameFilter'\nexport * from './PatientByIdsFilter'\nexport * from './ServiceByContactsAndSubcontactsFilter'\nexport * from './ServiceByHcPartyFilter'\nexport * from './ServiceByHcPartyIdentifiersFilter'\nexport * from './ServiceByHcPartyHealthElementIdsFilter'\nexport * from './ServiceByHcPartyTagCodeDateFilter'\nexport * from './ServiceByIdsFilter'\nexport * from './ServiceBySecretForeignKeys'\nexport * from './UnionFilter'\nexport * from './UserByIdsFilter'\nexport * from './MaintenanceTaskByHcPartyAndIdentifiersFilter'\nexport * from './MaintenanceTaskByHcPartyAndTypeFilter'\nexport * from './MaintenanceTaskByIdsFilter'\nexport * from './MaintenanceTaskAfterDateFilter'\nexport * from './TopicByHcPartyFilter'\nexport * from './TopicByParticipantFilter'\nexport * from './MessageByHcPartyFilter'\nexport * from './MessageByHcPartyTransportGuidFilter'\nexport * from './LatestMessageByHcPartyTransportGuidFilter'\n\nexport class Filter {\n public static patient(): PatientFilterBuilder {\n return new PatientFilterBuilder()\n }\n}\n\nexport type AbstractFilter<T> =\n | (T extends Patient\n ? AbstractFilterPatient\n : T extends Contact\n ? AbstractFilterContact\n : T extends Service\n ? AbstractFilterService\n : T extends HealthcareParty\n ? AbstractFilterHealthcareParty\n : T extends Device\n ? AbstractFilterDevice\n : T extends MaintenanceTask\n ? AbstractFilterMaintenanceTask\n : T extends Code\n ? AbstractFilterCode\n : T extends HealthElement\n ? AbstractFilterHealthElement\n : T extends Invoice\n ? AbstractFilterInvoice\n : T extends User\n ? AbstractFilterUser\n : never)\n | ConstantFilter<T>\n | IntersectionFilter<T>\n | UnionFilter<T>\n | ComplementFilter<T>\n\nconst f: AbstractFilterContact = new ComplementFilter<Contact>(new ContactByHcPartyFilter({}), new ContactByHcPartyFilter({}))\n\nabstract class FilterBuilder<T> {\n // This is the current generator for the filter, when we call build(), filterProvider() is going to be called\n filterProvider?: () => AbstractFilter<T>\n // This is the method that is called each time we chain a filter to another filter. The default behaviour is to\n // return a FilterBuilder with the provider set to the last element in the chain, except when we use combination\n // operators like or()/and()/… . After one of those, the composer is set to a function that will return a FilterBuilder\n\n protected constructor(\n filterProvider?: () => AbstractFilter<T>,\n composer?: (thisFilterBuilder: FilterBuilder<T>, otherFilterBuilder: FilterBuilder<T>) => FilterBuilder<T>\n ) {\n this.filterProvider = filterProvider\n composer && (this.composer = composer)\n }\n\n // that combines the existing filterBuilder with the filter definition we just added.\n composer: (thisFilterBuilder: FilterBuilder<T>, otherFilterBuilder: FilterBuilder<T>) => FilterBuilder<T> = (\n thisFilterBuilder: FilterBuilder<T>,\n otherFilterBuilder: FilterBuilder<T>\n ) => otherFilterBuilder\n\n abstract build(): AbstractFilter<T>\n\n abstract clone(\n filterProvider?: () => AbstractFilter<T>,\n composer?: (thisFilterBuilder: FilterBuilder<T>, otherFilterBuilder: FilterBuilder<T>) => FilterBuilder<T>\n ): FilterBuilder<T>\n\n listOf(elements: T[]): FilterBuilder<T> {\n return this.clone(() => new ConstantFilter<T>(elements) as AbstractFilter<T>)\n }\n\n /**\n * There are two ways of doing and, or, …\n *\n * 1) for (...) or (...) we use the syntax ... .or((builder) => builder...)\n * ex: youngerThan(65).or((b) => b.olderThan(18).and().gender(M)) means any gender < 65 or male > 18\n * 2) for ((...) or ...) we use the syntax ... .or().…\n * ex: youngerThan(65).or().olderThan(18).and().gender(M) means males between 18 and 65\n *\n * When 1) is used we do not have to wait for anything to provide a resolved builder that can later be combined with extra elements in the chain.\n * In other words, we can build the current filter chain up to the or/and/… and we can build what is inside the or/and/… brackets and we can set\n * the filterProvider of the returned Builder to () => UnionFilter([leftHand.build(), innerBrackets.build()]).\n *\n * When 2) is used, things get more tricky because we will have to do an or/and/… between what we have on the leftHand and with what we do not have\n * yet on the right hand. What we do in that situation is to set the filterProvider() to undefined because calling build() without having provided a\n * rightHand doesn't make sense. We set a composer that is going to be called the next time we chain a filter.\n *\n * @param filterBuilderFactory\n */\n\n and(filterBuilderFactory?: (it: FilterBuilder<T>) => FilterBuilder<T>): FilterBuilder<T> {\n const combiner = (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () =>\n new IntersectionFilter<T>([leftHandFilter, rightHandFilter]) as AbstractFilter<T>\n\n return filterBuilderFactory ? this.makeEagerLeftRightFilterBuilder(filterBuilderFactory, combiner) : this.makeLazyLeftRightFilterBuilder(combiner)\n }\n\n or(filterBuilderFactory?: (it: FilterBuilder<T>) => FilterBuilder<T>): FilterBuilder<T> {\n const combiner = (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () =>\n new UnionFilter<T>([leftHandFilter, rightHandFilter]) as AbstractFilter<T>\n\n return filterBuilderFactory ? this.makeEagerLeftRightFilterBuilder(filterBuilderFactory, combiner) : this.makeLazyLeftRightFilterBuilder(combiner)\n }\n\n minus(filterBuilderFactory?: (it: FilterBuilder<T>) => FilterBuilder<T>): FilterBuilder<T> {\n const combiner = (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () =>\n new ComplementFilter<T>(leftHandFilter, rightHandFilter) as AbstractFilter<T>\n\n return filterBuilderFactory ? this.makeEagerLeftRightFilterBuilder(filterBuilderFactory, combiner) : this.makeLazyLeftRightFilterBuilder(combiner)\n }\n\n private makeLazyLeftRightFilterBuilder(\n leftHandRightHandFiltersCombiner: (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () => AbstractFilter<T>\n ) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const leftHandFilterBuilder: FilterBuilder<T> = this\n const leftHandFilter = leftHandFilterBuilder.build() // Freeze the leftHand filter\n\n return leftHandFilterBuilder.filterProvider\n ? this.clone(\n undefined, //filter provider is indeterminate until we have performed a composition\n (unused: FilterBuilder<T>, rightHandFilterBuilder: FilterBuilder<T>) => {\n // because we freeze the leftHand in the state it is right now, we are not going to use its value when the composition occurs\n const rightHandFilter = rightHandFilterBuilder.build()\n\n return rightHandFilter\n ? this.clone(leftHandRightHandFiltersCombiner(leftHandFilter, rightHandFilter), rightHandFilterBuilder.composer)\n : rightHandFilterBuilder //Can this happen ?\n }\n )\n : this\n }\n\n private makeEagerLeftRightFilterBuilder(\n rightHandFilterBuilderFactory: (it: FilterBuilder<T>) => FilterBuilder<T>,\n leftHandRightHandFiltersCombiner: (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () => AbstractFilter<T>\n ) {\n const rightHandFilterBuilder = rightHandFilterBuilderFactory(this)\n return this.filterProvider ? this.clone(leftHandRightHandFiltersCombiner(this.build(), rightHandFilterBuilder.build())) : this\n }\n}\n\nclass PatientFilterBuilder extends FilterBuilder<Patient> {\n hcpId?: string\n\n constructor(\n filterProvider?: () => AbstractFilter<Patient>,\n hcpId?: string,\n composer?: (thisFilterBuilder: FilterBuilder<Patient>, otherFilterBuilder: FilterBuilder<Patient>) => FilterBuilder<Patient>\n ) {\n super(filterProvider, composer)\n this.hcpId = hcpId\n }\n\n clone(\n filterProvider?: () => AbstractFilter<Patient>,\n composer?: (thisFilterBuilder: FilterBuilder<Patient>, otherFilterBuilder: FilterBuilder<Patient>) => FilterBuilder<Patient>\n ): FilterBuilder<Patient> {\n return new PatientFilterBuilder(filterProvider, this.hcpId, composer)\n }\n\n listOf(elements: Patient[]): PatientFilterBuilder {\n return new PatientFilterBuilder(() => new ConstantFilter<Patient>(elements) as AbstractFilter<Patient>)\n }\n\n and(filterBuilderFactory?: (it: PatientFilterBuilder) => PatientFilterBuilder): PatientFilterBuilder {\n return super.and(filterBuilderFactory as any) as PatientFilterBuilder\n }\n\n or(filterBuilderFactory?: (it: PatientFilterBuilder) => PatientFilterBuilder): PatientFilterBuilder {\n return super.or(filterBuilderFactory as any) as PatientFilterBuilder\n }\n\n minus(filterBuilderFactory?: (it: PatientFilterBuilder) => PatientFilterBuilder): PatientFilterBuilder {\n return super.minus(filterBuilderFactory as any) as PatientFilterBuilder\n }\n\n forHcp(hcpId: string): PatientFilterBuilder {\n return this.composer(this, new PatientFilterBuilder(this.filterProvider, hcpId)) as PatientFilterBuilder\n }\n\n all(): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyFilter({ healthcarePartyId: this.hcpId }), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n activePatients(): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyAndActiveFilter({healthcarePartyId: this.hcpId, active: true}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n inactivePatients(): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyAndActiveFilter({healthcarePartyId: this.hcpId, active: false}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n byAddress(searchString?: string, postalCode?: string, houseNumber?: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyAndAddressFilter({\n healthcarePartyId: this.hcpId,\n searchString,\n postalCode,\n houseNumber,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n withExternalId(externalId: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyAndExternalIdFilter({\n healthcarePartyId: this.hcpId,\n externalId: externalId,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n withSsins(ssins: string[]): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyAndSsinsFilter({healthcarePartyId: this.hcpId, ssins: ssins}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n withDateOfBirthBetween(from?: number, to?: number): PatientFilterBuilder {\n return this.composer(\n this,\n this.clone(\n () =>\n new PatientByHcPartyDateOfBirthBetweenFilter({\n healthcarePartyId: this.hcpId,\n minDateOfBirth: from,\n maxDateOfBirth: to,\n })\n )\n ) as PatientFilterBuilder\n }\n\n byDateOfBirth(dateOfBirth: number): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyDateOfBirthFilter({\n healthcarePartyId: this.hcpId,\n dateOfBirth: dateOfBirth,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n olderThan(age: number): PatientFilterBuilder {\n return this.withDateOfBirthBetween(10000101, parseInt(format(add(new Date(), {years: -age}), 'yyyyMMdd')))\n }\n\n youngerThan(age: number): PatientFilterBuilder {\n return this.withDateOfBirthBetween(parseInt(format(add(new Date(), {years: -age}), 'yyyyMMdd')), 99991231)\n }\n\n byGenderEducationProfession(gender?: GenderEnum, education?: string, profession?: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyGenderEducationProfessionFilter({\n healthcarePartyId: this.hcpId,\n gender: gender,\n education: education,\n profession: profession,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n byIds(ids: string[]): PatientFilterBuilder {\n return this.composer(this, new PatientFilterBuilder(() => new PatientByIdsFilter({ids: ids}), this.hcpId)) as PatientFilterBuilder\n }\n\n searchByName(name: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyNameContainsFuzzyFilter({\n healthcarePartyId: this.hcpId,\n searchString: name,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n build(): AbstractFilter<Patient> {\n return this.filterProvider?.() || this.all().build()\n }\n}\n"]}
@@ -16,13 +16,14 @@ export interface AccessLogWithPatientId extends AccessLog {
16
16
  patientId: string;
17
17
  }
18
18
  export declare class IccAccesslogXApi extends IccAccesslogApi implements EncryptedEntityXApi<models.AccessLog> {
19
+ private readonly autofillAuthor;
19
20
  private readonly encryptedFields;
20
21
  crypto: IccCryptoXApi;
21
22
  dataOwnerApi: IccDataOwnerXApi;
22
23
  get headers(): Promise<Array<XHR.Header>>;
23
24
  constructor(host: string, headers: {
24
25
  [key: string]: string;
25
- }, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, cryptedKeys?: string[], authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
26
+ }, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, autofillAuthor: boolean, cryptedKeys?: string[], authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
26
27
  /**
27
28
  * Creates a new instance of access log with initialised encryption metadata (not in the database).
28
29
  * @param user the current user.
@@ -155,4 +156,5 @@ export declare class IccAccesslogXApi extends IccAccesslogApi implements Encrypt
155
156
  hasUnknownAnonymousDataOwners: boolean;
156
157
  }>;
157
158
  getEncryptionKeysOf(entity: AccessLog): Promise<string[]>;
159
+ createDelegationDeAnonymizationMetadata(entity: AccessLog, delegates: string[]): Promise<void>;
158
160
  }
@@ -21,12 +21,13 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
21
21
  get headers() {
22
22
  return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'AccessLog'));
23
23
  }
24
- constructor(host, headers, crypto, dataOwnerApi, cryptedKeys = ['detail', 'objectId'], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
24
+ constructor(host, headers, crypto, dataOwnerApi, autofillAuthor, cryptedKeys = ['detail', 'objectId'], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
25
25
  ? window.fetch
26
26
  : typeof self !== 'undefined'
27
27
  ? self.fetch
28
28
  : fetch) {
29
29
  super(host, headers, authenticationProvider, fetchImpl);
30
+ this.autofillAuthor = autofillAuthor;
30
31
  this.crypto = crypto;
31
32
  this.dataOwnerApi = dataOwnerApi;
32
33
  this.encryptedFields = (0, utils_1.parseEncryptedFields)(cryptedKeys, 'AccessLog.');
@@ -49,7 +50,7 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
49
50
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
50
51
  return __awaiter(this, void 0, void 0, function* () {
51
52
  const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user);
52
- const accessLog = Object.assign(Object.assign({}, (h !== null && h !== void 0 ? h : {})), { _type: 'org.taktik.icure.entities.AccessLog', id: (_a = h === null || h === void 0 ? void 0 : h.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = h === null || h === void 0 ? void 0 : h.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = h === null || h === void 0 ? void 0 : h.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), date: (_d = h === null || h === void 0 ? void 0 : h.date) !== null && _d !== void 0 ? _d : new Date().getTime(), responsible: (_e = h === null || h === void 0 ? void 0 : h.responsible) !== null && _e !== void 0 ? _e : dataOwnerId, author: (_f = h === null || h === void 0 ? void 0 : h.author) !== null && _f !== void 0 ? _f : user.id, codes: (_g = h === null || h === void 0 ? void 0 : h.codes) !== null && _g !== void 0 ? _g : [], tags: (_h = h === null || h === void 0 ? void 0 : h.tags) !== null && _h !== void 0 ? _h : [], user: (_j = h === null || h === void 0 ? void 0 : h.user) !== null && _j !== void 0 ? _j : user.id, patientId: (_k = h === null || h === void 0 ? void 0 : h.patientId) !== null && _k !== void 0 ? _k : patient.id, accessType: (_l = h === null || h === void 0 ? void 0 : h.accessType) !== null && _l !== void 0 ? _l : 'USER_ACCESS' });
53
+ const accessLog = Object.assign(Object.assign({}, (h !== null && h !== void 0 ? h : {})), { _type: 'org.taktik.icure.entities.AccessLog', id: (_a = h === null || h === void 0 ? void 0 : h.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = h === null || h === void 0 ? void 0 : h.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = h === null || h === void 0 ? void 0 : h.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), date: (_d = h === null || h === void 0 ? void 0 : h.date) !== null && _d !== void 0 ? _d : new Date().getTime(), responsible: (_e = h === null || h === void 0 ? void 0 : h.responsible) !== null && _e !== void 0 ? _e : (this.autofillAuthor ? dataOwnerId : undefined), author: (_f = h === null || h === void 0 ? void 0 : h.author) !== null && _f !== void 0 ? _f : (this.autofillAuthor ? user.id : undefined), codes: (_g = h === null || h === void 0 ? void 0 : h.codes) !== null && _g !== void 0 ? _g : [], tags: (_h = h === null || h === void 0 ? void 0 : h.tags) !== null && _h !== void 0 ? _h : [], user: (_j = h === null || h === void 0 ? void 0 : h.user) !== null && _j !== void 0 ? _j : user.id, patientId: (_k = h === null || h === void 0 ? void 0 : h.patientId) !== null && _k !== void 0 ? _k : patient.id, accessType: (_l = h === null || h === void 0 ? void 0 : h.accessType) !== null && _l !== void 0 ? _l : 'USER_ACCESS' });
53
54
  const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
54
55
  if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
55
56
  throw new Error('Can only initialise entities as current data owner.');
@@ -290,11 +291,14 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
290
291
  });
291
292
  }
292
293
  getDataOwnersWithAccessTo(entity) {
293
- return this.crypto.xapi.getDataOwnersWithAccessTo({ entity, type: 'AccessLog' });
294
+ return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: 'AccessLog' });
294
295
  }
295
296
  getEncryptionKeysOf(entity) {
296
297
  return this.crypto.xapi.encryptionKeysOf({ entity, type: 'AccessLog' }, undefined);
297
298
  }
299
+ createDelegationDeAnonymizationMetadata(entity, delegates) {
300
+ return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: 'AccessLog' }, delegates);
301
+ }
298
302
  }
299
303
  exports.IccAccesslogXApi = IccAccesslogXApi;
300
304
  //# sourceMappingURL=icc-accesslog-x-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"icc-accesslog-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-accesslog-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA4C;AAG5C,oDAA2E;AAC3E,4BAA2B;AAE3B,0EAAgG;AAChG,wEAAoE;AACpE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAMzD,mCAAuE;AAOvE,MAAa,gBAAiB,SAAQ,yBAAe;IAKnD,IAAI,OAAO;QACT,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,2BAA2B,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAA;IACpH,CAAC;IAED,YACE,IAAY,EACZ,OAAkC,EAClC,MAAqB,EACrB,YAA8B,EAC9B,WAAW,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,EACpC,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,KAAK;QAET,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAA;QACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAChC,IAAI,CAAC,eAAe,GAAG,IAAA,4BAAoB,EAAC,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nimport * as models from '../icc-api/model/models'\nimport { AccessLog, PaginatedListAccessLog } from '../icc-api/model/models'\nimport * as _ from 'lodash'\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 { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { ShareResult } from './utils/ShareResult'\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedFieldsManifest, parseEncryptedFields } from './utils'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\n\nexport interface AccessLogWithPatientId extends AccessLog {\n patientId: string\n}\n\nexport class IccAccesslogXApi extends IccAccesslogApi implements EncryptedEntityXApi<models.AccessLog> {\n private readonly encryptedFields: EncryptedFieldsManifest\n crypto: IccCryptoXApi\n dataOwnerApi: IccDataOwnerXApi\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'AccessLog'))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\n cryptedKeys = ['detail', 'objectId'],\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(cryptedKeys, 'AccessLog.')\n }\n\n /**\n * Creates a new instance of access log with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this access log refers to.\n * @param h initialised data for the access log. 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 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 access log.\n */\n async newInstance(\n user: models.User,\n patient: models.Patient,\n h: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n preferredSfk?: string\n } = {}\n ) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n\n const accessLog = {\n ...(h ?? {}),\n _type: 'org.taktik.icure.entities.AccessLog',\n id: h?.id ?? this.crypto.primitives.randomUuid(),\n created: h?.created ?? new Date().getTime(),\n modified: h?.modified ?? new Date().getTime(),\n date: h?.date ?? new Date().getTime(),\n responsible: h?.responsible ?? dataOwnerId,\n author: h?.author ?? user.id,\n codes: h?.codes ?? [],\n tags: h?.tags ?? [],\n user: h?.user ?? user.id,\n patientId: h?.patientId ?? patient.id,\n accessType: h?.accessType ?? 'USER_ACCESS',\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 = options.preferredSfk ?? (await this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: patient, type: 'Patient' }))\n if (!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?.administrativeData ?? [])].map((x) => [x, AccessLevelEnum.WRITE])\n ),\n ...(options.additionalDelegates ?? {}),\n }\n return new AccessLog(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(accessLog, 'AccessLog', patient.id, sfk, true, false, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * 1. Check whether there is a delegation with 'hcpartyId' or not.\n * 2. 'fetchHcParty[hcpartyId][1]': is encrypted AES exchange key by RSA public key of him.\n * 3. Obtain the AES exchange key, by decrypting the previous step value with hcparty private key\n * 3.1. KeyPair should be fetch from cache (in jwk)\n * 3.2. if it doesn't exist in the cache, it has to be loaded from Browser Local store, and then import it to WebCrypto\n * 4. Obtain the array of delegations which are delegated to his ID (hcpartyId) in this patient\n * 5. Decrypt and collect all keys (secretForeignKeys) within delegations of previous step (with obtained AES key of step 4)\n * 6. Do the REST call to get all helements with (allSecretForeignKeysDelimitedByComa, hcpartyId)\n *\n * After these painful steps, you have the helements of the patient.\n *\n * @param hcpartyId\n * @param patient (Promise)\n * @param keepObsoleteVersions\n * @param usingPost\n */\n\n async findBy(hcpartyId: string, patient: models.Patient, usingPost: boolean = false): Promise<models.AccessLog[]> {\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<AccessLog[]> {\n const accessLogs = await super.findAccessLogsByHCPartyPatientForeignKeys(hcPartyId, secretFKeys)\n return await this.decrypt(hcPartyId, accessLogs)\n }\n\n findByHCPartyPatientSecretFKeysArray(hcPartyId: string, secretFKeys: string[]): Promise<Array<AccessLog> | any> {\n return super.findAccessLogsByHCPartyPatientForeignKeysUsingPost(hcPartyId, secretFKeys).then((accesslogs) => this.decrypt(hcPartyId, accesslogs))\n }\n\n decrypt(hcpId: string, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n return Promise.all(\n accessLogs.map((x) => this.crypto.xapi.decryptEntity(x, 'AccessLog', (json) => new AccessLog(json)).then(({ entity }) => entity))\n )\n }\n\n encrypt(user: models.User, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n const owner = this.dataOwnerApi.getDataOwnerIdOf(user)\n return this.encryptAs(owner, accessLogs)\n }\n\n private encryptAs(dataOwner: string, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n return Promise.all(\n accessLogs.map((x) => this.crypto.xapi.tryEncryptEntity(x, 'AccessLog', this.encryptedFields, false, false, (json) => new AccessLog(json)))\n )\n }\n\n createAccessLog(body?: models.AccessLog): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n createAccessLogWithUser(user: models.User, body?: models.AccessLog): Promise<models.AccessLog | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((als) => super.createAccessLog(als[0]))\n .then((accessLog) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [accessLog]))\n .then((als) => als[0])\n : Promise.resolve()\n }\n\n getAccessLog(accessLogId: string): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n getAccessLogWithUser(user: models.User, accessLogId: string): Promise<models.AccessLog | any> {\n return super\n .getAccessLog(accessLogId)\n .then((accessLog) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [accessLog]))\n .then((als) => als[0])\n }\n\n listAccessLogs(fromEpoch?: number, toEpoch?: number, startKey?: number, startDocumentId?: string, limit?: number): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n listAccessLogsWithUser(\n user: models.User,\n fromEpoch?: number,\n toEpoch?: number,\n startKey?: number,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): Promise<PaginatedListAccessLog> {\n return super\n .listAccessLogs(fromEpoch, toEpoch, startKey, startDocumentId, limit, descending)\n .then((accessLog) =>\n this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLog.rows!).then((dr) => Object.assign(accessLog, { rows: dr }))\n )\n }\n\n modifyAccessLog(body?: models.AccessLog): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n async modifyAccessLogWithUser(user: models.User, body?: models.AccessLog): Promise<models.AccessLog | null> {\n return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, _.cloneDeep(body)) : null\n }\n\n private async modifyAs(owner: string, body: models.AccessLog): Promise<models.AccessLog> {\n return this.encryptAs(owner, [_.cloneDeep(body)])\n .then((als) => super.modifyAccessLog(als[0]))\n .then((accessLog) => this.decrypt(owner, [accessLog]))\n .then((als) => als[0])\n }\n\n findByUserAfterDate(\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n findByUserAfterDateWithUser(\n user: models.User,\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): Promise<models.AccessLog | any> {\n return super\n .findByUserAfterDate(userId, accessType, startDate, startKey, startDocumentId, limit, descending)\n .then((accessLog) =>\n this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLog.rows!).then((dr) => Object.assign(accessLog, { rows: dr }))\n )\n }\n\n async findLatestAccessLogsOfPatientsWithUser(user: models.User, userId: string, limit = 100, startDate?: number): Promise<models.AccessLog[]> {\n let foundAccessLogs: AccessLogWithPatientId[] = [],\n nextKeyPair: models.PaginatedDocumentKeyIdPairObject | undefined = undefined\n const numberRequestedAccessLogs = 100\n const MAX_WHILE_ITERATIONS = 5\n\n for (let currentIteration = 0; foundAccessLogs.length < limit && currentIteration < MAX_WHILE_ITERATIONS; currentIteration++) {\n const currentLimit = limit - foundAccessLogs.length\n const { rows: logs, nextKeyPair: newNextKeyPair }: models.PaginatedListAccessLog = (await super.findByUserAfterDate(\n userId,\n 'USER_ACCESS',\n startDate,\n nextKeyPair && JSON.stringify(nextKeyPair.startKey!),\n nextKeyPair && nextKeyPair.startKeyDocId!,\n numberRequestedAccessLogs,\n true\n )) as models.PaginatedListAccessLog\n const logsWithPatientId: AccessLogWithPatientId[] = await this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, logs as AccessLog[]).then(\n (decryptedLogs) =>\n Promise.all(\n _.map(decryptedLogs, (decryptedLog) => {\n return this.crypto.xapi.owningEntityIdsOf({ entity: decryptedLog, type: 'AccessLog' }, user.healthcarePartyId as string).then(\n (keys) =>\n ({\n ...decryptedLog,\n patientId: _.head(keys),\n } as AccessLogWithPatientId)\n )\n })\n )\n )\n\n const uniqueLogs: AccessLogWithPatientId[] = _.chain(logsWithPatientId)\n .reject((log) => _.some(foundAccessLogs, ({ patientId }) => patientId === log.patientId))\n .uniqBy((log: AccessLogWithPatientId) => log.patientId)\n .value()\n .slice(0, currentLimit)\n\n foundAccessLogs = [...foundAccessLogs, ...uniqueLogs]\n\n if ((logs || []).length < numberRequestedAccessLogs) {\n break\n } else if (newNextKeyPair) {\n nextKeyPair = newNextKeyPair\n } else {\n break\n }\n }\n\n return foundAccessLogs\n }\n\n /**\n * @param accessLog an access log\n * @return the id of the patient that the access log refers to, retrieved from the encrypted metadata (not from the decrypted entity body). Normally\n * there should only be one element in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(accessLog: AccessLog): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: accessLog, type: 'AccessLog' }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given access log\n */\n async hasWriteAccess(accessLog: AccessLog): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: accessLog, type: 'AccessLog' })\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * 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 access log.\n * @param accessLog the access log 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}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@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 shareWith(\n delegateId: string,\n accessLog: AccessLog,\n options: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<AccessLog> {\n return this.shareWithMany(accessLog, { [delegateId]: options })\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param accessLog the access log 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}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@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 accessLog: AccessLog,\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<AccessLog> {\n return (await this.tryShareWithMany(accessLog, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param accessLog the access log 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}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@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 tryShareWithMany(\n accessLog: AccessLog,\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<AccessLog>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(accessLog, 'AccessLog')\n const updatedEntity = entityWithEncryptionKey ? await this.modifyAs(self, entityWithEncryptionKey) : accessLog\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n { entity: updatedEntity, type: 'AccessLog' },\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.bulkShareAccessLogs(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: AccessLog\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.xapi.getDataOwnersWithAccessTo({ entity, type: 'AccessLog' })\n }\n\n getEncryptionKeysOf(entity: AccessLog): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: 'AccessLog' }, undefined)\n }\n}\n"]}
1
+ {"version":3,"file":"icc-accesslog-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-accesslog-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA4C;AAG5C,oDAA2E;AAC3E,4BAA2B;AAE3B,0EAAgG;AAChG,wEAAoE;AACpE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAMzD,mCAAuE;AAOvE,MAAa,gBAAiB,SAAQ,yBAAe;IAKnD,IAAI,OAAO;QACT,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,2BAA2B,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAA;IACpH,CAAC;IAED,YACE,IAAY,EACZ,OAAkC,EAClC,MAAqB,EACrB,YAA8B,EACb,cAAuB,EACxC,WAAW,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,EACpC,yBAAi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I,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACvF,CAAC;KAAA;IAED,yBAAyB,CACvB,MAAiB;QAEjB,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,yBAAyB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAA;IACxG,CAAC;IAED,mBAAmB,CAAC,MAAiB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,SAAS,CAAC,CAAA;IACpF,CAAC;IAED,uCAAuC,CAAC,MAAiB,EAAE,SAAmB;QAC5E,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,iCAAiC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,SAAS,CAAC,CAAA;IAC3H,CAAC;CACF;AA3ZD,4CA2ZC","sourcesContent":["import { IccAccesslogApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport * as models from '../icc-api/model/models'\nimport { AccessLog, PaginatedListAccessLog } from '../icc-api/model/models'\nimport * as _ from 'lodash'\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 { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { ShareResult } from './utils/ShareResult'\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedFieldsManifest, parseEncryptedFields } from './utils'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\n\nexport interface AccessLogWithPatientId extends AccessLog {\n patientId: string\n}\n\nexport class IccAccesslogXApi extends IccAccesslogApi implements EncryptedEntityXApi<models.AccessLog> {\n private readonly encryptedFields: EncryptedFieldsManifest\n crypto: IccCryptoXApi\n dataOwnerApi: IccDataOwnerXApi\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'AccessLog'))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\n private readonly autofillAuthor: boolean,\n cryptedKeys = ['detail', 'objectId'],\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(cryptedKeys, 'AccessLog.')\n }\n\n /**\n * Creates a new instance of access log with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this access log refers to.\n * @param h initialised data for the access log. 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 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 access log.\n */\n async newInstance(\n user: models.User,\n patient: models.Patient,\n h: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n preferredSfk?: string\n } = {}\n ) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n\n const accessLog = {\n ...(h ?? {}),\n _type: 'org.taktik.icure.entities.AccessLog',\n id: h?.id ?? this.crypto.primitives.randomUuid(),\n created: h?.created ?? new Date().getTime(),\n modified: h?.modified ?? new Date().getTime(),\n date: h?.date ?? new Date().getTime(),\n responsible: h?.responsible ?? (this.autofillAuthor ? dataOwnerId : undefined),\n author: h?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: h?.codes ?? [],\n tags: h?.tags ?? [],\n user: h?.user ?? user.id,\n patientId: h?.patientId ?? patient.id,\n accessType: h?.accessType ?? 'USER_ACCESS',\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 = options.preferredSfk ?? (await this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: patient, type: 'Patient' }))\n if (!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?.administrativeData ?? [])].map((x) => [x, AccessLevelEnum.WRITE])\n ),\n ...(options.additionalDelegates ?? {}),\n }\n return new AccessLog(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(accessLog, 'AccessLog', patient.id, sfk, true, false, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * 1. Check whether there is a delegation with 'hcpartyId' or not.\n * 2. 'fetchHcParty[hcpartyId][1]': is encrypted AES exchange key by RSA public key of him.\n * 3. Obtain the AES exchange key, by decrypting the previous step value with hcparty private key\n * 3.1. KeyPair should be fetch from cache (in jwk)\n * 3.2. if it doesn't exist in the cache, it has to be loaded from Browser Local store, and then import it to WebCrypto\n * 4. Obtain the array of delegations which are delegated to his ID (hcpartyId) in this patient\n * 5. Decrypt and collect all keys (secretForeignKeys) within delegations of previous step (with obtained AES key of step 4)\n * 6. Do the REST call to get all helements with (allSecretForeignKeysDelimitedByComa, hcpartyId)\n *\n * After these painful steps, you have the helements of the patient.\n *\n * @param hcpartyId\n * @param patient (Promise)\n * @param keepObsoleteVersions\n * @param usingPost\n */\n\n async findBy(hcpartyId: string, patient: models.Patient, usingPost: boolean = false): Promise<models.AccessLog[]> {\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<AccessLog[]> {\n const accessLogs = await super.findAccessLogsByHCPartyPatientForeignKeys(hcPartyId, secretFKeys)\n return await this.decrypt(hcPartyId, accessLogs)\n }\n\n findByHCPartyPatientSecretFKeysArray(hcPartyId: string, secretFKeys: string[]): Promise<Array<AccessLog> | any> {\n return super.findAccessLogsByHCPartyPatientForeignKeysUsingPost(hcPartyId, secretFKeys).then((accesslogs) => this.decrypt(hcPartyId, accesslogs))\n }\n\n decrypt(hcpId: string, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n return Promise.all(\n accessLogs.map((x) => this.crypto.xapi.decryptEntity(x, 'AccessLog', (json) => new AccessLog(json)).then(({ entity }) => entity))\n )\n }\n\n encrypt(user: models.User, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n const owner = this.dataOwnerApi.getDataOwnerIdOf(user)\n return this.encryptAs(owner, accessLogs)\n }\n\n private encryptAs(dataOwner: string, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n return Promise.all(\n accessLogs.map((x) => this.crypto.xapi.tryEncryptEntity(x, 'AccessLog', this.encryptedFields, false, false, (json) => new AccessLog(json)))\n )\n }\n\n createAccessLog(body?: models.AccessLog): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n createAccessLogWithUser(user: models.User, body?: models.AccessLog): Promise<models.AccessLog | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((als) => super.createAccessLog(als[0]))\n .then((accessLog) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [accessLog]))\n .then((als) => als[0])\n : Promise.resolve()\n }\n\n getAccessLog(accessLogId: string): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n getAccessLogWithUser(user: models.User, accessLogId: string): Promise<models.AccessLog | any> {\n return super\n .getAccessLog(accessLogId)\n .then((accessLog) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [accessLog]))\n .then((als) => als[0])\n }\n\n listAccessLogs(fromEpoch?: number, toEpoch?: number, startKey?: number, startDocumentId?: string, limit?: number): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n listAccessLogsWithUser(\n user: models.User,\n fromEpoch?: number,\n toEpoch?: number,\n startKey?: number,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): Promise<PaginatedListAccessLog> {\n return super\n .listAccessLogs(fromEpoch, toEpoch, startKey, startDocumentId, limit, descending)\n .then((accessLog) =>\n this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLog.rows!).then((dr) => Object.assign(accessLog, { rows: dr }))\n )\n }\n\n modifyAccessLog(body?: models.AccessLog): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n async modifyAccessLogWithUser(user: models.User, body?: models.AccessLog): Promise<models.AccessLog | null> {\n return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, _.cloneDeep(body)) : null\n }\n\n private async modifyAs(owner: string, body: models.AccessLog): Promise<models.AccessLog> {\n return this.encryptAs(owner, [_.cloneDeep(body)])\n .then((als) => super.modifyAccessLog(als[0]))\n .then((accessLog) => this.decrypt(owner, [accessLog]))\n .then((als) => als[0])\n }\n\n findByUserAfterDate(\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n findByUserAfterDateWithUser(\n user: models.User,\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): Promise<models.AccessLog | any> {\n return super\n .findByUserAfterDate(userId, accessType, startDate, startKey, startDocumentId, limit, descending)\n .then((accessLog) =>\n this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLog.rows!).then((dr) => Object.assign(accessLog, { rows: dr }))\n )\n }\n\n async findLatestAccessLogsOfPatientsWithUser(user: models.User, userId: string, limit = 100, startDate?: number): Promise<models.AccessLog[]> {\n let foundAccessLogs: AccessLogWithPatientId[] = [],\n nextKeyPair: models.PaginatedDocumentKeyIdPairObject | undefined = undefined\n const numberRequestedAccessLogs = 100\n const MAX_WHILE_ITERATIONS = 5\n\n for (let currentIteration = 0; foundAccessLogs.length < limit && currentIteration < MAX_WHILE_ITERATIONS; currentIteration++) {\n const currentLimit = limit - foundAccessLogs.length\n const { rows: logs, nextKeyPair: newNextKeyPair }: models.PaginatedListAccessLog = (await super.findByUserAfterDate(\n userId,\n 'USER_ACCESS',\n startDate,\n nextKeyPair && JSON.stringify(nextKeyPair.startKey!),\n nextKeyPair && nextKeyPair.startKeyDocId!,\n numberRequestedAccessLogs,\n true\n )) as models.PaginatedListAccessLog\n const logsWithPatientId: AccessLogWithPatientId[] = await this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, logs as AccessLog[]).then(\n (decryptedLogs) =>\n Promise.all(\n _.map(decryptedLogs, (decryptedLog) => {\n return this.crypto.xapi.owningEntityIdsOf({ entity: decryptedLog, type: 'AccessLog' }, user.healthcarePartyId as string).then(\n (keys) =>\n ({\n ...decryptedLog,\n patientId: _.head(keys),\n } as AccessLogWithPatientId)\n )\n })\n )\n )\n\n const uniqueLogs: AccessLogWithPatientId[] = _.chain(logsWithPatientId)\n .reject((log) => _.some(foundAccessLogs, ({ patientId }) => patientId === log.patientId))\n .uniqBy((log: AccessLogWithPatientId) => log.patientId)\n .value()\n .slice(0, currentLimit)\n\n foundAccessLogs = [...foundAccessLogs, ...uniqueLogs]\n\n if ((logs || []).length < numberRequestedAccessLogs) {\n break\n } else if (newNextKeyPair) {\n nextKeyPair = newNextKeyPair\n } else {\n break\n }\n }\n\n return foundAccessLogs\n }\n\n /**\n * @param accessLog an access log\n * @return the id of the patient that the access log refers to, retrieved from the encrypted metadata (not from the decrypted entity body). Normally\n * there should only be one element in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(accessLog: AccessLog): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: accessLog, type: 'AccessLog' }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given access log\n */\n async hasWriteAccess(accessLog: AccessLog): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: accessLog, type: 'AccessLog' })\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * 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 access log.\n * @param accessLog the access log 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}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@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 shareWith(\n delegateId: string,\n accessLog: AccessLog,\n options: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<AccessLog> {\n return this.shareWithMany(accessLog, { [delegateId]: options })\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param accessLog the access log 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}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@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 accessLog: AccessLog,\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<AccessLog> {\n return (await this.tryShareWithMany(accessLog, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param accessLog the access log 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}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@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 tryShareWithMany(\n accessLog: AccessLog,\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<AccessLog>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(accessLog, 'AccessLog')\n const updatedEntity = entityWithEncryptionKey ? await this.modifyAs(self, entityWithEncryptionKey) : accessLog\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n { entity: updatedEntity, type: 'AccessLog' },\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.bulkShareAccessLogs(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: AccessLog\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: 'AccessLog' })\n }\n\n getEncryptionKeysOf(entity: AccessLog): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: 'AccessLog' }, undefined)\n }\n\n createDelegationDeAnonymizationMetadata(entity: AccessLog, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: 'AccessLog' }, delegates)\n }\n}\n"]}
@@ -13,6 +13,7 @@ import AccessLevelEnum = SecureDelegation.AccessLevelEnum;
13
13
  import { XHR } from '../icc-api/api/XHR';
14
14
  import { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi';
15
15
  export declare class IccCalendarItemXApi extends IccCalendarItemApi implements EncryptedEntityXApi<models.CalendarItem> {
16
+ private readonly autofillAuthor;
16
17
  i18n: any;
17
18
  crypto: IccCryptoXApi;
18
19
  dataOwnerApi: IccDataOwnerXApi;
@@ -20,7 +21,7 @@ export declare class IccCalendarItemXApi extends IccCalendarItemApi implements E
20
21
  get headers(): Promise<Array<XHR.Header>>;
21
22
  constructor(host: string, headers: {
22
23
  [key: string]: string;
23
- }, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, encryptedKeys?: Array<string>, authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
24
+ }, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, autofillAuthor: boolean, encryptedKeys?: Array<string>, authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
24
25
  newInstance(user: User, ci: any | CalendarItem, options?: {
25
26
  additionalDelegates?: {
26
27
  [dataOwnerId: string]: AccessLevelEnum;
@@ -166,4 +167,5 @@ export declare class IccCalendarItemXApi extends IccCalendarItemApi implements E
166
167
  * @return the updated calendar item
167
168
  */
168
169
  linkToPatient(calendarItem: models.CalendarItem, patient: models.Patient, shareLinkWithDelegates: string[]): Promise<models.CalendarItem>;
170
+ createDelegationDeAnonymizationMetadata(entity: CalendarItem, delegates: string[]): Promise<void>;
169
171
  }
@@ -35,12 +35,13 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
35
35
  get headers() {
36
36
  return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'CalendarItem'));
37
37
  }
38
- constructor(host, headers, crypto, dataOwnerApi, encryptedKeys = ['details', 'title', 'patientId'], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
38
+ constructor(host, headers, crypto, dataOwnerApi, autofillAuthor, encryptedKeys = ['details', 'title', 'patientId'], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
39
39
  ? window.fetch
40
40
  : typeof self !== 'undefined'
41
41
  ? self.fetch
42
42
  : fetch) {
43
43
  super(host, headers, authenticationProvider, fetchImpl);
44
+ this.autofillAuthor = autofillAuthor;
44
45
  this.i18n = i18n;
45
46
  this.crypto = crypto;
46
47
  this.dataOwnerApi = dataOwnerApi;
@@ -68,7 +69,7 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
68
69
  return __awaiter(this, void 0, void 0, function* () {
69
70
  if (!patient && options.preferredSfk)
70
71
  throw new Error('You need to specify parent patient in order to use secret foreign keys.');
71
- 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 : [] });
72
73
  const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
73
74
  if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
74
75
  throw new Error('Can only initialise entities as current data owner.');
@@ -288,7 +289,7 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
288
289
  });
289
290
  }
290
291
  getDataOwnersWithAccessTo(entity) {
291
- return this.crypto.xapi.getDataOwnersWithAccessTo({ entity, type: 'CalendarItem' });
292
+ return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: 'CalendarItem' });
292
293
  }
293
294
  getEncryptionKeysOf(entity) {
294
295
  return this.crypto.xapi.encryptionKeysOf({ entity, type: 'CalendarItem' }, undefined);
@@ -339,6 +340,9 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
339
340
  return (yield this.decrypt(self, [withSfk]))[0];
340
341
  });
341
342
  }
343
+ createDelegationDeAnonymizationMetadata(entity, delegates) {
344
+ return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: 'CalendarItem' }, delegates);
345
+ }
342
346
  }
343
347
  exports.IccCalendarItemXApi = IccCalendarItemXApi;
344
348
  //# sourceMappingURL=icc-calendar-item-x-api.js.map