@icure/api 7.1.14 → 8.0.0-RC.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. package/icc-api/api/IccAccesslogApi.d.ts +12 -1
  2. package/icc-api/api/IccAccesslogApi.js +142 -98
  3. package/icc-api/api/IccAccesslogApi.js.map +1 -1
  4. package/icc-api/api/IccBemikronoApi.d.ts +81 -0
  5. package/icc-api/api/IccBemikronoApi.js +163 -0
  6. package/icc-api/api/IccBemikronoApi.js.map +1 -0
  7. package/icc-api/api/IccCalendarItemApi.d.ts +21 -1
  8. package/icc-api/api/IccCalendarItemApi.js +183 -117
  9. package/icc-api/api/IccCalendarItemApi.js.map +1 -1
  10. package/icc-api/api/IccClassificationApi.d.ts +21 -1
  11. package/icc-api/api/IccClassificationApi.js +119 -63
  12. package/icc-api/api/IccClassificationApi.js.map +1 -1
  13. package/icc-api/api/IccContactApi.d.ts +21 -1
  14. package/icc-api/api/IccContactApi.js +385 -294
  15. package/icc-api/api/IccContactApi.js.map +1 -1
  16. package/icc-api/api/IccDocumentApi.d.ts +32 -25
  17. package/icc-api/api/IccDocumentApi.js +264 -212
  18. package/icc-api/api/IccDocumentApi.js.map +1 -1
  19. package/icc-api/api/IccExchangeDataApi.d.ts +19 -0
  20. package/icc-api/api/IccExchangeDataApi.js +85 -0
  21. package/icc-api/api/IccExchangeDataApi.js.map +1 -0
  22. package/icc-api/api/IccExchangeDataMapApi.d.ts +18 -0
  23. package/icc-api/api/IccExchangeDataMapApi.js +65 -0
  24. package/icc-api/api/IccExchangeDataMapApi.js.map +1 -0
  25. package/icc-api/api/IccFormApi.d.ts +21 -1
  26. package/icc-api/api/IccFormApi.js +321 -229
  27. package/icc-api/api/IccFormApi.js.map +1 -1
  28. package/icc-api/api/IccHelementApi.d.ts +21 -1
  29. package/icc-api/api/IccHelementApi.js +207 -137
  30. package/icc-api/api/IccHelementApi.js.map +1 -1
  31. package/icc-api/api/IccInvoiceApi.d.ts +21 -1
  32. package/icc-api/api/IccInvoiceApi.js +404 -298
  33. package/icc-api/api/IccInvoiceApi.js.map +1 -1
  34. package/icc-api/api/IccMaintenanceTaskApi.d.ts +12 -1
  35. package/icc-api/api/IccMaintenanceTaskApi.js +79 -43
  36. package/icc-api/api/IccMaintenanceTaskApi.js.map +1 -1
  37. package/icc-api/api/IccMessageApi.d.ts +12 -1
  38. package/icc-api/api/IccMessageApi.js +257 -191
  39. package/icc-api/api/IccMessageApi.js.map +1 -1
  40. package/icc-api/api/IccPatientApi.d.ts +12 -1
  41. package/icc-api/api/IccPatientApi.js +447 -351
  42. package/icc-api/api/IccPatientApi.js.map +1 -1
  43. package/icc-api/api/IccReceiptApi.d.ts +22 -8
  44. package/icc-api/api/IccReceiptApi.js +121 -64
  45. package/icc-api/api/IccReceiptApi.js.map +1 -1
  46. package/icc-api/api/IccRestApiPath.js +1 -1
  47. package/icc-api/api/IccRestApiPath.js.map +1 -1
  48. package/icc-api/api/IccTimeTableApi.d.ts +12 -1
  49. package/icc-api/api/IccTimeTableApi.js +86 -48
  50. package/icc-api/api/IccTimeTableApi.js.map +1 -1
  51. package/icc-api/index.d.ts +1 -0
  52. package/icc-api/index.js +1 -0
  53. package/icc-api/index.js.map +1 -1
  54. package/icc-api/model/AccessLog.d.ts +4 -0
  55. package/icc-api/model/AccessLog.js +1 -0
  56. package/icc-api/model/AccessLog.js.map +1 -1
  57. package/icc-api/model/Article.d.ts +4 -0
  58. package/icc-api/model/Article.js +1 -0
  59. package/icc-api/model/Article.js.map +1 -1
  60. package/icc-api/model/CalendarItem.d.ts +4 -0
  61. package/icc-api/model/CalendarItem.js +1 -0
  62. package/icc-api/model/CalendarItem.js.map +1 -1
  63. package/icc-api/model/Classification.d.ts +4 -0
  64. package/icc-api/model/Classification.js +1 -0
  65. package/icc-api/model/Classification.js.map +1 -1
  66. package/icc-api/model/ClassificationTemplate.d.ts +2 -0
  67. package/icc-api/model/ClassificationTemplate.js.map +1 -1
  68. package/icc-api/model/Contact.d.ts +4 -0
  69. package/icc-api/model/Contact.js +1 -0
  70. package/icc-api/model/Contact.js.map +1 -1
  71. package/icc-api/model/Device.d.ts +4 -4
  72. package/icc-api/model/Device.js.map +1 -1
  73. package/icc-api/model/Document.d.ts +4 -0
  74. package/icc-api/model/Document.js +1 -0
  75. package/icc-api/model/Document.js.map +1 -1
  76. package/icc-api/model/ExchangeData.d.ts +61 -0
  77. package/icc-api/model/ExchangeData.js +12 -0
  78. package/icc-api/model/ExchangeData.js.map +1 -0
  79. package/icc-api/model/ExchangeDataMap.d.ts +21 -0
  80. package/icc-api/model/ExchangeDataMap.js +10 -0
  81. package/icc-api/model/ExchangeDataMap.js.map +1 -0
  82. package/icc-api/model/ExchangeDataMapCreationBatch.d.ts +13 -0
  83. package/icc-api/model/ExchangeDataMapCreationBatch.js +10 -0
  84. package/icc-api/model/ExchangeDataMapCreationBatch.js.map +1 -0
  85. package/icc-api/model/Form.d.ts +4 -0
  86. package/icc-api/model/Form.js +1 -0
  87. package/icc-api/model/Form.js.map +1 -1
  88. package/icc-api/model/HealthElement.d.ts +4 -0
  89. package/icc-api/model/HealthElement.js +1 -0
  90. package/icc-api/model/HealthElement.js.map +1 -1
  91. package/icc-api/model/HealthcareParty.d.ts +2 -2
  92. package/icc-api/model/HealthcareParty.js.map +1 -1
  93. package/icc-api/model/IcureStub.d.ts +2 -0
  94. package/icc-api/model/IcureStub.js.map +1 -1
  95. package/icc-api/model/Invoice.d.ts +4 -0
  96. package/icc-api/model/Invoice.js +1 -0
  97. package/icc-api/model/Invoice.js.map +1 -1
  98. package/icc-api/model/MaintenanceTask.d.ts +4 -0
  99. package/icc-api/model/MaintenanceTask.js +1 -0
  100. package/icc-api/model/MaintenanceTask.js.map +1 -1
  101. package/icc-api/model/Message.d.ts +4 -0
  102. package/icc-api/model/Message.js +1 -0
  103. package/icc-api/model/Message.js.map +1 -1
  104. package/icc-api/model/PaginatedListExchangeData.d.ts +9 -0
  105. package/icc-api/model/PaginatedListExchangeData.js +10 -0
  106. package/icc-api/model/PaginatedListExchangeData.js.map +1 -0
  107. package/icc-api/model/Patient.d.ts +6 -2
  108. package/icc-api/model/Patient.js +1 -0
  109. package/icc-api/model/Patient.js.map +1 -1
  110. package/icc-api/model/PatientByHcPartyGenderEducationProfession.d.ts +31 -0
  111. package/icc-api/model/PatientByHcPartyGenderEducationProfession.js +32 -0
  112. package/icc-api/model/PatientByHcPartyGenderEducationProfession.js.map +1 -0
  113. package/icc-api/model/Receipt.d.ts +4 -0
  114. package/icc-api/model/Receipt.js +1 -0
  115. package/icc-api/model/Receipt.js.map +1 -1
  116. package/icc-api/model/SecureDelegation.d.ts +52 -0
  117. package/icc-api/model/SecureDelegation.js +16 -0
  118. package/icc-api/model/SecureDelegation.js.map +1 -0
  119. package/icc-api/model/SecurityMetadata.d.ts +33 -0
  120. package/icc-api/model/SecurityMetadata.js +13 -0
  121. package/icc-api/model/SecurityMetadata.js.map +1 -0
  122. package/icc-api/model/Service.d.ts +2 -0
  123. package/icc-api/model/Service.js.map +1 -1
  124. package/icc-api/model/TimeTable.d.ts +4 -0
  125. package/icc-api/model/TimeTable.js +1 -0
  126. package/icc-api/model/TimeTable.js.map +1 -1
  127. package/icc-api/model/models.d.ts +20 -39
  128. package/icc-api/model/models.js +15 -37
  129. package/icc-api/model/models.js.map +1 -1
  130. package/icc-api/model/requests/EntityBulkShareResult.d.ts +28 -0
  131. package/icc-api/model/requests/EntityBulkShareResult.js +16 -0
  132. package/icc-api/model/requests/EntityBulkShareResult.js.map +1 -0
  133. package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.d.ts +10 -0
  134. package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js +17 -0
  135. package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js.map +1 -0
  136. package/icc-api/model/requests/EntityShareRequest.d.ts +110 -0
  137. package/icc-api/model/requests/EntityShareRequest.js +63 -0
  138. package/icc-api/model/requests/EntityShareRequest.js.map +1 -0
  139. package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.d.ts +54 -0
  140. package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js +24 -0
  141. package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js.map +1 -0
  142. package/icc-api/model/requests/MinimalEntityBulkShareResult.d.ts +23 -0
  143. package/icc-api/model/requests/MinimalEntityBulkShareResult.js +13 -0
  144. package/icc-api/model/requests/MinimalEntityBulkShareResult.js.map +1 -0
  145. package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.d.ts +21 -0
  146. package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.js +14 -0
  147. package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.js.map +1 -0
  148. package/icc-x-api/basexapi/EncryptedEntityXApi.d.ts +3 -2
  149. package/icc-x-api/basexapi/EncryptedEntityXApi.js.map +1 -1
  150. package/icc-x-api/crypto/AES.js +1 -1
  151. package/icc-x-api/crypto/AES.js.map +1 -1
  152. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.d.ts +16 -0
  153. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js +41 -0
  154. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js.map +1 -0
  155. package/icc-x-api/crypto/AccessControlSecretUtils.d.ts +42 -0
  156. package/icc-x-api/crypto/AccessControlSecretUtils.js +86 -0
  157. package/icc-x-api/crypto/AccessControlSecretUtils.js.map +1 -0
  158. package/icc-x-api/crypto/BaseExchangeDataManager.d.ts +146 -0
  159. package/icc-x-api/crypto/BaseExchangeDataManager.js +342 -0
  160. package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -0
  161. package/icc-x-api/crypto/BaseExchangeKeysManager.d.ts +0 -18
  162. package/icc-x-api/crypto/BaseExchangeKeysManager.js +11 -85
  163. package/icc-x-api/crypto/BaseExchangeKeysManager.js.map +1 -1
  164. package/icc-x-api/crypto/ConfidentialEntities.d.ts +26 -16
  165. package/icc-x-api/crypto/ConfidentialEntities.js +30 -17
  166. package/icc-x-api/crypto/ConfidentialEntities.js.map +1 -1
  167. package/icc-x-api/crypto/CryptoStrategies.d.ts +8 -1
  168. package/icc-x-api/crypto/CryptoStrategies.js.map +1 -1
  169. package/icc-x-api/crypto/ExchangeDataManager.d.ts +95 -0
  170. package/icc-x-api/crypto/ExchangeDataManager.js +493 -0
  171. package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -0
  172. package/icc-x-api/crypto/ExchangeDataMapManager.d.ts +32 -0
  173. package/icc-x-api/crypto/ExchangeDataMapManager.js +70 -0
  174. package/icc-x-api/crypto/ExchangeDataMapManager.js.map +1 -0
  175. package/icc-x-api/crypto/ExchangeKeysManager.d.ts +4 -16
  176. package/icc-x-api/crypto/ExchangeKeysManager.js +4 -62
  177. package/icc-x-api/crypto/ExchangeKeysManager.js.map +1 -1
  178. package/icc-x-api/crypto/ExtendedApisUtils.d.ts +336 -0
  179. package/icc-x-api/crypto/ExtendedApisUtils.js +3 -0
  180. package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -0
  181. package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +181 -0
  182. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +562 -0
  183. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -0
  184. package/icc-x-api/crypto/KeyRecovery.d.ts +5 -2
  185. package/icc-x-api/crypto/KeyRecovery.js +59 -29
  186. package/icc-x-api/crypto/KeyRecovery.js.map +1 -1
  187. package/icc-x-api/crypto/LegacyCryptoStrategies.d.ts +7 -2
  188. package/icc-x-api/crypto/LegacyCryptoStrategies.js +8 -1
  189. package/icc-x-api/crypto/LegacyCryptoStrategies.js.map +1 -1
  190. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.d.ts +39 -0
  191. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js +150 -0
  192. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js.map +1 -0
  193. package/icc-x-api/crypto/RSA.d.ts +34 -8
  194. package/icc-x-api/crypto/RSA.js +80 -13
  195. package/icc-x-api/crypto/RSA.js.map +1 -1
  196. package/icc-x-api/crypto/SecureDelegationsEncryption.d.ts +54 -0
  197. package/icc-x-api/crypto/SecureDelegationsEncryption.js +178 -0
  198. package/icc-x-api/crypto/SecureDelegationsEncryption.js.map +1 -0
  199. package/icc-x-api/crypto/SecureDelegationsManager.d.ts +66 -0
  200. package/icc-x-api/crypto/SecureDelegationsManager.js +261 -0
  201. package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -0
  202. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.d.ts +37 -0
  203. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js +294 -0
  204. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js.map +1 -0
  205. package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +114 -0
  206. package/icc-x-api/crypto/SecurityMetadataDecryptor.js +98 -0
  207. package/icc-x-api/crypto/SecurityMetadataDecryptor.js.map +1 -0
  208. package/icc-x-api/crypto/ShamirKeysManager.d.ts +5 -5
  209. package/icc-x-api/crypto/ShamirKeysManager.js +6 -9
  210. package/icc-x-api/crypto/ShamirKeysManager.js.map +1 -1
  211. package/icc-x-api/crypto/TransferKeysManager.d.ts +8 -6
  212. package/icc-x-api/crypto/TransferKeysManager.js +75 -52
  213. package/icc-x-api/crypto/TransferKeysManager.js.map +1 -1
  214. package/icc-x-api/crypto/{KeyManager.d.ts → UserEncryptionKeysManager.d.ts} +4 -6
  215. package/icc-x-api/crypto/{KeyManager.js → UserEncryptionKeysManager.js} +43 -23
  216. package/icc-x-api/crypto/UserEncryptionKeysManager.js.map +1 -0
  217. package/icc-x-api/crypto/UserSignatureKeysManager.d.ts +26 -0
  218. package/icc-x-api/crypto/UserSignatureKeysManager.js +74 -0
  219. package/icc-x-api/crypto/UserSignatureKeysManager.js.map +1 -0
  220. package/icc-x-api/crypto/utils.d.ts +61 -11
  221. package/icc-x-api/crypto/utils.js +113 -44
  222. package/icc-x-api/crypto/utils.js.map +1 -1
  223. package/icc-x-api/filters/filters.js.map +1 -1
  224. package/icc-x-api/icc-accesslog-x-api.d.ts +46 -11
  225. package/icc-x-api/icc-accesslog-x-api.js +75 -42
  226. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  227. package/icc-x-api/icc-calendar-item-x-api.d.ts +50 -14
  228. package/icc-x-api/icc-calendar-item-x-api.js +99 -49
  229. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  230. package/icc-x-api/icc-classification-x-api.d.ts +44 -9
  231. package/icc-x-api/icc-classification-x-api.js +56 -31
  232. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  233. package/icc-x-api/icc-contact-x-api.d.ts +56 -32
  234. package/icc-x-api/icc-contact-x-api.js +95 -64
  235. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  236. package/icc-x-api/icc-crypto-x-api.d.ts +28 -334
  237. package/icc-x-api/icc-crypto-x-api.js +41 -765
  238. package/icc-x-api/icc-crypto-x-api.js.map +1 -1
  239. package/icc-x-api/icc-data-owner-x-api.d.ts +20 -8
  240. package/icc-x-api/icc-data-owner-x-api.js +31 -10
  241. package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
  242. package/icc-x-api/icc-document-x-api.d.ts +48 -11
  243. package/icc-x-api/icc-document-x-api.js +111 -64
  244. package/icc-x-api/icc-document-x-api.js.map +1 -1
  245. package/icc-x-api/icc-form-x-api.d.ts +45 -10
  246. package/icc-x-api/icc-form-x-api.js +65 -35
  247. package/icc-x-api/icc-form-x-api.js.map +1 -1
  248. package/icc-x-api/icc-hcparty-x-api.d.ts +2 -2
  249. package/icc-x-api/icc-hcparty-x-api.js +3 -3
  250. package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
  251. package/icc-x-api/icc-helement-x-api.d.ts +55 -18
  252. package/icc-x-api/icc-helement-x-api.js +76 -41
  253. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  254. package/icc-x-api/icc-icure-maintenance-x-api.d.ts +7 -2
  255. package/icc-x-api/icc-icure-maintenance-x-api.js +38 -27
  256. package/icc-x-api/icc-icure-maintenance-x-api.js.map +1 -1
  257. package/icc-x-api/icc-invoice-x-api.d.ts +50 -15
  258. package/icc-x-api/icc-invoice-x-api.js +63 -33
  259. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  260. package/icc-x-api/icc-maintenance-task-x-api.d.ts +53 -21
  261. package/icc-x-api/icc-maintenance-task-x-api.js +72 -35
  262. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  263. package/icc-x-api/icc-message-x-api.d.ts +53 -15
  264. package/icc-x-api/icc-message-x-api.js +65 -36
  265. package/icc-x-api/icc-message-x-api.js.map +1 -1
  266. package/icc-x-api/icc-patient-x-api.d.ts +84 -29
  267. package/icc-x-api/icc-patient-x-api.js +313 -378
  268. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  269. package/icc-x-api/icc-receipt-x-api.d.ts +44 -12
  270. package/icc-x-api/icc-receipt-x-api.js +67 -35
  271. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  272. package/icc-x-api/icc-time-table-x-api.d.ts +43 -12
  273. package/icc-x-api/icc-time-table-x-api.js +56 -26
  274. package/icc-x-api/icc-time-table-x-api.js.map +1 -1
  275. package/icc-x-api/icc-user-x-api.d.ts +2 -2
  276. package/icc-x-api/icc-user-x-api.js +3 -3
  277. package/icc-x-api/icc-user-x-api.js.map +1 -1
  278. package/icc-x-api/index.d.ts +4 -2
  279. package/icc-x-api/index.js +154 -135
  280. package/icc-x-api/index.js.map +1 -1
  281. package/icc-x-api/storage/DefaultStorageEntryKeysFactory.d.ts +2 -0
  282. package/icc-x-api/storage/DefaultStorageEntryKeysFactory.js +9 -2
  283. package/icc-x-api/storage/DefaultStorageEntryKeysFactory.js.map +1 -1
  284. package/icc-x-api/storage/IcureStorageFacade.d.ts +23 -2
  285. package/icc-x-api/storage/IcureStorageFacade.js +36 -2
  286. package/icc-x-api/storage/IcureStorageFacade.js.map +1 -1
  287. package/icc-x-api/storage/KeyStorageFacade.d.ts +12 -0
  288. package/icc-x-api/storage/KeyStorageFacade.js.map +1 -1
  289. package/icc-x-api/storage/KeyStorageImpl.d.ts +2 -0
  290. package/icc-x-api/storage/KeyStorageImpl.js +10 -0
  291. package/icc-x-api/storage/KeyStorageImpl.js.map +1 -1
  292. package/icc-x-api/storage/StorageEntryKeysFactory.d.ts +14 -1
  293. package/icc-x-api/storage/StorageEntryKeysFactory.js.map +1 -1
  294. package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +32 -0
  295. package/icc-x-api/utils/EntityWithDelegationTypeName.js +75 -0
  296. package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -0
  297. package/icc-x-api/utils/ShareResult.d.ts +74 -0
  298. package/icc-x-api/utils/ShareResult.js +61 -0
  299. package/icc-x-api/utils/ShareResult.js.map +1 -0
  300. package/icc-x-api/utils/binary-utils.d.ts +1 -0
  301. package/icc-x-api/utils/binary-utils.js +8 -1
  302. package/icc-x-api/utils/binary-utils.js.map +1 -1
  303. package/icc-x-api/utils/collection-utils.d.ts +5 -0
  304. package/icc-x-api/utils/collection-utils.js +26 -1
  305. package/icc-x-api/utils/collection-utils.js.map +1 -1
  306. package/icc-x-api/utils/crypto-utils.d.ts +4 -3
  307. package/icc-x-api/utils/crypto-utils.js +5 -4
  308. package/icc-x-api/utils/crypto-utils.js.map +1 -1
  309. package/icc-x-api/utils/lru-temporised-async-cache.d.ts +26 -3
  310. package/icc-x-api/utils/lru-temporised-async-cache.js +75 -15
  311. package/icc-x-api/utils/lru-temporised-async-cache.js.map +1 -1
  312. package/icc-x-api/utils/websocket.d.ts +10 -10
  313. package/icc-x-api/utils/websocket.js +18 -9
  314. package/icc-x-api/utils/websocket.js.map +1 -1
  315. package/index.d.ts +1 -1
  316. package/index.js +3 -1
  317. package/index.js.map +1 -1
  318. package/package.json +2 -3
  319. package/icc-x-api/crypto/EntitiesEncryption.d.ts +0 -275
  320. package/icc-x-api/crypto/EntitiesEncryption.js +0 -734
  321. package/icc-x-api/crypto/EntitiesEncryption.js.map +0 -1
  322. package/icc-x-api/crypto/KeyManager.js.map +0 -1
