@icure/api 8.0.7 → 8.0.9

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 (259) hide show
  1. package/icc-api/model/models.d.ts +1 -0
  2. package/icc-api/model/models.js +1 -0
  3. package/icc-api/model/models.js.map +1 -1
  4. package/icc-x-api/crypto/ExchangeDataManager.js +3 -2
  5. package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
  6. package/icc-x-api/crypto/KeyRecovery.js +5 -4
  7. package/icc-x-api/crypto/KeyRecovery.js.map +1 -1
  8. package/icc-x-api/crypto/RSA.d.ts +4 -1
  9. package/icc-x-api/crypto/RSA.js +6 -1
  10. package/icc-x-api/crypto/RSA.js.map +1 -1
  11. package/icc-x-api/crypto/SecureDelegationsManager.js +2 -1
  12. package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -1
  13. package/icc-x-api/crypto/TransferKeysManager.js +4 -3
  14. package/icc-x-api/crypto/TransferKeysManager.js.map +1 -1
  15. package/icc-x-api/crypto/UserEncryptionKeysManager.js +2 -1
  16. package/icc-x-api/crypto/UserEncryptionKeysManager.js.map +1 -1
  17. package/icc-x-api/crypto/utils.d.ts +1 -4
  18. package/icc-x-api/crypto/utils.js +6 -8
  19. package/icc-x-api/crypto/utils.js.map +1 -1
  20. package/icc-x-api/icc-accesslog-x-api.js +16 -14
  21. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  22. package/icc-x-api/icc-calendar-item-x-api.d.ts +2 -2
  23. package/icc-x-api/icc-calendar-item-x-api.js +17 -17
  24. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  25. package/icc-x-api/icc-classification-x-api.js +12 -11
  26. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  27. package/icc-x-api/icc-contact-x-api.d.ts +2 -2
  28. package/icc-x-api/icc-contact-x-api.js +23 -20
  29. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  30. package/icc-x-api/icc-document-x-api.js +17 -16
  31. package/icc-x-api/icc-document-x-api.js.map +1 -1
  32. package/icc-x-api/icc-form-x-api.js +13 -12
  33. package/icc-x-api/icc-form-x-api.js.map +1 -1
  34. package/icc-x-api/icc-helement-x-api.js +18 -16
  35. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  36. package/icc-x-api/icc-invoice-x-api.js +12 -11
  37. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  38. package/icc-x-api/icc-maintenance-task-x-api.js +11 -11
  39. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  40. package/icc-x-api/icc-message-x-api.js +14 -14
  41. package/icc-x-api/icc-message-x-api.js.map +1 -1
  42. package/icc-x-api/icc-patient-x-api.js +28 -27
  43. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  44. package/icc-x-api/icc-receipt-x-api.js +11 -10
  45. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  46. package/icc-x-api/icc-recovery-x-api.js +3 -2
  47. package/icc-x-api/icc-recovery-x-api.js.map +1 -1
  48. package/icc-x-api/icc-time-table-x-api.js +9 -8
  49. package/icc-x-api/icc-time-table-x-api.js.map +1 -1
  50. package/icc-x-api/icc-topic-x-api.js +13 -13
  51. package/icc-x-api/icc-topic-x-api.js.map +1 -1
  52. package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +17 -1
  53. package/icc-x-api/utils/EntityWithDelegationTypeName.js +33 -15
  54. package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -1
  55. package/icc-x-api/utils/index.d.ts +1 -0
  56. package/icc-x-api/utils/index.js +1 -0
  57. package/icc-x-api/utils/index.js.map +1 -1
  58. package/package.json +1 -1
  59. package/test/icc-api/api/IccAnonymousAccessApi.d.ts +1 -0
  60. package/test/icc-api/api/IccAnonymousAccessApi.js +58 -0
  61. package/test/icc-api/api/IccAnonymousAccessApi.js.map +1 -0
  62. package/test/icc-api/api/IccDocumentApi.d.ts +1 -0
  63. package/test/icc-api/api/IccDocumentApi.js +208 -0
  64. package/test/icc-api/api/IccDocumentApi.js.map +1 -0
  65. package/test/icc-api/api/IccGroupApi.d.ts +1 -0
  66. package/test/icc-api/api/IccGroupApi.js +50 -0
  67. package/test/icc-api/api/IccGroupApi.js.map +1 -0
  68. package/test/icc-api/api/IccRecoveryDataApi.d.ts +1 -0
  69. package/test/icc-api/api/IccRecoveryDataApi.js +95 -0
  70. package/test/icc-api/api/IccRecoveryDataApi.js.map +1 -0
  71. package/test/icc-api/api/IccRoleApi.d.ts +1 -0
  72. package/test/icc-api/api/IccRoleApi.js +34 -0
  73. package/test/icc-api/api/IccRoleApi.js.map +1 -0
  74. package/test/icc-api/api/IccUserApi.d.ts +1 -0
  75. package/test/icc-api/api/IccUserApi.js +96 -0
  76. package/test/icc-api/api/IccUserApi.js.map +1 -0
  77. package/test/icc-api/e2e/IccCalendarItemApi.d.ts +1 -0
  78. package/test/icc-api/e2e/IccCalendarItemApi.js +46 -0
  79. package/test/icc-api/e2e/IccCalendarItemApi.js.map +1 -0
  80. package/test/icc-api/model/modelHelpersTest.d.ts +1 -0
  81. package/test/icc-api/model/modelHelpersTest.js +45 -0
  82. package/test/icc-api/model/modelHelpersTest.js.map +1 -0
  83. package/test/icc-x-api/auth/group-switch-test.d.ts +1 -0
  84. package/test/icc-x-api/auth/group-switch-test.js +81 -0
  85. package/test/icc-x-api/auth/group-switch-test.js.map +1 -0
  86. package/test/icc-x-api/auth/jwt-concurrency-test.d.ts +2 -0
  87. package/test/icc-x-api/auth/jwt-concurrency-test.js +113 -0
  88. package/test/icc-x-api/auth/jwt-concurrency-test.js.map +1 -0
  89. package/test/icc-x-api/auth/smart-auth-provider-test.d.ts +1 -0
  90. package/test/icc-x-api/auth/smart-auth-provider-test.js +224 -0
  91. package/test/icc-x-api/auth/smart-auth-provider-test.js.map +1 -0
  92. package/test/icc-x-api/autofix-anonymity-test.d.ts +1 -0
  93. package/test/icc-x-api/autofix-anonymity-test.js +108 -0
  94. package/test/icc-x-api/autofix-anonymity-test.js.map +1 -0
  95. package/test/icc-x-api/confidential-entities-test.d.ts +1 -0
  96. package/test/icc-x-api/confidential-entities-test.js +110 -0
  97. package/test/icc-x-api/confidential-entities-test.js.map +1 -0
  98. package/test/icc-x-api/crud/comprehensive-crud-test.d.ts +1 -0
  99. package/test/icc-x-api/crud/comprehensive-crud-test.js +276 -0
  100. package/test/icc-x-api/crud/comprehensive-crud-test.js.map +1 -0
  101. package/test/icc-x-api/crud/entities-crud-test-interface.d.ts +16 -0
  102. package/test/icc-x-api/crud/entities-crud-test-interface.js +422 -0
  103. package/test/icc-x-api/crud/entities-crud-test-interface.js.map +1 -0
  104. package/test/icc-x-api/crypto/anonymous-delegations-test.d.ts +1 -0
  105. package/test/icc-x-api/crypto/anonymous-delegations-test.js +588 -0
  106. package/test/icc-x-api/crypto/anonymous-delegations-test.js.map +1 -0
  107. package/test/icc-x-api/crypto/concurrency.d.ts +1 -0
  108. package/test/icc-x-api/crypto/concurrency.js +35 -0
  109. package/test/icc-x-api/crypto/concurrency.js.map +1 -0
  110. package/test/icc-x-api/crypto/crypto-utils.d.ts +1 -0
  111. package/test/icc-x-api/crypto/crypto-utils.js +80 -0
  112. package/test/icc-x-api/crypto/crypto-utils.js.map +1 -0
  113. package/test/icc-x-api/crypto/cryptoTest.d.ts +2 -0
  114. package/test/icc-x-api/crypto/cryptoTest.js +302 -0
  115. package/test/icc-x-api/crypto/cryptoTest.js.map +1 -0
  116. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.d.ts +1 -0
  117. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js +166 -0
  118. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js.map +1 -0
  119. package/test/icc-x-api/crypto/exchange-data-manager-test.d.ts +1 -0
  120. package/test/icc-x-api/crypto/exchange-data-manager-test.js +690 -0
  121. package/test/icc-x-api/crypto/exchange-data-manager-test.js.map +1 -0
  122. package/test/icc-x-api/crypto/full-crypto-test.d.ts +1 -0
  123. package/test/icc-x-api/crypto/full-crypto-test.js +457 -0
  124. package/test/icc-x-api/crypto/full-crypto-test.js.map +1 -0
  125. package/test/icc-x-api/crypto/secure-delegations-manager-test.d.ts +1 -0
  126. package/test/icc-x-api/crypto/secure-delegations-manager-test.js +266 -0
  127. package/test/icc-x-api/crypto/secure-delegations-manager-test.js.map +1 -0
  128. package/test/icc-x-api/crypto/secure-delegations-metadata-decryptor-test.d.ts +1 -0
  129. package/test/icc-x-api/crypto/secure-delegations-metadata-decryptor-test.js +393 -0
  130. package/test/icc-x-api/crypto/secure-delegations-metadata-decryptor-test.js.map +1 -0
  131. package/test/icc-x-api/crypto/security-metadata-decryptor-chain-test.d.ts +1 -0
  132. package/test/icc-x-api/crypto/security-metadata-decryptor-chain-test.js +213 -0
  133. package/test/icc-x-api/crypto/security-metadata-decryptor-chain-test.js.map +1 -0
  134. package/test/icc-x-api/crypto/shamir.d.ts +2 -0
  135. package/test/icc-x-api/crypto/shamir.js +166 -0
  136. package/test/icc-x-api/crypto/shamir.js.map +1 -0
  137. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.d.ts +1 -0
  138. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js +71 -0
  139. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js.map +1 -0
  140. package/test/icc-x-api/crypto/signature-keys-manager-test.d.ts +1 -0
  141. package/test/icc-x-api/crypto/signature-keys-manager-test.js +44 -0
  142. package/test/icc-x-api/crypto/signature-keys-manager-test.js.map +1 -0
  143. package/test/icc-x-api/crypto/user-encryption-keys-manager-test.d.ts +1 -0
  144. package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js +246 -0
  145. package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js.map +1 -0
  146. package/test/icc-x-api/entity-with-attachments-api-test.d.ts +1 -0
  147. package/test/icc-x-api/entity-with-attachments-api-test.js +142 -0
  148. package/test/icc-x-api/entity-with-attachments-api-test.js.map +1 -0
  149. package/test/icc-x-api/filters/filters.d.ts +1 -0
  150. package/test/icc-x-api/filters/filters.js +49 -0
  151. package/test/icc-x-api/filters/filters.js.map +1 -0
  152. package/test/icc-x-api/icc-accesslog-x-api.d.ts +1 -0
  153. package/test/icc-x-api/icc-accesslog-x-api.js +106 -0
  154. package/test/icc-x-api/icc-accesslog-x-api.js.map +1 -0
  155. package/test/icc-x-api/icc-auth-api.d.ts +1 -0
  156. package/test/icc-x-api/icc-auth-api.js +47 -0
  157. package/test/icc-x-api/icc-auth-api.js.map +1 -0
  158. package/test/icc-x-api/icc-calendar-item-x-api.d.ts +1 -0
  159. package/test/icc-x-api/icc-calendar-item-x-api.js +150 -0
  160. package/test/icc-x-api/icc-calendar-item-x-api.js.map +1 -0
  161. package/test/icc-x-api/icc-contact-x-api.d.ts +1 -0
  162. package/test/icc-x-api/icc-contact-x-api.js +279 -0
  163. package/test/icc-x-api/icc-contact-x-api.js.map +1 -0
  164. package/test/icc-x-api/icc-form-x-api.d.ts +1 -0
  165. package/test/icc-x-api/icc-form-x-api.js +98 -0
  166. package/test/icc-x-api/icc-form-x-api.js.map +1 -0
  167. package/test/icc-x-api/icc-helement-x-api-test.d.ts +1 -0
  168. package/test/icc-x-api/icc-helement-x-api-test.js +153 -0
  169. package/test/icc-x-api/icc-helement-x-api-test.js.map +1 -0
  170. package/test/icc-x-api/icc-invoice-x-api.d.ts +1 -0
  171. package/test/icc-x-api/icc-invoice-x-api.js +99 -0
  172. package/test/icc-x-api/icc-invoice-x-api.js.map +1 -0
  173. package/test/icc-x-api/icc-maintenance-task-x-api-test.d.ts +1 -0
  174. package/test/icc-x-api/icc-maintenance-task-x-api-test.js +221 -0
  175. package/test/icc-x-api/icc-maintenance-task-x-api-test.js.map +1 -0
  176. package/test/icc-x-api/icc-message-x-api.d.ts +1 -0
  177. package/test/icc-x-api/icc-message-x-api.js +328 -0
  178. package/test/icc-x-api/icc-message-x-api.js.map +1 -0
  179. package/test/icc-x-api/icc-patient-x-api-test.d.ts +1 -0
  180. package/test/icc-x-api/icc-patient-x-api-test.js +158 -0
  181. package/test/icc-x-api/icc-patient-x-api-test.js.map +1 -0
  182. package/test/icc-x-api/icc-recovery-x-api.d.ts +1 -0
  183. package/test/icc-x-api/icc-recovery-x-api.js +170 -0
  184. package/test/icc-x-api/icc-recovery-x-api.js.map +1 -0
  185. package/test/icc-x-api/icc-time-table-x-api.d.ts +1 -0
  186. package/test/icc-x-api/icc-time-table-x-api.js +100 -0
  187. package/test/icc-x-api/icc-time-table-x-api.js.map +1 -0
  188. package/test/icc-x-api/icc-topic-x-api.d.ts +1 -0
  189. package/test/icc-x-api/icc-topic-x-api.js +269 -0
  190. package/test/icc-x-api/icc-topic-x-api.js.map +1 -0
  191. package/test/icc-x-api/icc-user-x-api-test.d.ts +1 -0
  192. package/test/icc-x-api/icc-user-x-api-test.js +99 -0
  193. package/test/icc-x-api/icc-user-x-api-test.js.map +1 -0
  194. package/test/icc-x-api/patient-user.d.ts +2 -0
  195. package/test/icc-x-api/patient-user.js +104 -0
  196. package/test/icc-x-api/patient-user.js.map +1 -0
  197. package/test/icc-x-api/storage/storage.d.ts +1 -0
  198. package/test/icc-x-api/storage/storage.js +48 -0
  199. package/test/icc-x-api/storage/storage.js.map +1 -0
  200. package/test/icc-x-api/test-api-no-parent.d.ts +1 -0
  201. package/test/icc-x-api/test-api-no-parent.js +79 -0
  202. package/test/icc-x-api/test-api-no-parent.js.map +1 -0
  203. package/test/icc-x-api/test-legacy-data-support.d.ts +1 -0
  204. package/test/icc-x-api/test-legacy-data-support.js +376 -0
  205. package/test/icc-x-api/test-legacy-data-support.js.map +1 -0
  206. package/test/icc-x-api/utils/graph-test.d.ts +1 -0
  207. package/test/icc-x-api/utils/graph-test.js +54 -0
  208. package/test/icc-x-api/utils/graph-test.js.map +1 -0
  209. package/test/icc-x-api/utils/lru-temporised-async-cache-test.d.ts +1 -0
  210. package/test/icc-x-api/utils/lru-temporised-async-cache-test.js +364 -0
  211. package/test/icc-x-api/utils/lru-temporised-async-cache-test.js.map +1 -0
  212. package/test/support/CSM-185.d.ts +1 -0
  213. package/test/support/CSM-185.js +124 -0
  214. package/test/support/CSM-185.js.map +1 -0
  215. package/test/support/CSM-243.d.ts +1 -0
  216. package/test/support/CSM-243.js +120 -0
  217. package/test/support/CSM-243.js.map +1 -0
  218. package/test/support/CSM-87.d.ts +0 -0
  219. package/test/support/CSM-87.js +21 -0
  220. package/test/support/CSM-87.js.map +1 -0
  221. package/test/support/CSM-93.d.ts +1 -0
  222. package/test/support/CSM-93.js +112 -0
  223. package/test/support/CSM-93.js.map +1 -0
  224. package/test/utils/FakeDataOwnerApi.d.ts +32 -0
  225. package/test/utils/FakeDataOwnerApi.js +136 -0
  226. package/test/utils/FakeDataOwnerApi.js.map +1 -0
  227. package/test/utils/FakeEncryptionKeysManager.d.ts +35 -0
  228. package/test/utils/FakeEncryptionKeysManager.js +87 -0
  229. package/test/utils/FakeEncryptionKeysManager.js.map +1 -0
  230. package/test/utils/FakeExchangeDataApi.d.ts +30 -0
  231. package/test/utils/FakeExchangeDataApi.js +74 -0
  232. package/test/utils/FakeExchangeDataApi.js.map +1 -0
  233. package/test/utils/FakeExchangeDataManager.d.ts +40 -0
  234. package/test/utils/FakeExchangeDataManager.js +89 -0
  235. package/test/utils/FakeExchangeDataManager.js.map +1 -0
  236. package/test/utils/FakeExchangeDataMapManager.d.ts +12 -0
  237. package/test/utils/FakeExchangeDataMapManager.js +38 -0
  238. package/test/utils/FakeExchangeDataMapManager.js.map +1 -0
  239. package/test/utils/FakeGenericApi.d.ts +16 -0
  240. package/test/utils/FakeGenericApi.js +65 -0
  241. package/test/utils/FakeGenericApi.js.map +1 -0
  242. package/test/utils/FakeSignatureKeysManager.d.ts +16 -0
  243. package/test/utils/FakeSignatureKeysManager.js +54 -0
  244. package/test/utils/FakeSignatureKeysManager.js.map +1 -0
  245. package/test/utils/TestApi.d.ts +3 -0
  246. package/test/utils/TestApi.js +30 -0
  247. package/test/utils/TestApi.js.map +1 -0
  248. package/test/utils/TestCollectionUtils.d.ts +1 -0
  249. package/test/utils/TestCollectionUtils.js +109 -0
  250. package/test/utils/TestCollectionUtils.js.map +1 -0
  251. package/test/utils/TestCryptoStrategies.d.ts +42 -0
  252. package/test/utils/TestCryptoStrategies.js +80 -0
  253. package/test/utils/TestCryptoStrategies.js.map +1 -0
  254. package/test/utils/TestStorage.d.ts +23 -0
  255. package/test/utils/TestStorage.js +61 -0
  256. package/test/utils/TestStorage.js.map +1 -0
  257. package/test/utils/test_utils.d.ts +76 -0
  258. package/test/utils/test_utils.js +419 -0
  259. package/test/utils/test_utils.js.map +1 -0
@@ -18,6 +18,7 @@ const ModelHelper_1 = require("../icc-api/model/ModelHelper");
18
18
  const person_util_1 = require("./utils/person-util");
19
19
  const utils_1 = require("./utils");
20
20
  const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
21
+ const EntityWithDelegationTypeName_1 = require("./utils/EntityWithDelegationTypeName");
21
22
  const SecureDelegation_1 = require("../icc-api/model/SecureDelegation");
22
23
  const EntityShareRequest_1 = require("../icc-api/model/requests/EntityShareRequest");
23
24
  const ShareMetadataBehaviour_1 = require("./crypto/ShareMetadataBehaviour");
@@ -27,7 +28,7 @@ const Connection_1 = require("../icc-api/model/Connection");
27
28
  // noinspection JSUnusedGlobalSymbols
28
29
  class IccPatientXApi extends icc_api_1.IccPatientApi {
29
30
  get headers() {
30
- return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'Patient'));
31
+ return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient));
31
32
  }
32
33
  constructor(host, headers, crypto, contactApi, formApi, helementApi, invoiceApi, documentApi, hcpartyApi, classificationApi, dataOwnerApi, calendarItemApi, userApi, authApi, autofillAuthor, encryptedKeys = ['note'], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
33
34
  ? window.fetch
@@ -69,7 +70,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
69
70
  if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
70
71
  throw new Error('Can only initialise entities as current data owner.');
71
72
  const extraDelegations = Object.assign(Object.assign({}, Object.fromEntries([...((_j = (_h = user.autoDelegations) === null || _h === void 0 ? void 0 : _h.all) !== null && _j !== void 0 ? _j : []), ...((_l = (_k = user.autoDelegations) === null || _k === void 0 ? void 0 : _k.medicalInformation) !== null && _l !== void 0 ? _l : [])].map((d) => [d, AccessLevelEnum.WRITE]))), ((_m = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _m !== void 0 ? _m : {}));
72
- const initialisationInfo = yield this.crypto.xapi.entityWithInitialisedEncryptedMetadata(patient, 'Patient', undefined, undefined, true, true, extraDelegations);
73
+ const initialisationInfo = yield this.crypto.xapi.entityWithInitialisedEncryptedMetadata(patient, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, undefined, undefined, true, true, extraDelegations);
73
74
  return new models.Patient(initialisationInfo.updatedEntity);
74
75
  });