@@ -16,6 +16,8 @@ const XHR_1 = require("../icc-api/api/XHR");
16
16
  const models = require("../icc-api/model/models");
17
17
  const binary_utils_1 = require("./utils/binary-utils");
18
18
  const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
19
+ const SecureDelegation_1 = require("../icc-api/model/SecureDelegation");
20
+ var AccessLevelEnum = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
19
21
  // noinspection JSUnusedGlobalSymbols
20
22
  class IccDocumentXApi extends icc_api_1.IccDocumentApi {
21
23
  constructor(host, headers, crypto, authApi, dataOwnerApi, authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
@@ -419,6 +421,9 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
419
421
  this.authenticationProvider = authenticationProvider;
420
422
  this.dataOwnerApi = dataOwnerApi;
421
423
  }
424
+ get headers() {
425
+ return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'Document'));
426
+ }
422
427
  /**
423
428
  * Creates a new instance of document with initialised encryption metadata (not in the database).
424
429
  * @param user the current user.
@@ -428,10 +433,9 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
428
433
  * @param options optional parameters:
429
434
  * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
430
435
  * 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
431
- * auto-delegations, in such case the access level specified here will be used. Currently only WRITE access is supported, but in future also read
432
- * access will be possible.
433
- * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the classification. The default value will be a
434
- * secret id of patient known by the topmost parent in the current data owner hierarchy.
436
+ * auto-delegations, in such case the access level specified here will be used.
437
+ * - preferredSfk: secret id of the message to use as the secret foreign key to use for the document. The default value will be a
438
+ * secret id of the message known by the topmost parent in the current data owner hierarchy.
435
439
  * @return a new instance of document.
436
440
  */