75
76
  }
@@ -123,7 +124,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
123
124
  if (!updatedPatient)
124
125
  throw new Error('Could not create patient');
125
126
  }
126
- const initialised = yield this.crypto.confidential.initialiseConfidentialSecretId(updatedPatient, 'Patient', (x) => this.bulkSharePatients(x));
127
+ const initialised = yield this.crypto.confidential.initialiseConfidentialSecretId(updatedPatient, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, (x) => this.bulkSharePatients(x));
127
128
  if (initialised) {
128
129
  return initialised;
129
130
  }
@@ -299,7 +300,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
299
300
  return this.encryptAs(dataOwnerId, pats);
300
301
  }
301
302
  encryptAs(dataOwner, pats) {
302
- return Promise.all(pats.map((p) => this.crypto.xapi.tryEncryptEntity(p, 'Patient', this.encryptedFields, true, false, (x) => new models.Patient(x))));
303
+ return Promise.all(pats.map((p) => this.crypto.xapi.tryEncryptEntity(p, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, this.encryptedFields, true, false, (x) => new models.Patient(x))));
303
304
  }
304
305
  // If patient can't be decrypted returns patient with encrypted data.
305
306
  decrypt(user, patients, fillDelegations = true) {
@@ -311,7 +312,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
311
312
  tryDecryptOrReturnOriginal(patients) {
312
313
  return Promise.all(patients.map((p) => __awaiter(this, void 0, void 0, function* () {
313
314
  return yield this.crypto.xapi
314
- .decryptEntity(p, 'Patient', (x) => new models.Patient(x))
315
+ .decryptEntity(p, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, (x) => new models.Patient(x))
315
316
  .then((p) => {
316
317
  if (p.entity.picture && !(p.entity.picture instanceof ArrayBuffer)) {
317
318
  return {
@@ -376,7 +377,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
376
377
  const hcp = yield this.hcpartyApi.getHealthcareParty(ownerId);
377
378
  const parentId = hcp.parentId;
378
379
  let patient = yield (0, utils_1.retry)(() => this.getPatientWithUser(user, patId));
379
- const patientWithInitialisedEncryption = yield this.crypto.xapi.ensureEncryptionKeysInitialised(patient, 'Patient');
380
+ const patientWithInitialisedEncryption = yield this.crypto.xapi.ensureEncryptionKeysInitialised(patient, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient);
380
381
  if (patientWithInitialisedEncryption) {
381
382
  patient = yield this.modifyPatientWithUser(user, patientWithInitialisedEncryption);
382
383
  }
@@ -387,8 +388,8 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
387
388
  };
388
389
  return { patient: patient, statuses: status };
389
390
  }
390
- const delSfks = yield this.crypto.xapi.secretIdsOf({ entity: patient, type: 'Patient' }, ownerId);
391
- const ecKeys = yield this.crypto.xapi.encryptionKeysOf({ entity: patient, type: 'Patient' }, ownerId);
391
+ const delSfks = yield this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, ownerId);
392
+ const ecKeys = yield this.crypto.xapi.encryptionKeysOf({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, ownerId);
392
393
  if (delSfks.length) {
393
394
  const retrievedHealthElements = yield (0, utils_1.retry)(() => (usingPost
394
395
  ? this.helementApi.findHealthElementsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(ownerId, _.uniq(delSfks))
@@ -473,12 +474,12 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
473
474
  status.success = true;
474
475
  }
475
476
  });
476
- yield doShareEntitiesAndUpdateStatus(retrievedHealthElements, 'HealthElement', status.healthElements, isMedicalInfoTags, (x) => this.helementApi.bulkShareHealthElementsMinimal(x));
477
- yield doShareEntitiesAndUpdateStatus(retrievedContacts, 'Contact', status.contacts, isMedicalInfoTags, (x) => this.contactApi.bulkShareContactsMinimal(x));
478
- yield doShareEntitiesAndUpdateStatus(retrievedInvoices, 'Invoice', status.invoices, isFinancialInfoTags, (x) => this.invoiceApi.bulkShareInvoicesMinimal(x));
479
- yield doShareEntitiesAndUpdateStatus(retrievedClassifications, 'Classification', status.classifications, isMedicalInfoTags, (x) => this.classificationApi.bulkShareClassificationsMinimal(x));
480
- yield doShareEntitiesAndUpdateStatus(retrievedCalendarItems, 'CalendarItem', status.calendarItems, isMedicalInfoTags, (x) => this.calendarItemApi.bulkShareCalendarItemsMinimal(x));
481
- yield doShareEntitiesAndUpdateStatus(retrievedForms, 'Form', status.forms, isMedicalInfoTags, (x) => this.formApi.bulkShareFormsMinimal(x));
477
+ yield doShareEntitiesAndUpdateStatus(retrievedHealthElements, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.HealthElement, status.healthElements, isMedicalInfoTags, (x) => this.helementApi.bulkShareHealthElementsMinimal(x));
478
+ yield doShareEntitiesAndUpdateStatus(retrievedContacts, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Contact, status.contacts, isMedicalInfoTags, (x) => this.contactApi.bulkShareContactsMinimal(x));
479
+ yield doShareEntitiesAndUpdateStatus(retrievedInvoices, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Invoice, status.invoices, isFinancialInfoTags, (x) => this.invoiceApi.bulkShareInvoicesMinimal(x));
480
+ yield doShareEntitiesAndUpdateStatus(retrievedClassifications, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Classification, status.classifications, isMedicalInfoTags, (x) => this.classificationApi.bulkShareClassificationsMinimal(x));
481
+ yield doShareEntitiesAndUpdateStatus(retrievedCalendarItems, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.CalendarItem, status.calendarItems, isMedicalInfoTags, (x) => this.calendarItemApi.bulkShareCalendarItemsMinimal(x));
482
+ yield doShareEntitiesAndUpdateStatus(retrievedForms, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Form, status.forms, isMedicalInfoTags, (x) => this.formApi.bulkShareFormsMinimal(x));
482
483
  }
483
484
  const sharePatientDataRequest = {
484
485
  shareSecretIds: delSfks,
@@ -491,7 +492,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
491
492
  dataForDelegates: Object.fromEntries(delegateIds.map((delegateId) => [delegateId, sharePatientDataRequest])),
492
493
  };
493
494
  return yield this.crypto.xapi
494
- .bulkShareOrUpdateEncryptedEntityMetadata('Patient', [sharePatientRequest], (x) => this.bulkSharePatients(x))
495
+ .bulkShareOrUpdateEncryptedEntityMetadata(EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, [sharePatientRequest], (x) => this.bulkSharePatients(x))
495
496
  .then((shareResult) => {
496
497
  var _a;
497
498
  if (shareResult.updatedEntities.length && !shareResult.updateErrors.length) {
@@ -518,7 +519,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
518
519
  const parentId = hcp.parentId;
519
520
  return (0, utils_1.retry)(() => this.getPatientWithUser(user, patId))
520
521
  .then((patient) => __awaiter(this, void 0, void 0, function* () {
521
- const initialised = yield this.crypto.xapi.ensureEncryptionKeysInitialised(patient, 'Patient');
522
+ const initialised = yield this.crypto.xapi.ensureEncryptionKeysInitialised(patient, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient);
522
523
  if (!initialised) {
523
524
  return patient;
524
525
  }
@@ -530,7 +531,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
530
531
  if (!patient) {
531
532
  return Promise.resolve({ id: patId });
532
533
  }
533
- const delSfks = yield this.crypto.xapi.secretIdsOf({ entity: patient, type: 'Patient' }, ownerId);
534
+ const delSfks = yield this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, ownerId);
534
535
  return delSfks.length
535
536
  ? Promise.all([
536
537
  (0, utils_1.retry)(() => (usingPost
@@ -679,7 +680,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
679
680
  */
680
681
  hasWriteAccess(patient) {
681
682
  return __awaiter(this, void 0, void 0, function* () {
682
- return this.crypto.xapi.hasWriteAccess({ entity: patient, type: 'Patient' });
683
+ return this.crypto.xapi.hasWriteAccess({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient });
683
684
  });
684
685
  }
685
686
  /**
@@ -740,10 +741,10 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
740
741
  return __awaiter(this, void 0, void 0, function* () {
741
742
  const self = yield this.dataOwnerApi.getCurrentDataOwnerId();
742
743
  // All entities should have an encryption key.
743
- const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(patient, 'Patient');
744
+ const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(patient, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient);
744
745
  const updatedEntity = entityWithEncryptionKey ? yield this.modifyPatientAs(self, entityWithEncryptionKey) : patient;
745
746
  return this.crypto.xapi
746
- .simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type: 'Patient' }, false, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
747
+ .simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, false, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
747
748
  delegateId,
748
749
  {
749
750
  requestedPermissions: options.requestedPermissions,
@@ -761,7 +762,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
761
762
  * patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.
762
763
  */
763
764
  decryptSecretIdsOf(patient) {
764
- return this.crypto.xapi.secretIdsOf({ entity: patient, type: 'Patient' }, undefined);
765
+ return this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, undefined);
765
766
  }
766
767
  /**
767
768
  * @param patient a patient
@@ -769,7 +770,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
769
770
  * patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.
770
771
  */
771
772
  decryptConfidentialSecretIdsOf(patient) {
772
- return this.crypto.confidential.getConfidentialSecretIds({ entity: patient, type: 'Patient' }, undefined);
773
+ return this.crypto.confidential.getConfidentialSecretIds({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, undefined);
773
774
  }
774
775
  /**
775
776
  * @param patient a patient
@@ -777,13 +778,13 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
777
778
  * patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.
778
779
  */
779
780
  decryptNonConfidentialSecretIdsOf(patient) {
780
- return this.crypto.confidential.getSecretIdsSharedWithParents({ entity: patient, type: 'Patient' });
781
+ return this.crypto.confidential.getSecretIdsSharedWithParents({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient });
781
782
  }
782
783
  getDataOwnersWithAccessTo(entity) {
783
- return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: 'Patient' });
784
+ return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient });
784
785
  }
785
786
  getEncryptionKeysOf(entity) {
786
- return this.crypto.xapi.encryptionKeysOf({ entity, type: 'Patient' }, undefined);
787
+ return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, undefined);
787
788
  }
788
789
  /**
789
790
  * Merge two patients into one. This method performs the following operations:
@@ -835,11 +836,11 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
835
836
  subscribeToPatientEvents(eventTypes, filter, eventFired, options = {}) {
836
837
  return __awaiter(this, void 0, void 0, function* () {
837
838
  const currentUser = yield this.userApi.getCurrentUser();
838
- return (0, utils_1.subscribeToEntityEvents)(this.host, this.authApi, 'Patient', eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decrypt(currentUser, [encrypted]))[0]; })).then((rs) => new Connection_1.ConnectionImpl(rs));
839
+ return (0, utils_1.subscribeToEntityEvents)(this.host, this.authApi, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decrypt(currentUser, [encrypted]))[0]; })).then((rs) => new Connection_1.ConnectionImpl(rs));
839
840
  });
840
841
  }
841
842
  createDelegationDeAnonymizationMetadata(entity, delegates) {
842
- return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: 'Patient' }, delegates);
843
+ return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, delegates);
843
844
  }
844
845
  /**
845
846
  * Initializes the exchange data towards a newly invited patient. This allows the doctor to share data with the