437
441
  newInstance(user, message, c = {}, options = {}) {
@@ -443,23 +447,21 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
443
447
  const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
444
448
  if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
445
449
  throw new Error('Can only initialise entities as current data owner.');
446
- const sfk = message ? (_h = options.preferredSfk) !== null && _h !== void 0 ? _h : (yield this.crypto.confidential.getAnySecretIdSharedWithParents(message)) : undefined;
450
+ const sfk = message
451
+ ? (_h = options.preferredSfk) !== null && _h !== void 0 ? _h : (yield this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: message, type: 'Message' }))
452
+ : undefined;
447
453
  if (message && !sfk)
448
454
  throw new Error(`Couldn't find any sfk of parent message ${message.id}`);
449
- const extraDelegations = [
450
- ...Object.keys((_j = options.additionalDelegates) !== null && _j !== void 0 ? _j : {}),
451
- ...((_l = (_k = user.autoDelegations) === null || _k === void 0 ? void 0 : _k.all) !== null && _l !== void 0 ? _l : []),
452
- ...((_o = (_m = user.autoDelegations) === null || _m === void 0 ? void 0 : _m.medicalInformation) !== null && _o !== void 0 ? _o : []),
453
- ];
454
- return new models.Document(yield this.crypto.entities
455
- .entityWithInitialisedEncryptedMetadata(document, message === null || message === void 0 ? void 0 : message.id, sfk, true, extraDelegations)
455
+ const extraDelegations = Object.assign(Object.assign({}, Object.fromEntries([...((_k = (_j = user.autoDelegations) === null || _j === void 0 ? void 0 : _j.all) !== null && _k !== void 0 ? _k : []), ...((_m = (_l = user.autoDelegations) === null || _l === void 0 ? void 0 : _l.medicalInformation) !== null && _m !== void 0 ? _m : [])].map((d) => [d, AccessLevelEnum.WRITE]))), ((_o = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _o !== void 0 ? _o : {}));
456
+ return new models.Document(yield this.crypto.xapi
457
+ .entityWithInitialisedEncryptedMetadata(document, 'Document', message === null || message === void 0 ? void 0 : message.id, sfk, true, false, extraDelegations)
456
458
  .then((x) => x.updatedEntity));
457
459
  });
458
460
  }
459
461
  // noinspection JSUnusedGlobalSymbols
460
462
  findByMessage(hcpartyId, message) {
461
463
  return __awaiter(this, void 0, void 0, function* () {
462
- const extractedKeys = yield this.crypto.entities.secretIdsOf(message, hcpartyId);
464
+ const extractedKeys = yield this.crypto.xapi.secretIdsOf({ entity: message, type: 'Message' }, hcpartyId);
463
465
  const topmostParentId = (yield this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0];
464
466
  let documents = yield this.findDocumentsByHCPartyPatientForeignKeys(topmostParentId, _.uniq(extractedKeys).join(','));
465
467
  return yield this.decrypt(hcpartyId, documents);
@@ -467,19 +469,17 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
467
469
  }
468
470
  // Note: this is only for dealing with legacy documents: new document are not encrypted, only their attachments are
469
471
  decrypt(hcpartyId, documents) {
470
- return Promise.all(documents.map((document) => this.crypto
471
- .extractKeysFromDelegationsForHcpHierarchy(hcpartyId, document.id, _.size(document.encryptionKeys) ? document.encryptionKeys : document.delegations)
472
- .then(({ extractedKeys: sfks }) => {
473
- if (!sfks || !sfks.length) {
472
+ return Promise.all(documents.map((document) => this.crypto.xapi.decryptAndImportAllDecryptionKeys({ entity: document, type: 'Document' }).then((keys) => {
473
+ if (!keys.length) {
474
474
  console.log('Cannot decrypt document', document.id);
475
475
  return Promise.resolve(document);
476
476
  }
477
- if (sfks.length && (document.encryptedSelf || document.encryptedAttachment)) {
478
- return this.crypto.AES.importKey('raw', (0, binary_utils_1.hex2ua)(sfks[0].replace(/-/g, '')))
479
- .then((key) => Promise.all([
477
+ if (keys.length && (document.encryptedSelf || document.encryptedAttachment)) {
478
+ const key = keys[0].key;
479
+ return Promise.all([
480
480
  document.encryptedSelf
481
481
  ? new Promise((resolve) => {
482
- this.crypto.AES.decrypt(key, (0, binary_utils_1.string2ua)((0, binary_utils_1.a2b)(document.encryptedSelf))).then(resolve, () => {
482
+ this.crypto.primitives.AES.decrypt(key, (0, binary_utils_1.string2ua)((0, binary_utils_1.a2b)(document.encryptedSelf))).then(resolve, () => {
483
483
  console.log('Cannot decrypt document', document.id);
484
484
  resolve(null);
485
485
  });
@@ -487,14 +487,13 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
487
487
  : Promise.resolve(null),
488
488
  document.encryptedAttachment
489
489
  ? new Promise((resolve) => {
490
- this.crypto.AES.decrypt(key, document.encryptedAttachment).then(resolve, () => {
490
+ this.crypto.primitives.AES.decrypt(key, document.encryptedAttachment).then(resolve, () => {
491
491
  console.log('Cannot decrypt document', document.id);
492
492
  resolve(null);
493
493
  });
494
494
  })
495
495
  : Promise.resolve(null),
496
- ]))
497
- .then((decrypted) => {
496
+ ]).then((decrypted) => {
498
497
  if (decrypted) {
499
498
  if (decrypted[0]) {
500
499
  document = _.extend(document, JSON.parse((0, binary_utils_1.ua2string)(decrypted[0])));
@@ -514,16 +513,29 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
514
513
  return Promise.resolve(documents);
515
514
  });
516
515
  }
516
+ /**
517
+ * @deprecated use getMainAttachmentAs instead
518
+ */
517
519
  getAttachmentAs(documentId, attachmentId, returnType, enckeys, fileName) {
518
- const url = this.host +
519
- `/document/${documentId}/attachment/${attachmentId}` +
520
- '?ts=' +
521
- new Date().getTime() +
522
- (enckeys ? `&enckeys=${enckeys}` : '') +
523
- (fileName ? `&fileName=${fileName}` : '');
524
- return XHR_1.XHR.sendCommand('GET', url, this.headers, null, this.fetchImpl, returnType, this.authenticationProvider.getAuthService())
525
- .then((doc) => doc.body)
526
- .catch((err) => this.handleError(err));
520
+ return __awaiter(this, void 0, void 0, function* () {
521
+ const url = this.host +
522
+ `/document/${documentId}/attachment/${attachmentId}` +
523
+ '?ts=' +
524
+ new Date().getTime() +
525
+ (enckeys ? `&enckeys=${enckeys}` : '') +
526
+ (fileName ? `&fileName=${fileName}` : '');
527
+ return XHR_1.XHR.sendCommand('GET', url, yield this.headers, null, this.fetchImpl, returnType, this.authenticationProvider.getAuthService())
528
+ .then((doc) => doc.body)
529
+ .catch((err) => this.handleError(err));
530
+ });
531
+ }
532
+ getMainAttachmentAs(documentId, returnType) {
533
+ return __awaiter(this, void 0, void 0, function* () {
534
+ const url = this.host + `/document/${documentId}/attachment` + '?ts=' + new Date().getTime();
535
+ return XHR_1.XHR.sendCommand('GET', url, yield this.headers, null, this.fetchImpl, returnType, this.authenticationProvider.getAuthService())
536
+ .then((doc) => doc.body)
537
+ .catch((err) => this.handleError(err));
538
+ });
527
539
  }
528
540
  // noinspection JSUnusedGlobalSymbols
529
541
  getAttachmentUrl(documentId, attachmentId, sfks, fileName) {
@@ -551,9 +563,12 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
551
563
  * @return the updated document.
552
564
  */
553
565
  encryptAndSetDocumentAttachment(document, attachment, utis) {
566
+ var _a;
554
567
  return __awaiter(this, void 0, void 0, function* () {
555
- const encryptedData = yield this.crypto.entities.encryptDataOf(document, attachment);
556
- return yield this.setDocumentAttachment(document.id, undefined, encryptedData, utis);
568
+ if (!document.rev)
569
+ throw new Error('Cannot set attachment on document without rev');
570
+ const { encryptedData, updatedEntity } = yield this.crypto.xapi.encryptDataOf(document, 'Document', attachment, (d) => this.modifyDocument(d));
571
+ return yield this.setMainDocumentAttachment(document.id, (_a = updatedEntity === null || updatedEntity === void 0 ? void 0 : updatedEntity.rev) !== null && _a !== void 0 ? _a : document.rev, encryptedData, utis);
557
572
  });
558
573
  }
559
574
  /**
@@ -566,7 +581,9 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
566
581
  */
567
582
  setClearDocumentAttachment(document, attachment, utis) {
568
583
  return __awaiter(this, void 0, void 0, function* () {
569
- return yield this.setDocumentAttachment(document.id, undefined, attachment, utis);
584
+ if (!document.rev)
585
+ throw new Error('Cannot set attachment on document without rev');
586
+ return yield this.setMainDocumentAttachment(document.id, document.rev, attachment, utis);
570
587
  });
571
588
  }
572
589
  /**
@@ -579,9 +596,12 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
579
596
  * @return the updated document.
580
597
  */
581
598
  encryptAndSetSecondaryDocumentAttachment(document, secondaryAttachmentKey, attachment, utis) {
599
+ var _a;
582
600
  return __awaiter(this, void 0, void 0, function* () {
583
- const encryptedData = yield this.crypto.entities.encryptDataOf(document, attachment);
584
- return yield this.setSecondaryAttachment(document.id, secondaryAttachmentKey, document.rev, encryptedData, utis);
601
+ if (!document.rev)
602
+ throw new Error('Cannot set attachment on document without rev');
603
+ const { encryptedData, updatedEntity } = yield this.crypto.xapi.encryptDataOf(document, 'Document', attachment, (d) => this.modifyDocument());
604
+ return yield this.setSecondaryAttachment(document.id, secondaryAttachmentKey, (_a = updatedEntity === null || updatedEntity === void 0 ? void 0 : updatedEntity.rev) !== null && _a !== void 0 ? _a : document.rev, encryptedData, utis);
585
605
  });
586
606
  }
587
607
  /**
@@ -607,10 +627,10 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
607
627
  */
608
628
  getAndDecryptDocumentAttachment(document, validator = () => Promise.resolve(true)) {
609
629
  return __awaiter(this, void 0, void 0, function* () {
610
- const { data, wasDecrypted } = yield this.crypto.entities.tryDecryptDataOf(document, yield this.getDocumentAttachment(document.id, 'ignored'), (x) => validator(x));
611
- if (!wasDecrypted)
630
+ const retrieved = yield this.getAndTryDecryptDocumentAttachment(document, (x) => validator(x));
631
+ if (!retrieved.wasDecrypted)
612
632
  throw new Error(`No valid key found to decrypt data of document ${document.id}.`);
613
- return data;
633
+ return retrieved.data;
614
634
  });
615
635
  }
616
636
  /**
@@ -624,7 +644,7 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
624
644
  */
625
645
  getAndTryDecryptDocumentAttachment(document, validator = () => Promise.resolve(true)) {
626
646
  return __awaiter(this, void 0, void 0, function* () {
627
- return yield this.crypto.entities.tryDecryptDataOf(document, yield this.getDocumentAttachment(document.id, 'ignored'), (x) => validator(x));
647
+ return yield this.crypto.xapi.tryDecryptDataOf({ entity: document, type: 'Document' }, yield this.getMainDocumentAttachment(document.id), (x) => validator(x));
628
648
  });
629
649
  }
630
650
  /**
@@ -637,7 +657,7 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
637
657
  */
638
658
  getAndDecryptSecondaryDocumentAttachment(document, secondaryAttachmentKey, validator = () => Promise.resolve(true)) {
639
659
  return __awaiter(this, void 0, void 0, function* () {
640
- const { data, wasDecrypted } = yield this.crypto.entities.tryDecryptDataOf(document, yield this.getSecondaryAttachment(document.id, secondaryAttachmentKey), (x) => validator(x));
660
+ const { data, wasDecrypted } = yield this.getAndTryDecryptSecondaryDocumentAttachment(document, secondaryAttachmentKey, (x) => validator(x));
641
661
  if (!wasDecrypted)
642
662
  throw new Error(`No valid key found to decrypt data of document ${document.id}.`);
643
663
  return data;
@@ -655,7 +675,7 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
655
675
  */
656
676
  getAndTryDecryptSecondaryDocumentAttachment(document, secondaryAttachmentKey, validator = () => Promise.resolve(true)) {
657
677
  return __awaiter(this, void 0, void 0, function* () {
658
- return yield this.crypto.entities.tryDecryptDataOf(document, yield this.getSecondaryAttachment(document.id, secondaryAttachmentKey), (x) => validator(x));
678
+ return yield this.crypto.xapi.tryDecryptDataOf({ entity: document, type: 'Document' }, yield this.getSecondaryAttachment(document.id, secondaryAttachmentKey), (x) => validator(x));
659
679
  });
660
680
  }
661
681
  /**
@@ -665,12 +685,20 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
665
685
  */
666
686
  decryptMessageIdOf(document) {
667
687
  return __awaiter(this, void 0, void 0, function* () {
668
- return this.crypto.entities.owningEntityIdsOf(document, undefined);
688
+ return this.crypto.xapi.owningEntityIdsOf({ entity: document, type: 'Document' }, undefined);
689
+ });
690
+ }
691
+ /**
692
+ * @return if the logged data owner has write access to the content of the given document
693
+ */
694
+ hasWriteAccess(document) {
695
+ return __awaiter(this, void 0, void 0, function* () {
696
+ return this.crypto.xapi.hasWriteAccess({ entity: document, type: 'Document' });
669
697
  });
670
698
  }
671
699
  /**
672
700
  * Share an existing document with other data owners, allowing them to access the non-encrypted data of the document and optionally also
673
- * the encrypted content.
701
+ * the encrypted content, with read-only or read-write permissions.
674
702
  * @param delegateId the id of the data owner which will be granted access to the document.
675
703
  * @param document the document to share.
676
704
  * @param options optional parameters to customize the sharing behaviour:
@@ -678,7 +706,8 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
678
706
  * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
679
707
  * - shareMessageId: specifies if the id of the message that this document refers to should be shared with the delegate (defaults to
680
708
  * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
681
- * @return a promise which will contain the updated document.
709
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
710
+ * @return the updated entity
682
711
  */
683
712
  shareWith(delegateId, document, options = {}) {
684
713
  return __awaiter(this, void 0, void 0, function* () {
@@ -687,40 +716,58 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
687
716
  }
688
717
  /**
689
718
  * Share an existing document with other data owners, allowing them to access the non-encrypted data of the document and optionally also
690
- * the encrypted content.
719
+ * the encrypted content, with read-only or read-write permissions.
691
720
  * @param document the document to share.
692
- * @param delegates sharing options for each delegate.
721
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
693
722
  * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
694
723
  * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
695
724
  * - shareMessageId: specifies if the id of the message that this document refers to should be shared with the delegate (defaults to
696
725
  * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
697
- * @return a promise which will contain the updated document.
726
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
727
+ * @return the updated entity.
698
728
  */
699
729
  shareWithMany(document, delegates) {
700
730
  return __awaiter(this, void 0, void 0, function* () {
701
- const extended = yield this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(document, true, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
731
+ return (yield this.tryShareWithMany(document, delegates)).updatedEntityOrThrow;
732
+ });
733
+ }
734
+ /**
735
+ * Share an existing document with other data owners, allowing them to access the non-encrypted data of the document and optionally also
736
+ * the encrypted content, with read-only or read-write permissions.
737
+ * @param document the document to share.
738
+ * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
739
+ * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
740
+ * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
741
+ * - shareMessageId: specifies if the id of the message that this document refers to should be shared with the delegate (defaults to
742
+ * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
743
+ * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
744
+ * @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
745
+ * the operation failed.
746
+ */
747
+ tryShareWithMany(document, delegates) {
748
+ return __awaiter(this, void 0, void 0, function* () {
749
+ const self = yield this.dataOwnerApi.getCurrentDataOwnerId();
750
+ // All entities should have an encryption key.
751
+ const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(document, 'Document');
752
+ const updatedEntity = entityWithEncryptionKey ? yield this.modifyDocument(entityWithEncryptionKey) : document;
753
+ return this.crypto.xapi
754
+ .simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type: 'Document' }, true, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
702
755
  delegateId,
703
756
  {
704
- shareEncryptionKey: options.shareEncryptionKey,
757
+ requestedPermissions: options.requestedPermissions,
758
+ shareEncryptionKeys: options.shareEncryptionKey,
705
759
  shareOwningEntityIds: options.shareMessageId,
760
+ shareSecretIds: undefined,
706
761
  },
707
- ])));
708
- if (!!extended) {
709
- return yield this.modifyDocument(extended);
710
- }
711
- else
712
- return document;
762
+ ])), (x) => this.bulkShareDocument(x))
763
+ .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])));
713
764
  });
714
765
  }
715
766
  getDataOwnersWithAccessTo(entity) {
716
- return __awaiter(this, void 0, void 0, function* () {
717
- return yield this.crypto.entities.getDataOwnersWithAccessTo(entity);
718
- });
767
+ return this.crypto.xapi.getDataOwnersWithAccessTo({ entity, type: 'Document' });
719
768
  }
720
769
  getEncryptionKeysOf(entity) {
721
- return __awaiter(this, void 0, void 0, function* () {
722
- return yield this.crypto.entities.encryptionKeysOf(entity);
723
- });
770
+ return this.crypto.xapi.encryptionKeysOf({ entity, type: 'Document' }, undefined);
724
771
  }
725
772
  }
726
773
  exports.IccDocumentXApi = IccDocumentXApi;