@icure/api 8.6.18 → 8.7.0

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 (328) hide show
  1. package/icc-api/api/IccDocumentApi.d.ts +10 -2
  2. package/icc-api/api/IccDocumentApi.js +22 -4
  3. package/icc-api/api/IccDocumentApi.js.map +1 -1
  4. package/icc-api/api/IccReceiptApi.d.ts +17 -0
  5. package/icc-api/api/IccReceiptApi.js +52 -0
  6. package/icc-api/api/IccReceiptApi.js.map +1 -1
  7. package/icc-api/model/DataAttachment.d.ts +22 -0
  8. package/icc-api/model/DataAttachment.js.map +1 -1
  9. package/icc-api/model/Document.d.ts +6 -0
  10. package/icc-api/model/Document.js.map +1 -1
  11. package/icc-api/model/Receipt.d.ts +6 -0
  12. package/icc-api/model/Receipt.js.map +1 -1
  13. package/icc-x-api/crypto/BaseExchangeDataManager.js +2 -2
  14. package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -1
  15. package/icc-x-api/crypto/ExchangeDataManager.js +3 -3
  16. package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
  17. package/icc-x-api/crypto/ExtendedApisUtils.d.ts +1 -1
  18. package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -1
  19. package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +1 -1
  20. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +8 -2
  21. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -1
  22. package/icc-x-api/crypto/RecoveryDataEncryption.js.map +1 -1
  23. package/icc-x-api/icc-accesslog-x-api.js +7 -7
  24. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  25. package/icc-x-api/icc-calendar-item-x-api.js +7 -7
  26. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  27. package/icc-x-api/icc-classification-x-api.js +4 -5
  28. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  29. package/icc-x-api/icc-code-x-api.d.ts +2 -2
  30. package/icc-x-api/icc-code-x-api.js +3 -33
  31. package/icc-x-api/icc-code-x-api.js.map +1 -1
  32. package/icc-x-api/icc-contact-x-api.js +20 -33
  33. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  34. package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
  35. package/icc-x-api/icc-document-x-api.d.ts +8 -7
  36. package/icc-x-api/icc-document-x-api.js +64 -22
  37. package/icc-x-api/icc-document-x-api.js.map +1 -1
  38. package/icc-x-api/icc-form-x-api.js +3 -4
  39. package/icc-x-api/icc-form-x-api.js.map +1 -1
  40. package/icc-x-api/icc-helement-x-api.js +11 -11
  41. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  42. package/icc-x-api/icc-invoice-x-api.js +3 -4
  43. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  44. package/icc-x-api/icc-maintenance-task-x-api.js +3 -3
  45. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  46. package/icc-x-api/icc-patient-x-api.js +29 -29
  47. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  48. package/icc-x-api/icc-receipt-x-api.d.ts +40 -0
  49. package/icc-x-api/icc-receipt-x-api.js +79 -1
  50. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  51. package/icc-x-api/icc-topic-x-api.js.map +1 -1
  52. package/icc-x-api/index.js +1 -1
  53. package/icc-x-api/index.js.map +1 -1
  54. package/icc-x-api/utils/code-util.d.ts +23 -0
  55. package/icc-x-api/utils/code-util.js +39 -2
  56. package/icc-x-api/utils/code-util.js.map +1 -1
  57. package/icc-x-api/utils/collection-utils.d.ts +13 -0
  58. package/icc-x-api/utils/collection-utils.js +69 -0
  59. package/icc-x-api/utils/collection-utils.js.map +1 -1
  60. package/icc-x-api/utils/compression-utils.d.ts +28 -0
  61. package/icc-x-api/utils/compression-utils.js +106 -0
  62. package/icc-x-api/utils/compression-utils.js.map +1 -0
  63. package/icc-x-api/utils/crypto-utils.js +7 -7
  64. package/icc-x-api/utils/crypto-utils.js.map +1 -1
  65. package/icc-x-api/utils/formatting-util.d.ts +1 -3
  66. package/icc-x-api/utils/formatting-util.js +15 -17
  67. package/icc-x-api/utils/formatting-util.js.map +1 -1
  68. package/icc-x-api/utils/hcp-util.js +2 -3
  69. package/icc-x-api/utils/hcp-util.js.map +1 -1
  70. package/icc-x-api/utils/insurability-util.js +10 -8
  71. package/icc-x-api/utils/insurability-util.js.map +1 -1
  72. package/icc-x-api/utils/lzma-wasm.d.ts +6 -0
  73. package/icc-x-api/utils/lzma-wasm.js +81 -0
  74. package/icc-x-api/utils/lzma-wasm.js.map +1 -0
  75. package/icc-x-api/utils/mutex.d.ts +12 -0
  76. package/icc-x-api/utils/mutex.js +26 -0
  77. package/icc-x-api/utils/mutex.js.map +1 -0
  78. package/icc-x-api/utils/websocket.js +7 -7
  79. package/icc-x-api/utils/websocket.js.map +1 -1
  80. package/icc-x-api/wasm/lzma/lzma.js +2 -0
  81. package/icc-x-api/wasm/lzma/lzma.wasm +0 -0
  82. package/package.json +2 -11
  83. package/icc-x-api/utils/uuid-encoder.d.ts +0 -44
  84. package/icc-x-api/utils/uuid-encoder.js +0 -114
  85. package/icc-x-api/utils/uuid-encoder.js.map +0 -1
  86. package/test/icc-api/api/IccAgendaApi.d.ts +0 -1
  87. package/test/icc-api/api/IccAgendaApi.js +0 -64
  88. package/test/icc-api/api/IccAgendaApi.js.map +0 -1
  89. package/test/icc-api/api/IccAnonymousAccessApi.d.ts +0 -1
  90. package/test/icc-api/api/IccAnonymousAccessApi.js +0 -58
  91. package/test/icc-api/api/IccAnonymousAccessApi.js.map +0 -1
  92. package/test/icc-api/api/IccCalendarItemApi.d.ts +0 -1
  93. package/test/icc-api/api/IccCalendarItemApi.js +0 -67
  94. package/test/icc-api/api/IccCalendarItemApi.js.map +0 -1
  95. package/test/icc-api/api/IccCalendarItemTypeApi.d.ts +0 -1
  96. package/test/icc-api/api/IccCalendarItemTypeApi.js +0 -96
  97. package/test/icc-api/api/IccCalendarItemTypeApi.js.map +0 -1
  98. package/test/icc-api/api/IccCodeApi.d.ts +0 -1
  99. package/test/icc-api/api/IccCodeApi.js +0 -38
  100. package/test/icc-api/api/IccCodeApi.js.map +0 -1
  101. package/test/icc-api/api/IccDocumentApi.d.ts +0 -1
  102. package/test/icc-api/api/IccDocumentApi.js +0 -199
  103. package/test/icc-api/api/IccDocumentApi.js.map +0 -1
  104. package/test/icc-api/api/IccGroupApi.d.ts +0 -1
  105. package/test/icc-api/api/IccGroupApi.js +0 -50
  106. package/test/icc-api/api/IccGroupApi.js.map +0 -1
  107. package/test/icc-api/api/IccKeywordApi.d.ts +0 -1
  108. package/test/icc-api/api/IccKeywordApi.js +0 -64
  109. package/test/icc-api/api/IccKeywordApi.js.map +0 -1
  110. package/test/icc-api/api/IccMedicalLocationApi.d.ts +0 -1
  111. package/test/icc-api/api/IccMedicalLocationApi.js +0 -64
  112. package/test/icc-api/api/IccMedicalLocationApi.js.map +0 -1
  113. package/test/icc-api/api/IccPlaceApi.d.ts +0 -1
  114. package/test/icc-api/api/IccPlaceApi.js +0 -64
  115. package/test/icc-api/api/IccPlaceApi.js.map +0 -1
  116. package/test/icc-api/api/IccRecoveryDataApi.d.ts +0 -1
  117. package/test/icc-api/api/IccRecoveryDataApi.js +0 -95
  118. package/test/icc-api/api/IccRecoveryDataApi.js.map +0 -1
  119. package/test/icc-api/api/IccRoleApi.d.ts +0 -1
  120. package/test/icc-api/api/IccRoleApi.js +0 -34
  121. package/test/icc-api/api/IccRoleApi.js.map +0 -1
  122. package/test/icc-api/api/IccUserApi.d.ts +0 -1
  123. package/test/icc-api/api/IccUserApi.js +0 -96
  124. package/test/icc-api/api/IccUserApi.js.map +0 -1
  125. package/test/icc-api/e2e/IccCalendarItemApi.d.ts +0 -1
  126. package/test/icc-api/e2e/IccCalendarItemApi.js +0 -46
  127. package/test/icc-api/e2e/IccCalendarItemApi.js.map +0 -1
  128. package/test/icc-api/model/modelHelpersTest.d.ts +0 -1
  129. package/test/icc-api/model/modelHelpersTest.js +0 -45
  130. package/test/icc-api/model/modelHelpersTest.js.map +0 -1
  131. package/test/icc-x-api/auth/group-switch-test.d.ts +0 -1
  132. package/test/icc-x-api/auth/group-switch-test.js +0 -81
  133. package/test/icc-x-api/auth/group-switch-test.js.map +0 -1
  134. package/test/icc-x-api/auth/jwt-concurrency-test.d.ts +0 -2
  135. package/test/icc-x-api/auth/jwt-concurrency-test.js +0 -112
  136. package/test/icc-x-api/auth/jwt-concurrency-test.js.map +0 -1
  137. package/test/icc-x-api/auth/jwt-provider-test.d.ts +0 -1
  138. package/test/icc-x-api/auth/jwt-provider-test.js +0 -197
  139. package/test/icc-x-api/auth/jwt-provider-test.js.map +0 -1
  140. package/test/icc-x-api/auth/smart-auth-provider-test.d.ts +0 -1
  141. package/test/icc-x-api/auth/smart-auth-provider-test.js +0 -224
  142. package/test/icc-x-api/auth/smart-auth-provider-test.js.map +0 -1
  143. package/test/icc-x-api/autofix-anonymity-test.d.ts +0 -1
  144. package/test/icc-x-api/autofix-anonymity-test.js +0 -122
  145. package/test/icc-x-api/autofix-anonymity-test.js.map +0 -1
  146. package/test/icc-x-api/confidential-entities-test.d.ts +0 -1
  147. package/test/icc-x-api/confidential-entities-test.js +0 -168
  148. package/test/icc-x-api/confidential-entities-test.js.map +0 -1
  149. package/test/icc-x-api/crud/comprehensive-crud-test.d.ts +0 -1
  150. package/test/icc-x-api/crud/comprehensive-crud-test.js +0 -276
  151. package/test/icc-x-api/crud/comprehensive-crud-test.js.map +0 -1
  152. package/test/icc-x-api/crud/entities-crud-test-interface.d.ts +0 -16
  153. package/test/icc-x-api/crud/entities-crud-test-interface.js +0 -408
  154. package/test/icc-x-api/crud/entities-crud-test-interface.js.map +0 -1
  155. package/test/icc-x-api/crypto/anonymous-delegations-test.d.ts +0 -1
  156. package/test/icc-x-api/crypto/anonymous-delegations-test.js +0 -587
  157. package/test/icc-x-api/crypto/anonymous-delegations-test.js.map +0 -1
  158. package/test/icc-x-api/crypto/concurrency.d.ts +0 -1
  159. package/test/icc-x-api/crypto/concurrency.js +0 -35
  160. package/test/icc-x-api/crypto/concurrency.js.map +0 -1
  161. package/test/icc-x-api/crypto/crypto-utils.d.ts +0 -1
  162. package/test/icc-x-api/crypto/crypto-utils.js +0 -79
  163. package/test/icc-x-api/crypto/crypto-utils.js.map +0 -1
  164. package/test/icc-x-api/crypto/cryptoTest.d.ts +0 -2
  165. package/test/icc-x-api/crypto/cryptoTest.js +0 -402
  166. package/test/icc-x-api/crypto/cryptoTest.js.map +0 -1
  167. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.d.ts +0 -1
  168. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js +0 -166
  169. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js.map +0 -1
  170. package/test/icc-x-api/crypto/exchange-data-manager-test.d.ts +0 -1
  171. package/test/icc-x-api/crypto/exchange-data-manager-test.js +0 -674
  172. package/test/icc-x-api/crypto/exchange-data-manager-test.js.map +0 -1
  173. package/test/icc-x-api/crypto/full-crypto-test.d.ts +0 -1
  174. package/test/icc-x-api/crypto/full-crypto-test.js +0 -454
  175. package/test/icc-x-api/crypto/full-crypto-test.js.map +0 -1
  176. package/test/icc-x-api/crypto/legacy-metadata-migration-test.d.ts +0 -1
  177. package/test/icc-x-api/crypto/legacy-metadata-migration-test.js +0 -379
  178. package/test/icc-x-api/crypto/legacy-metadata-migration-test.js.map +0 -1
  179. package/test/icc-x-api/crypto/secure-delegations-manager-test.d.ts +0 -1
  180. package/test/icc-x-api/crypto/secure-delegations-manager-test.js +0 -278
  181. package/test/icc-x-api/crypto/secure-delegations-manager-test.js.map +0 -1
  182. package/test/icc-x-api/crypto/shamir.d.ts +0 -2
  183. package/test/icc-x-api/crypto/shamir.js +0 -167
  184. package/test/icc-x-api/crypto/shamir.js.map +0 -1
  185. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.d.ts +0 -1
  186. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js +0 -71
  187. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js.map +0 -1
  188. package/test/icc-x-api/crypto/soft-deleted-data-owners.d.ts +0 -2
  189. package/test/icc-x-api/crypto/soft-deleted-data-owners.js +0 -113
  190. package/test/icc-x-api/crypto/soft-deleted-data-owners.js.map +0 -1
  191. package/test/icc-x-api/crypto/user-encryption-keys-manager-test.d.ts +0 -1
  192. package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js +0 -246
  193. package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js.map +0 -1
  194. package/test/icc-x-api/entity-with-attachments-api-test.d.ts +0 -1
  195. package/test/icc-x-api/entity-with-attachments-api-test.js +0 -142
  196. package/test/icc-x-api/entity-with-attachments-api-test.js.map +0 -1
  197. package/test/icc-x-api/filters/filters.d.ts +0 -1
  198. package/test/icc-x-api/filters/filters.js +0 -49
  199. package/test/icc-x-api/filters/filters.js.map +0 -1
  200. package/test/icc-x-api/filters/healthelement.d.ts +0 -1
  201. package/test/icc-x-api/filters/healthelement.js +0 -333
  202. package/test/icc-x-api/filters/healthelement.js.map +0 -1
  203. package/test/icc-x-api/icc-accesslog-x-api.d.ts +0 -1
  204. package/test/icc-x-api/icc-accesslog-x-api.js +0 -106
  205. package/test/icc-x-api/icc-accesslog-x-api.js.map +0 -1
  206. package/test/icc-x-api/icc-application-settings-x-api.d.ts +0 -1
  207. package/test/icc-x-api/icc-application-settings-x-api.js +0 -91
  208. package/test/icc-x-api/icc-application-settings-x-api.js.map +0 -1
  209. package/test/icc-x-api/icc-auth-api.d.ts +0 -1
  210. package/test/icc-x-api/icc-auth-api.js +0 -47
  211. package/test/icc-x-api/icc-auth-api.js.map +0 -1
  212. package/test/icc-x-api/icc-calendar-item-x-api.d.ts +0 -1
  213. package/test/icc-x-api/icc-calendar-item-x-api.js +0 -150
  214. package/test/icc-x-api/icc-calendar-item-x-api.js.map +0 -1
  215. package/test/icc-x-api/icc-contact-x-api.d.ts +0 -1
  216. package/test/icc-x-api/icc-contact-x-api.js +0 -355
  217. package/test/icc-x-api/icc-contact-x-api.js.map +0 -1
  218. package/test/icc-x-api/icc-document-x-api.d.ts +0 -1
  219. package/test/icc-x-api/icc-document-x-api.js +0 -76
  220. package/test/icc-x-api/icc-document-x-api.js.map +0 -1
  221. package/test/icc-x-api/icc-form-x-api.d.ts +0 -1
  222. package/test/icc-x-api/icc-form-x-api.js +0 -413
  223. package/test/icc-x-api/icc-form-x-api.js.map +0 -1
  224. package/test/icc-x-api/icc-hcparty-x-api-test.d.ts +0 -1
  225. package/test/icc-x-api/icc-hcparty-x-api-test.js +0 -43
  226. package/test/icc-x-api/icc-hcparty-x-api-test.js.map +0 -1
  227. package/test/icc-x-api/icc-helement-x-api-test.d.ts +0 -1
  228. package/test/icc-x-api/icc-helement-x-api-test.js +0 -155
  229. package/test/icc-x-api/icc-helement-x-api-test.js.map +0 -1
  230. package/test/icc-x-api/icc-invoice-x-api.d.ts +0 -1
  231. package/test/icc-x-api/icc-invoice-x-api.js +0 -99
  232. package/test/icc-x-api/icc-invoice-x-api.js.map +0 -1
  233. package/test/icc-x-api/icc-maintenance-task-x-api-test.d.ts +0 -1
  234. package/test/icc-x-api/icc-maintenance-task-x-api-test.js +0 -222
  235. package/test/icc-x-api/icc-maintenance-task-x-api-test.js.map +0 -1
  236. package/test/icc-x-api/icc-message-x-api.d.ts +0 -1
  237. package/test/icc-x-api/icc-message-x-api.js +0 -54
  238. package/test/icc-x-api/icc-message-x-api.js.map +0 -1
  239. package/test/icc-x-api/icc-patient-x-api-test.d.ts +0 -1
  240. package/test/icc-x-api/icc-patient-x-api-test.js +0 -165
  241. package/test/icc-x-api/icc-patient-x-api-test.js.map +0 -1
  242. package/test/icc-x-api/icc-recovery-x-api.d.ts +0 -1
  243. package/test/icc-x-api/icc-recovery-x-api.js +0 -175
  244. package/test/icc-x-api/icc-recovery-x-api.js.map +0 -1
  245. package/test/icc-x-api/icc-topic-x-api.d.ts +0 -1
  246. package/test/icc-x-api/icc-topic-x-api.js +0 -269
  247. package/test/icc-x-api/icc-topic-x-api.js.map +0 -1
  248. package/test/icc-x-api/icc-user-x-api-test.d.ts +0 -1
  249. package/test/icc-x-api/icc-user-x-api-test.js +0 -99
  250. package/test/icc-x-api/icc-user-x-api-test.js.map +0 -1
  251. package/test/icc-x-api/keyless-api.d.ts +0 -1
  252. package/test/icc-x-api/keyless-api.js +0 -125
  253. package/test/icc-x-api/keyless-api.js.map +0 -1
  254. package/test/icc-x-api/patient-user.d.ts +0 -2
  255. package/test/icc-x-api/patient-user.js +0 -103
  256. package/test/icc-x-api/patient-user.js.map +0 -1
  257. package/test/icc-x-api/storage/storage.d.ts +0 -1
  258. package/test/icc-x-api/storage/storage.js +0 -48
  259. package/test/icc-x-api/storage/storage.js.map +0 -1
  260. package/test/icc-x-api/test-api-no-parent.d.ts +0 -1
  261. package/test/icc-x-api/test-api-no-parent.js +0 -79
  262. package/test/icc-x-api/test-api-no-parent.js.map +0 -1
  263. package/test/icc-x-api/test-legacy-data-support.d.ts +0 -1
  264. package/test/icc-x-api/test-legacy-data-support.js +0 -375
  265. package/test/icc-x-api/test-legacy-data-support.js.map +0 -1
  266. package/test/icc-x-api/utils/graph-test.d.ts +0 -1
  267. package/test/icc-x-api/utils/graph-test.js +0 -54
  268. package/test/icc-x-api/utils/graph-test.js.map +0 -1
  269. package/test/icc-x-api/utils/lru-temporised-async-cache-test.d.ts +0 -1
  270. package/test/icc-x-api/utils/lru-temporised-async-cache-test.js +0 -364
  271. package/test/icc-x-api/utils/lru-temporised-async-cache-test.js.map +0 -1
  272. package/test/support/CSM-185.d.ts +0 -1
  273. package/test/support/CSM-185.js +0 -124
  274. package/test/support/CSM-185.js.map +0 -1
  275. package/test/support/CSM-243.d.ts +0 -1
  276. package/test/support/CSM-243.js +0 -120
  277. package/test/support/CSM-243.js.map +0 -1
  278. package/test/support/CSM-543.d.ts +0 -1
  279. package/test/support/CSM-543.js +0 -164
  280. package/test/support/CSM-543.js.map +0 -1
  281. package/test/support/CSM-729.d.ts +0 -1
  282. package/test/support/CSM-729.js +0 -225
  283. package/test/support/CSM-729.js.map +0 -1
  284. package/test/support/CSM-87.d.ts +0 -0
  285. package/test/support/CSM-87.js +0 -21
  286. package/test/support/CSM-87.js.map +0 -1
  287. package/test/support/CSM-93.d.ts +0 -1
  288. package/test/support/CSM-93.js +0 -112
  289. package/test/support/CSM-93.js.map +0 -1
  290. package/test/utils/FakeDataOwnerApi.d.ts +0 -32
  291. package/test/utils/FakeDataOwnerApi.js +0 -136
  292. package/test/utils/FakeDataOwnerApi.js.map +0 -1
  293. package/test/utils/FakeEncryptionKeysManager.d.ts +0 -36
  294. package/test/utils/FakeEncryptionKeysManager.js +0 -98
  295. package/test/utils/FakeEncryptionKeysManager.js.map +0 -1
  296. package/test/utils/FakeExchangeDataApi.d.ts +0 -32
  297. package/test/utils/FakeExchangeDataApi.js +0 -92
  298. package/test/utils/FakeExchangeDataApi.js.map +0 -1
  299. package/test/utils/FakeExchangeDataManager.d.ts +0 -48
  300. package/test/utils/FakeExchangeDataManager.js +0 -82
  301. package/test/utils/FakeExchangeDataManager.js.map +0 -1
  302. package/test/utils/FakeExchangeDataMapManager.d.ts +0 -12
  303. package/test/utils/FakeExchangeDataMapManager.js +0 -38
  304. package/test/utils/FakeExchangeDataMapManager.js.map +0 -1
  305. package/test/utils/FakeGenericApi.d.ts +0 -16
  306. package/test/utils/FakeGenericApi.js +0 -65
  307. package/test/utils/FakeGenericApi.js.map +0 -1
  308. package/test/utils/KeylessCryptoStrategies.d.ts +0 -23
  309. package/test/utils/KeylessCryptoStrategies.js +0 -26
  310. package/test/utils/KeylessCryptoStrategies.js.map +0 -1
  311. package/test/utils/TestApi.d.ts +0 -3
  312. package/test/utils/TestApi.js +0 -30
  313. package/test/utils/TestApi.js.map +0 -1
  314. package/test/utils/TestCollectionUtils.d.ts +0 -1
  315. package/test/utils/TestCollectionUtils.js +0 -109
  316. package/test/utils/TestCollectionUtils.js.map +0 -1
  317. package/test/utils/TestCryptoStrategies.d.ts +0 -42
  318. package/test/utils/TestCryptoStrategies.js +0 -80
  319. package/test/utils/TestCryptoStrategies.js.map +0 -1
  320. package/test/utils/TestStorage.d.ts +0 -23
  321. package/test/utils/TestStorage.js +0 -61
  322. package/test/utils/TestStorage.js.map +0 -1
  323. package/test/utils/roles.d.ts +0 -14
  324. package/test/utils/roles.js +0 -345
  325. package/test/utils/roles.js.map +0 -1
  326. package/test/utils/test_utils.d.ts +0 -87
  327. package/test/utils/test_utils.js +0 -452
  328. package/test/utils/test_utils.js.map +0 -1
@@ -1,142 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- require("isomorphic-fetch");
13
- const test_utils_1 = require("../utils/test_utils");
14
- const mocha_1 = require("mocha");
15
- const icc_x_api_1 = require("../../icc-x-api");
16
- var initApi = test_utils_1.TestUtils.initApi;
17
- const chai_1 = require("chai");
18
- const types_1 = require("@icure/test-setup/types");
19
- (0, test_utils_1.setLocalStorage)(fetch);
20
- let env;
21
- let apis;
22
- let user;
23
- const entityWithAttachmentApis = {
24
- docMainAttachment: (apis, currentUser) => ({
25
- createEntity() {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- return apis.documentApi.createDocumentWithUser(currentUser, yield apis.documentApi.newInstance(currentUser));
28
- });
29
- },
30
- encryptAndSetAttachment(entity, attachment) {
31
- return apis.documentApi.encryptAndSetDocumentAttachment(entity, attachment);
32
- },
33
- getAndDecryptAttachment(entity, validator) {
34
- return apis.documentApi.getAndDecryptDocumentAttachment(entity, validator);
35
- },
36
- getEncryptedAttachment(entity) {
37
- return apis.documentApi.getDocumentAttachment(entity.id, 'unused');
38
- },
39
- }),
40
- docSecondaryAttachment: (apis, currentUser) => ({
41
- createEntity() {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- return apis.documentApi.createDocumentWithUser(currentUser, yield apis.documentApi.newInstance(currentUser));
44
- });
45
- },
46
- encryptAndSetAttachment(entity, attachment) {
47
- return apis.documentApi.encryptAndSetSecondaryDocumentAttachment(entity, 'secondary', attachment);
48
- },
49
- getAndDecryptAttachment(entity, validator) {
50
- return apis.documentApi.getAndDecryptSecondaryDocumentAttachment(entity, 'secondary', validator);
51
- },
52
- getEncryptedAttachment(entity) {
53
- return apis.documentApi.getSecondaryAttachment(entity.id, 'secondary');
54
- },
55
- }),
56
- receipt: (apis, currentUser) => ({
57
- createEntity() {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- return apis.receiptApi.createReceipt(yield apis.receiptApi.newInstance(currentUser, {}));
60
- });
61
- },
62
- encryptAndSetAttachment(entity, attachment) {
63
- return __awaiter(this, void 0, void 0, function* () {
64
- return apis.receiptApi.encryptAndSetReceiptAttachment(entity, 'tack', attachment);
65
- });
66
- },
67
- getAndDecryptAttachment(entity, validator) {
68
- var _a;
69
- return apis.receiptApi.getAndDecryptReceiptAttachment(entity, ((_a = entity.attachmentIds) !== null && _a !== void 0 ? _a : {})['tack'], validator);
70
- },
71
- getEncryptedAttachment(entity) {
72
- var _a;
73
- return apis.receiptApi.getReceiptAttachment(entity.id, ((_a = entity.attachmentIds) !== null && _a !== void 0 ? _a : {})['tack']);
74
- },
75
- }),
76
- };
77
- (0, mocha_1.before)(function () {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- this.timeout(600000);
80
- const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
81
- env = yield initializer.execute((0, types_1.getEnvVariables)());
82
- for (const [a, b] of Object.entries(env.dataOwnerDetails)) {
83
- console.log(a);
84
- console.log(b.password);
85
- console.log('');
86
- }
87
- apis = yield initApi(env, test_utils_1.hcp1Username);
88
- user = yield apis.userApi.getCurrentUser();
89
- });
90
- });
91
- describe('Entity attachment update methods', function () {
92
- return __awaiter(this, void 0, void 0, function* () {
93
- Object.entries(entityWithAttachmentApis).forEach(([type, attachmentApiInitialiser]) => {
94
- it(`should automatically encrypt and decrypt attachments (${type})`, () => __awaiter(this, void 0, void 0, function* () {
95
- const attachmentApi = attachmentApiInitialiser(apis, user);
96
- const entity = yield attachmentApi.createEntity();
97
- console.log(`entity id ${entity.id}`);
98
- const attachmentContent = 'This is some secret attachment';
99
- const entityWithEncrypted = yield attachmentApi.encryptAndSetAttachment(entity, (0, icc_x_api_1.utf8_2ua)(attachmentContent));
100
- const decryptedAttachment = yield attachmentApi.getAndDecryptAttachment(entityWithEncrypted, (d) => __awaiter(this, void 0, void 0, function* () {
101
- try {
102
- return (0, icc_x_api_1.ua2utf8)(d) === attachmentContent;
103
- }
104
- catch (_a) {
105
- return false;
106
- }
107
- }));
108
- (0, chai_1.expect)((0, icc_x_api_1.ua2utf8)(decryptedAttachment)).to.equal(attachmentContent);
109
- const encryptedAttachment = yield attachmentApi.getEncryptedAttachment(entityWithEncrypted);
110
- let conversionFailed;
111
- try {
112
- conversionFailed = (0, icc_x_api_1.ua2utf8)(encryptedAttachment) !== attachmentContent;
113
- }
114
- catch (_a) {
115
- conversionFailed = true;
116
- }
117
- (0, chai_1.expect)(conversionFailed).to.be.true;
118
- const attachmentContent2 = 'This is an updated secret attachment';
119
- const entityWithEncrypted2 = yield attachmentApi.encryptAndSetAttachment(entityWithEncrypted, (0, icc_x_api_1.utf8_2ua)(attachmentContent2));
120
- const decryptedAttachment2 = yield attachmentApi.getAndDecryptAttachment(entityWithEncrypted2, (d) => __awaiter(this, void 0, void 0, function* () {
121
- try {
122
- return (0, icc_x_api_1.ua2utf8)(d) === attachmentContent2;
123
- }
124
- catch (_a) {
125
- return false;
126
- }
127
- }));
128
- (0, chai_1.expect)((0, icc_x_api_1.ua2utf8)(decryptedAttachment2)).to.equal(attachmentContent2);
129
- const encryptedAttachment2 = yield attachmentApi.getEncryptedAttachment(entityWithEncrypted2);
130
- let conversionFailed2;
131
- try {
132
- conversionFailed2 = (0, icc_x_api_1.ua2utf8)(encryptedAttachment2) !== attachmentContent2;
133
- }
134
- catch (_b) {
135
- conversionFailed2 = true;
136
- }
137
- (0, chai_1.expect)(conversionFailed2).to.be.true;
138
- }));
139
- });
140
- });
141
- });
142
- //# sourceMappingURL=entity-with-attachments-api-test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity-with-attachments-api-test.js","sourceRoot":"","sources":["../../../test/icc-x-api/entity-with-attachments-api-test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4BAAyB;AACzB,oDAAyG;AACzG,iCAA8B;AAG9B,+CAAyD;AACzD,IAAO,OAAO,GAAG,sBAAS,CAAC,OAAO,CAAA;AAClC,+BAA6B;AAC7B,mDAAmE;AAEnE,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAA;AACtB,IAAI,GAAa,CAAA;AACjB,IAAI,IAAU,CAAA;AACd,IAAI,IAAU,CAAA;AASd,MAAM,wBAAwB,GAAG;IAC/B,iBAAiB,EAAE,CAAC,IAAU,EAAE,WAAiB,EAAE,EAAE,CACnD,CAA0C;QAClC,YAAY;;gBAChB,OAAO,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAA;YAC9G,CAAC;SAAA;QACD,uBAAuB,CAAC,MAAuB,EAAE,UAAoC;YACnF,OAAO,IAAI,CAAC,WAAW,CAAC,+BAA+B,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;QAC7E,CAAC;QACD,uBAAuB,CAAC,MAAuB,EAAE,SAAuD;YACtG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ACnC,MAAM,kBAAkB,GAAG,sCAAsC,CAAA;gBACjE,MAAM,oBAAoB,GAAG,MAAM,aAAa,CAAC,uBAAuB,CAAC,mBAAmB,EAAE,IAAA,oBAAQ,EAAC,kBAAkB,CAAC,CAAC,CAAA;gBAC3H,MAAM,oBAAoB,GAAG,MAAM,aAAa,CAAC,uBAAuB,CAAC,oBAAoB,EAAE,CAAO,CAAC,EAAE,EAAE;oBACzG,IAAI,CAAC;wBACH,OAAO,IAAA,mBAAO,EAAC,CAAC,CAAC,KAAK,kBAAkB,CAAA;oBAC1C,CAAC;oBAAC,WAAM,CAAC;wBACP,OAAO,KAAK,CAAA;oBACd,CAAC;gBACH,CAAC,CAAA,CAAC,CAAA;gBACF,IAAA,aAAM,EAAC,IAAA,mBAAO,EAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;gBAClE,MAAM,oBAAoB,GAAG,MAAM,aAAa,CAAC,sBAAsB,CAAC,oBAAoB,CAAC,CAAA;gBAC7F,IAAI,iBAAiB,CAAA;gBACrB,IAAI,CAAC;oBACH,iBAAiB,GAAG,IAAA,mBAAO,EAAC,oBAAoB,CAAC,KAAK,kBAAkB,CAAA;gBAC1E,CAAC;gBAAC,WAAM,CAAC;oBACP,iBAAiB,GAAG,IAAI,CAAA;gBAC1B,CAAC;gBACD,IAAA,aAAM,EAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAA;YACtC,CAAC,CAAA,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CAAA,CAAC,CAAA","sourcesContent":["import 'isomorphic-fetch'\nimport { getEnvironmentInitializer, hcp1Username, setLocalStorage, TestUtils } from '../utils/test_utils'\nimport { before } from 'mocha'\nimport * as models from '../../icc-api/model/models'\nimport { User } from '../../icc-api/model/User'\nimport { Apis, ua2utf8, utf8_2ua } from '../../icc-x-api'\nimport initApi = TestUtils.initApi\nimport { expect } from 'chai'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\n\nsetLocalStorage(fetch)\nlet env: TestVars\nlet apis: Apis\nlet user: User\n\ninterface EntityWithAttachmentApi<T> {\n createEntity(): Promise<T>\n encryptAndSetAttachment(entity: T, attachment: ArrayBuffer | Uint8Array): Promise<T>\n getAndDecryptAttachment(entity: T, validator: (decrypted: ArrayBuffer) => Promise<boolean>): Promise<ArrayBuffer>\n getEncryptedAttachment(entity: T): Promise<ArrayBuffer>\n}\n\nconst entityWithAttachmentApis = {\n docMainAttachment: (apis: Apis, currentUser: User) =>\n <EntityWithAttachmentApi<models.Document>>{\n async createEntity(): Promise<models.Document> {\n return apis.documentApi.createDocumentWithUser(currentUser, await apis.documentApi.newInstance(currentUser))\n },\n encryptAndSetAttachment(entity: models.Document, attachment: ArrayBuffer | Uint8Array): Promise<models.Document> {\n return apis.documentApi.encryptAndSetDocumentAttachment(entity, attachment)\n },\n getAndDecryptAttachment(entity: models.Document, validator: (decrypted: ArrayBuffer) => Promise<boolean>): Promise<ArrayBuffer> {\n return apis.documentApi.getAndDecryptDocumentAttachment(entity, validator)\n },\n getEncryptedAttachment(entity: models.Document): Promise<ArrayBuffer> {\n return apis.documentApi.getDocumentAttachment(entity.id!, 'unused')\n },\n },\n docSecondaryAttachment: (apis: Apis, currentUser: User) =>\n <EntityWithAttachmentApi<models.Document>>{\n async createEntity(): Promise<models.Document> {\n return apis.documentApi.createDocumentWithUser(currentUser, await apis.documentApi.newInstance(currentUser))\n },\n encryptAndSetAttachment(entity: models.Document, attachment: ArrayBuffer | Uint8Array): Promise<models.Document> {\n return apis.documentApi.encryptAndSetSecondaryDocumentAttachment(entity, 'secondary', attachment)\n },\n getAndDecryptAttachment(entity: models.Document, validator: (decrypted: ArrayBuffer) => Promise<boolean>): Promise<ArrayBuffer> {\n return apis.documentApi.getAndDecryptSecondaryDocumentAttachment(entity, 'secondary', validator)\n },\n getEncryptedAttachment(entity: models.Document): Promise<ArrayBuffer> {\n return apis.documentApi.getSecondaryAttachment(entity.id!, 'secondary')\n },\n },\n receipt: (apis: Apis, currentUser: User) =>\n <EntityWithAttachmentApi<models.Receipt>>{\n async createEntity(): Promise<models.Receipt> {\n return apis.receiptApi.createReceipt(await apis.receiptApi.newInstance(currentUser, {}))\n },\n async encryptAndSetAttachment(entity: models.Receipt, attachment: ArrayBuffer | Uint8Array): Promise<models.Receipt> {\n return apis.receiptApi.encryptAndSetReceiptAttachment(entity, 'tack', attachment)\n },\n getAndDecryptAttachment(entity: models.Receipt, validator: (decrypted: ArrayBuffer) => Promise<boolean>): Promise<ArrayBuffer> {\n return apis.receiptApi.getAndDecryptReceiptAttachment(entity, (entity.attachmentIds ?? {})['tack'], validator)\n },\n getEncryptedAttachment(entity: models.Receipt): Promise<ArrayBuffer> {\n return apis.receiptApi.getReceiptAttachment(entity.id!, (entity.attachmentIds ?? {})['tack'])\n },\n },\n}\n\nbefore(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n for (const [a, b] of Object.entries(env.dataOwnerDetails)) {\n console.log(a)\n console.log(b.password)\n console.log('')\n }\n apis = await initApi(env!, hcp1Username)\n user = await apis.userApi.getCurrentUser()\n})\n\ndescribe('Entity attachment update methods', async function () {\n Object.entries(entityWithAttachmentApis).forEach(([type, attachmentApiInitialiser]) => {\n it(`should automatically encrypt and decrypt attachments (${type})`, async () => {\n const attachmentApi = attachmentApiInitialiser(apis, user)\n const entity = await attachmentApi.createEntity()\n console.log(`entity id ${entity.id}`)\n const attachmentContent = 'This is some secret attachment'\n const entityWithEncrypted = await attachmentApi.encryptAndSetAttachment(entity, utf8_2ua(attachmentContent))\n const decryptedAttachment = await attachmentApi.getAndDecryptAttachment(entityWithEncrypted, async (d) => {\n try {\n return ua2utf8(d) === attachmentContent\n } catch {\n return false\n }\n })\n expect(ua2utf8(decryptedAttachment)).to.equal(attachmentContent)\n const encryptedAttachment = await attachmentApi.getEncryptedAttachment(entityWithEncrypted)\n let conversionFailed\n try {\n conversionFailed = ua2utf8(encryptedAttachment) !== attachmentContent\n } catch {\n conversionFailed = true\n }\n expect(conversionFailed).to.be.true\n const attachmentContent2 = 'This is an updated secret attachment'\n const entityWithEncrypted2 = await attachmentApi.encryptAndSetAttachment(entityWithEncrypted, utf8_2ua(attachmentContent2))\n const decryptedAttachment2 = await attachmentApi.getAndDecryptAttachment(entityWithEncrypted2, async (d) => {\n try {\n return ua2utf8(d) === attachmentContent2\n } catch {\n return false\n }\n })\n expect(ua2utf8(decryptedAttachment2)).to.equal(attachmentContent2)\n const encryptedAttachment2 = await attachmentApi.getEncryptedAttachment(entityWithEncrypted2)\n let conversionFailed2\n try {\n conversionFailed2 = ua2utf8(encryptedAttachment2) !== attachmentContent2\n } catch {\n conversionFailed2 = true\n }\n expect(conversionFailed2).to.be.true\n })\n })\n})\n"]}
@@ -1 +0,0 @@
1
- import 'mocha';
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chai_1 = require("chai");
4
- require("mocha");
5
- const filters_1 = require("../../../icc-x-api/filters/filters");
6
- describe('Composition', () => {
7
- it('or should return an or combining other filters', () => {
8
- const builder = filters_1.Filter.patient().forHcp('me').olderThan(65).or().youngerThan(18);
9
- const filter = builder.build();
10
- (0, chai_1.expect)(filter.$type).to.equal('UnionFilter');
11
- });
12
- it('and should work with or', () => {
13
- const builder = filters_1.Filter.patient().forHcp('me').olderThan(65).or().youngerThan(18).and().searchByName('dup');
14
- const filter = builder.build();
15
- (0, chai_1.expect)(filter.$type).to.equal('IntersectionFilter');
16
- (0, chai_1.expect)(filter.filters[0].$type).to.equal('UnionFilter');
17
- });
18
- it('precedence of operators can be managed for and/or', () => {
19
- const builder = filters_1.Filter.patient()
20
- .forHcp('me')
21
- .olderThan(65)
22
- .or((it) => it.youngerThan(18).and().searchByName('dup'));
23
- const filter = builder.build();
24
- (0, chai_1.expect)(filter.$type).to.equal('UnionFilter');
25
- (0, chai_1.expect)(filter.filters[0].$type).to.equal('PatientByHcPartyDateOfBirthBetweenFilter');
26
- (0, chai_1.expect)(filter.filters[1].$type).to.equal('IntersectionFilter');
27
- });
28
- it('and should work with and', () => {
29
- const builder = filters_1.Filter.patient().youngerThan(65).and().olderThan(18).and().searchByName('dup');
30
- const filter = builder.build();
31
- (0, chai_1.expect)(filter.$type).to.equal('IntersectionFilter');
32
- (0, chai_1.expect)(filter.filters[0].$type).to.equal('IntersectionFilter');
33
- });
34
- it('should not crash miserably on incomplete or/and', () => {
35
- const builder = filters_1.Filter.patient().youngerThan(65).and();
36
- const filter = builder.build();
37
- (0, chai_1.expect)(filter.$type).to.equal('IntersectionFilter');
38
- (0, chai_1.expect)(filter.filters[0].$type).to.equal('PatientByHcPartyDateOfBirthBetweenFilter');
39
- (0, chai_1.expect)(filter.filters[1].$type).to.equal('PatientByHcPartyFilter');
40
- });
41
- it('should not crash miserably on combination of or/and', () => {
42
- const builder = filters_1.Filter.patient().youngerThan(65).and().or().olderThan(75);
43
- const filter = builder.build();
44
- (0, chai_1.expect)(filter.$type).to.equal('IntersectionFilter');
45
- (0, chai_1.expect)(filter.filters[0].$type).to.equal('PatientByHcPartyDateOfBirthBetweenFilter');
46
- (0, chai_1.expect)(filter.filters[1].$type).to.equal('PatientByHcPartyDateOfBirthBetweenFilter');
47
- });
48
- });
49
- //# sourceMappingURL=filters.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../test/icc-x-api/filters/filters.ts"],"names":[],"mappings":";;AAAA,+BAA6B;AAC7B,iBAAc;AACd,gEAA2D;AAE3D,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,OAAO,GAAG,gBAAM,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC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7F,IAAA,aAAM,EAAE,MAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAC7E,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,MAAM,OAAO,GAAG,gBAAM,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QACzE,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAA;QAE9B,IAAA,aAAM,EAAE,MAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAA;QAC5D,IAAA,aAAM,EAAE,MAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAA;QAC7F,IAAA,aAAM,EAAE,MAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAA;IAC/F,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { expect } from 'chai'\nimport 'mocha'\nimport { Filter } from '../../../icc-x-api/filters/filters'\n\ndescribe('Composition', () => {\n it('or should return an or combining other filters', () => {\n const builder = Filter.patient().forHcp('me').olderThan(65).or().youngerThan(18)\n const filter = builder.build()\n\n expect((filter as any).$type).to.equal('UnionFilter')\n })\n\n it('and should work with or', () => {\n const builder = Filter.patient().forHcp('me').olderThan(65).or().youngerThan(18).and().searchByName('dup')\n const filter = builder.build()\n\n expect((filter as any).$type).to.equal('IntersectionFilter')\n expect((filter as any).filters[0].$type).to.equal('UnionFilter')\n })\n\n it('precedence of operators can be managed for and/or', () => {\n const builder = Filter.patient()\n .forHcp('me')\n .olderThan(65)\n .or((it) => it.youngerThan(18).and().searchByName('dup'))\n const filter = builder.build()\n\n expect((filter as any).$type).to.equal('UnionFilter')\n expect((filter as any).filters[0].$type).to.equal('PatientByHcPartyDateOfBirthBetweenFilter')\n expect((filter as any).filters[1].$type).to.equal('IntersectionFilter')\n })\n\n it('and should work with and', () => {\n const builder = Filter.patient().youngerThan(65).and().olderThan(18).and().searchByName('dup')\n const filter = builder.build()\n\n expect((filter as any).$type).to.equal('IntersectionFilter')\n expect((filter as any).filters[0].$type).to.equal('IntersectionFilter')\n })\n\n it('should not crash miserably on incomplete or/and', () => {\n const builder = Filter.patient().youngerThan(65).and()\n const filter = builder.build()\n\n expect((filter as any).$type).to.equal('IntersectionFilter')\n expect((filter as any).filters[0].$type).to.equal('PatientByHcPartyDateOfBirthBetweenFilter')\n expect((filter as any).filters[1].$type).to.equal('PatientByHcPartyFilter')\n })\n\n it('should not crash miserably on combination of or/and', () => {\n const builder = Filter.patient().youngerThan(65).and().or().olderThan(75)\n const filter = builder.build()\n\n expect((filter as any).$type).to.equal('IntersectionFilter')\n expect((filter as any).filters[0].$type).to.equal('PatientByHcPartyDateOfBirthBetweenFilter')\n expect((filter as any).filters[1].$type).to.equal('PatientByHcPartyDateOfBirthBetweenFilter')\n })\n})\n"]}
@@ -1 +0,0 @@
1
- import 'isomorphic-fetch';
@@ -1,333 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const mocha_1 = require("mocha");
13
- require("isomorphic-fetch");
14
- const chai_1 = require("chai");
15
- const crypto_1 = require("crypto");
16
- const test_utils_1 = require("../../utils/test_utils");
17
- const types_1 = require("@icure/test-setup/types");
18
- const HealthElement_1 = require("../../../icc-api/model/HealthElement");
19
- const Patient_1 = require("../../../icc-api/model/Patient");
20
- const CodeStub_1 = require("../../../icc-api/model/CodeStub");
21
- const Identifier_1 = require("../../../icc-api/model/Identifier");
22
- const HealthElementByHcPartyTagFilter_1 = require("../../../icc-x-api/filters/HealthElementByHcPartyTagFilter");
23
- const HealthElementByHcPartyCodeFilter_1 = require("../../../icc-x-api/filters/HealthElementByHcPartyCodeFilter");
24
- const HealthElementByHcPartyIdentifiersVersioningFilter_1 = require("../../../icc-x-api/filters/HealthElementByHcPartyIdentifiersVersioningFilter");
25
- const HealthElementByHcPartyStatusVersioningFilter_1 = require("../../../icc-x-api/filters/HealthElementByHcPartyStatusVersioningFilter");
26
- const VersionFiltering_1 = require("../../../icc-x-api/filters/VersionFiltering");
27
- (0, test_utils_1.setLocalStorage)(fetch);
28
- let env;
29
- function initHcpApiAndPatient() {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- const { api, user } = yield (0, test_utils_1.createNewHcpApi)(env);
32
- const patient = yield api.patientApi.createPatientWithUser(user, yield api.patientApi.newInstance(user, new Patient_1.Patient({
33
- id: (0, crypto_1.randomUUID)(),
34
- firstName: 'Test',
35
- lastName: 'Patient',
36
- })));
37
- return { api, user, patient };
38
- });
39
- }
40
- describe('HealthElement Filters Tests', () => {
41
- (0, mocha_1.before)(function () {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- this.timeout(600000);
44
- const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
45
- env = yield initializer.execute((0, types_1.getEnvVariables)());
46
- });
47
- });
48
- it('HealthElementByHcPartyTagFilter with VersionFiltering.LATEST should return correct health elements', () => __awaiter(void 0, void 0, void 0, function* () {
49
- // Given - Create a new HCP and initialize the api
50
- const { api, user, patient } = yield initHcpApiAndPatient();
51
- const hcpId = user.healthcarePartyId;
52
- // Target tag to search for
53
- const targetTagType = 'CD-LIFECYCLE';
54
- const targetTagCode = 'active';
55
- const matchingTag = new CodeStub_1.CodeStub({ id: `${targetTagType}|${targetTagCode}|1`, type: targetTagType, code: targetTagCode, version: '1' });
56
- const nonMatchingTag = new CodeStub_1.CodeStub({ id: 'CD-LIFECYCLE|inactive|1', type: 'CD-LIFECYCLE', code: 'inactive', version: '1' });
57
- // Helper to create and save a health element
58
- function createHealthElement(opts) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- const he = yield api.healthcareElementApi.newInstance(user, patient, new HealthElement_1.HealthElement({
61
- id: (0, crypto_1.randomUUID)(),
62
- healthElementId: opts.healthElementId,
63
- tags: opts.tags,
64
- modified: opts.modified,
65
- note: 'Test health element',
66
- }));
67
- return api.healthcareElementApi.createHealthElementWithUser(user, he);
68
- });
69
- }
70
- // 1. A health element with the matching tag and no healthElementId
71
- const he1 = yield createHealthElement({ tags: [matchingTag] });
72
- // 2. A health element with the matching tag and a healthElementId
73
- const he2HealthElementId = (0, crypto_1.randomUUID)();
74
- const he2 = yield createHealthElement({ tags: [matchingTag], healthElementId: he2HealthElementId });
75
- // 3. Two health elements with same healthElementId, different modified times:
76
- // 3a. lowest modified has matching tag
77
- // 3b. highest modified does not have matching tag (this is the latest version)
78
- const he3HealthElementId = (0, crypto_1.randomUUID)();
79
- const he3a = yield createHealthElement({
80
- tags: [matchingTag],
81
- healthElementId: he3HealthElementId,
82
- modified: 1000,
83
- });
84
- const he3b = yield createHealthElement({
85
- tags: [nonMatchingTag],
86
- healthElementId: he3HealthElementId,
87
- modified: 2000,
88
- });
89
- // 4. Two health elements with same healthElementId, different modified times:
90
- // 4a. lowest modified does not have matching tag
91
- // 4b. highest modified has matching tag (this is the latest version)
92
- const he4HealthElementId = (0, crypto_1.randomUUID)();
93
- const he4a = yield createHealthElement({
94
- tags: [nonMatchingTag],
95
- healthElementId: he4HealthElementId,
96
- modified: 1000,
97
- });
98
- const he4b = yield createHealthElement({
99
- tags: [matchingTag],
100
- healthElementId: he4HealthElementId,
101
- modified: 2000,
102
- });
103
- // 5. A health element without the matching tag and no healthElementId
104
- const he5 = yield createHealthElement({ tags: [nonMatchingTag] });
105
- // 6. A health element without the matching tag and a healthElementId
106
- const he6HealthElementId = (0, crypto_1.randomUUID)();
107
- const he6 = yield createHealthElement({ tags: [nonMatchingTag], healthElementId: he6HealthElementId });
108
- // When - Use the filter with match method
109
- const filter = new HealthElementByHcPartyTagFilter_1.HealthElementByHcPartyTagFilter({
110
- healthcarePartyId: hcpId,
111
- tagType: targetTagType,
112
- tagCode: targetTagCode,
113
- versionFiltering: VersionFiltering_1.VersionFiltering.LATEST,
114
- });
115
- const matchedIds = yield api.healthcareElementApi.matchHealthElementsBy(filter);
116
- // Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6
117
- (0, chai_1.expect)(matchedIds).to.have.members([he1.id, he2.id, he4b.id]);
118
- }));
119
- it('HealthElementByHcPartyCodeFilter with VersionFiltering.LATEST should return correct health elements', () => __awaiter(void 0, void 0, void 0, function* () {
120
- // Given - Create a new HCP and initialize the api
121
- const { api, user, patient } = yield initHcpApiAndPatient();
122
- const hcpId = user.healthcarePartyId;
123
- // Target code to search for
124
- const targetCodeType = 'SNOMED';
125
- const targetCodeCode = '38341003';
126
- const matchingCode = new CodeStub_1.CodeStub({ id: `${targetCodeType}|${targetCodeCode}|2`, type: targetCodeType, code: targetCodeCode, version: '2' });
127
- const nonMatchingCode = new CodeStub_1.CodeStub({ id: 'SNOMED|73211009|2', type: 'SNOMED', code: '73211009', version: '2' });
128
- // Helper to create and save a health element
129
- function createHealthElement(opts) {
130
- return __awaiter(this, void 0, void 0, function* () {
131
- const he = yield api.healthcareElementApi.newInstance(user, patient, new HealthElement_1.HealthElement({
132
- id: (0, crypto_1.randomUUID)(),
133
- healthElementId: opts.healthElementId,
134
- codes: opts.codes,
135
- modified: opts.modified,
136
- note: 'Test health element',
137
- }));
138
- return api.healthcareElementApi.createHealthElementWithUser(user, he);
139
- });
140
- }
141
- // 1. A health element with the matching code and no healthElementId
142
- const he1 = yield createHealthElement({ codes: [matchingCode] });
143
- // 2. A health element with the matching code and a healthElementId
144
- const he2HealthElementId = (0, crypto_1.randomUUID)();
145
- const he2 = yield createHealthElement({ codes: [matchingCode], healthElementId: he2HealthElementId });
146
- // 3. Two health elements with same healthElementId, different modified times:
147
- // 3a. lowest modified has matching code
148
- // 3b. highest modified does not have matching code (this is the latest version)
149
- const he3HealthElementId = (0, crypto_1.randomUUID)();
150
- const he3a = yield createHealthElement({
151
- codes: [matchingCode],
152
- healthElementId: he3HealthElementId,
153
- modified: 1000,
154
- });
155
- const he3b = yield createHealthElement({
156
- codes: [nonMatchingCode],
157
- healthElementId: he3HealthElementId,
158
- modified: 2000,
159
- });
160
- // 4. Two health elements with same healthElementId, different modified times:
161
- // 4a. lowest modified does not have matching code
162
- // 4b. highest modified has matching code (this is the latest version)
163
- const he4HealthElementId = (0, crypto_1.randomUUID)();
164
- const he4a = yield createHealthElement({
165
- codes: [nonMatchingCode],
166
- healthElementId: he4HealthElementId,
167
- modified: 1000,
168
- });
169
- const he4b = yield createHealthElement({
170
- codes: [matchingCode],
171
- healthElementId: he4HealthElementId,
172
- modified: 2000,
173
- });
174
- // 5. A health element without the matching code and no healthElementId
175
- const he5 = yield createHealthElement({ codes: [nonMatchingCode] });
176
- // 6. A health element without the matching code and a healthElementId
177
- const he6HealthElementId = (0, crypto_1.randomUUID)();
178
- const he6 = yield createHealthElement({ codes: [nonMatchingCode], healthElementId: he6HealthElementId });
179
- // When - Use the filter with match method
180
- const filter = new HealthElementByHcPartyCodeFilter_1.HealthElementByHcPartyCodeFilter({
181
- healthcarePartyId: hcpId,
182
- codeType: targetCodeType,
183
- codeCode: targetCodeCode,
184
- versionFiltering: VersionFiltering_1.VersionFiltering.LATEST,
185
- });
186
- const matchedIds = yield api.healthcareElementApi.matchHealthElementsBy(filter);
187
- // Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6
188
- (0, chai_1.expect)(matchedIds).to.have.members([he1.id, he2.id, he4b.id]);
189
- }));
190
- it('HealthElementByHcPartyIdentifiersVersioningFilter with VersionFiltering.LATEST should return correct health elements', () => __awaiter(void 0, void 0, void 0, function* () {
191
- // Given - Create a new HCP and initialize the api
192
- const { api, user, patient } = yield initHcpApiAndPatient();
193
- const hcpId = user.healthcarePartyId;
194
- // Target identifier to search for
195
- const matchingIdentifier = new Identifier_1.Identifier({
196
- system: 'https://www.ehealth.fgov.be/standards/kmehr/id/ehealth',
197
- value: 'test-identifier-123',
198
- });
199
- const nonMatchingIdentifier = new Identifier_1.Identifier({
200
- system: 'https://www.ehealth.fgov.be/standards/kmehr/id/ehealth',
201
- value: 'other-identifier-456',
202
- });
203
- // Helper to create and save a health element
204
- function createHealthElement(opts) {
205
- return __awaiter(this, void 0, void 0, function* () {
206
- const he = yield api.healthcareElementApi.newInstance(user, patient, new HealthElement_1.HealthElement({
207
- id: (0, crypto_1.randomUUID)(),
208
- healthElementId: opts.healthElementId,
209
- identifiers: opts.identifiers,
210
- modified: opts.modified,
211
- note: 'Test health element',
212
- }));
213
- return api.healthcareElementApi.createHealthElementWithUser(user, he);
214
- });
215
- }
216
- // 1. A health element with the matching identifier and no healthElementId
217
- const he1 = yield createHealthElement({ identifiers: [matchingIdentifier] });
218
- // 2. A health element with the matching identifier and a healthElementId
219
- const he2HealthElementId = (0, crypto_1.randomUUID)();
220
- const he2 = yield createHealthElement({ identifiers: [matchingIdentifier], healthElementId: he2HealthElementId });
221
- // 3. Two health elements with same healthElementId, different modified times:
222
- // 3a. lowest modified has matching identifier
223
- // 3b. highest modified does not have matching identifier (this is the latest version)
224
- const he3HealthElementId = (0, crypto_1.randomUUID)();
225
- const he3a = yield createHealthElement({
226
- identifiers: [matchingIdentifier],
227
- healthElementId: he3HealthElementId,
228
- modified: 1000,
229
- });
230
- const he3b = yield createHealthElement({
231
- identifiers: [nonMatchingIdentifier],
232
- healthElementId: he3HealthElementId,
233
- modified: 2000,
234
- });
235
- // 4. Two health elements with same healthElementId, different modified times:
236
- // 4a. lowest modified does not have matching identifier
237
- // 4b. highest modified has matching identifier (this is the latest version)
238
- const he4HealthElementId = (0, crypto_1.randomUUID)();
239
- const he4a = yield createHealthElement({
240
- identifiers: [nonMatchingIdentifier],
241
- healthElementId: he4HealthElementId,
242
- modified: 1000,
243
- });
244
- const he4b = yield createHealthElement({
245
- identifiers: [matchingIdentifier],
246
- healthElementId: he4HealthElementId,
247
- modified: 2000,
248
- });
249
- // 5. A health element without the matching identifier and no healthElementId
250
- const he5 = yield createHealthElement({ identifiers: [nonMatchingIdentifier] });
251
- // 6. A health element without the matching identifier and a healthElementId
252
- const he6HealthElementId = (0, crypto_1.randomUUID)();
253
- const he6 = yield createHealthElement({ identifiers: [nonMatchingIdentifier], healthElementId: he6HealthElementId });
254
- // When - Use the filter with match method
255
- const filter = new HealthElementByHcPartyIdentifiersVersioningFilter_1.HealthElementByHcPartyIdentifiersVersioningFilter({
256
- hcPartyId: hcpId,
257
- identifiers: [matchingIdentifier],
258
- versionFiltering: VersionFiltering_1.VersionFiltering.LATEST,
259
- });
260
- const matchedIds = yield api.healthcareElementApi.matchHealthElementsBy(filter);
261
- // Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6
262
- (0, chai_1.expect)(matchedIds).to.have.members([he1.id, he2.id, he4b.id]);
263
- }));
264
- it('HealthElementByHcPartyStatusVersioningFilter with VersionFiltering.LATEST should return correct health elements', () => __awaiter(void 0, void 0, void 0, function* () {
265
- // Given - Create a new HCP and initialize the api
266
- const { api, user, patient } = yield initHcpApiAndPatient();
267
- const hcpId = user.healthcarePartyId;
268
- // Target status to search for (bit 0: active=0/inactive=1, bit 1: relevant=0/irrelevant=1, bit 2: present=0/absent=1)
269
- const matchingStatus = 0; // active, relevant, present
270
- const nonMatchingStatus = 1; // inactive, relevant, present
271
- // Helper to create and save a health element
272
- function createHealthElement(opts) {
273
- return __awaiter(this, void 0, void 0, function* () {
274
- const he = yield api.healthcareElementApi.newInstance(user, patient, new HealthElement_1.HealthElement({
275
- id: (0, crypto_1.randomUUID)(),
276
- healthElementId: opts.healthElementId,
277
- status: opts.status,
278
- modified: opts.modified,
279
- note: 'Test health element',
280
- }));
281
- return api.healthcareElementApi.createHealthElementWithUser(user, he);
282
- });
283
- }
284
- // 1. A health element with the matching status and no healthElementId
285
- const he1 = yield createHealthElement({ status: matchingStatus });
286
- // 2. A health element with the matching status and a healthElementId
287
- const he2HealthElementId = (0, crypto_1.randomUUID)();
288
- const he2 = yield createHealthElement({ status: matchingStatus, healthElementId: he2HealthElementId });
289
- // 3. Two health elements with same healthElementId, different modified times:
290
- // 3a. lowest modified has matching status
291
- // 3b. highest modified does not have matching status (this is the latest version)
292
- const he3HealthElementId = (0, crypto_1.randomUUID)();
293
- const he3a = yield createHealthElement({
294
- status: matchingStatus,
295
- healthElementId: he3HealthElementId,
296
- modified: 1000,
297
- });
298
- const he3b = yield createHealthElement({
299
- status: nonMatchingStatus,
300
- healthElementId: he3HealthElementId,
301
- modified: 2000,
302
- });
303
- // 4. Two health elements with same healthElementId, different modified times:
304
- // 4a. lowest modified does not have matching status
305
- // 4b. highest modified has matching status (this is the latest version)
306
- const he4HealthElementId = (0, crypto_1.randomUUID)();
307
- const he4a = yield createHealthElement({
308
- status: nonMatchingStatus,
309
- healthElementId: he4HealthElementId,
310
- modified: 1000,
311
- });
312
- const he4b = yield createHealthElement({
313
- status: matchingStatus,
314
- healthElementId: he4HealthElementId,
315
- modified: 2000,
316
- });
317
- // 5. A health element without the matching status and no healthElementId
318
- const he5 = yield createHealthElement({ status: nonMatchingStatus });
319
- // 6. A health element without the matching status and a healthElementId
320
- const he6HealthElementId = (0, crypto_1.randomUUID)();
321
- const he6 = yield createHealthElement({ status: nonMatchingStatus, healthElementId: he6HealthElementId });
322
- // When - Use the filter with match method
323
- const filter = new HealthElementByHcPartyStatusVersioningFilter_1.HealthElementByHcPartyStatusVersioningFilter({
324
- hcPartyId: hcpId,
325
- status: matchingStatus,
326
- versionFiltering: VersionFiltering_1.VersionFiltering.LATEST,
327
- });
328
- const matchedIds = yield api.healthcareElementApi.matchHealthElementsBy(filter);
329
- // Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6
330
- (0, chai_1.expect)(matchedIds).to.have.members([he1.id, he2.id, he4b.id]);
331
- }));
332
- });
333
- //# sourceMappingURL=healthelement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"healthelement.js","sourceRoot":"","sources":["../../../../test/icc-x-api/filters/healthelement.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAA8B;AAC9B,4BAAyB;AACzB,+BAA6B;AAC7B,mCAAmC;AACnC,uDAAoG;AACpG,mDAAmE;AACnE,wEAAoE;AACpE,4DAAwD;AACxD,8DAA0D;AAC1D,kEAA8D;AAC9D,gHAA4G;AAC5G,kHAA8G;AAC9G,oJAAgJ;AAChJ,0IAAsI;AACtI,kFAA8E;AAE9E,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAA;AACtB,IAAI,GAAa,CAAA;AAEjB,SAAe,oBAAoB;;QACjC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,4BAAe,EAAC,GAAG,CAAC,CAAA;QAEhD,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,qBAAqB,CACxD,IAAI,EACJ,MAAM,GAAG,CAAC,UAAU,CAAC,WAAW,CAC9B,IAAI,EACJ,IAAI,iBAAO,CAAC;YACV,EAAE,EAAE,IAAA,mBAAU,GAAE;YAChB,SAAS,EAAE,MAAM;YACjB,QAAQ,EAAE,SAAS;SACpB,CAAC,CACH,CACF,CAAA;QAED,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;IAC/B,CAAC;CAAA;AAED,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,IAAA,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C,EAAE,MAAM,EAAE,iBAAiB,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC,CAAA;QAEzG,0CAA0C;QAC1C,MAAM,MAAM,GAAG,IAAI,2FAA4C,CAAC;YAC9D,SAAS,EAAE,KAAK;YAChB,MAAM,EAAE,cAAc;YACtB,gBAAgB,EAAE,mCAAgB,CAAC,MAAM;SAC1C,CAAC,CAAA;QAEF,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAA;QAE/E,uDAAuD;QACvD,IAAA,aAAM,EAAC,UAAU,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;IAC/D,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { before } from 'mocha'\nimport 'isomorphic-fetch'\nimport { expect } from 'chai'\nimport { randomUUID } from 'crypto'\nimport { getEnvironmentInitializer, setLocalStorage, createNewHcpApi } from '../../utils/test_utils'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\nimport { HealthElement } from '../../../icc-api/model/HealthElement'\nimport { Patient } from '../../../icc-api/model/Patient'\nimport { CodeStub } from '../../../icc-api/model/CodeStub'\nimport { Identifier } from '../../../icc-api/model/Identifier'\nimport { HealthElementByHcPartyTagFilter } from '../../../icc-x-api/filters/HealthElementByHcPartyTagFilter'\nimport { HealthElementByHcPartyCodeFilter } from '../../../icc-x-api/filters/HealthElementByHcPartyCodeFilter'\nimport { HealthElementByHcPartyIdentifiersVersioningFilter } from '../../../icc-x-api/filters/HealthElementByHcPartyIdentifiersVersioningFilter'\nimport { HealthElementByHcPartyStatusVersioningFilter } from '../../../icc-x-api/filters/HealthElementByHcPartyStatusVersioningFilter'\nimport { VersionFiltering } from '../../../icc-x-api/filters/VersionFiltering'\n\nsetLocalStorage(fetch)\nlet env: TestVars\n\nasync function initHcpApiAndPatient() {\n const { api, user } = await createNewHcpApi(env)\n\n const patient = await api.patientApi.createPatientWithUser(\n user,\n await api.patientApi.newInstance(\n user,\n new Patient({\n id: randomUUID(),\n firstName: 'Test',\n lastName: 'Patient',\n })\n )\n )\n\n return { api, user, patient }\n}\n\ndescribe('HealthElement Filters Tests', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n it('HealthElementByHcPartyTagFilter with VersionFiltering.LATEST should return correct health elements', async () => {\n // Given - Create a new HCP and initialize the api\n const { api, user, patient } = await initHcpApiAndPatient()\n const hcpId = user.healthcarePartyId!\n\n // Target tag to search for\n const targetTagType = 'CD-LIFECYCLE'\n const targetTagCode = 'active'\n const matchingTag = new CodeStub({ id: `${targetTagType}|${targetTagCode}|1`, type: targetTagType, code: targetTagCode, version: '1' })\n const nonMatchingTag = new CodeStub({ id: 'CD-LIFECYCLE|inactive|1', type: 'CD-LIFECYCLE', code: 'inactive', version: '1' })\n\n // Helper to create and save a health element\n async function createHealthElement(opts: { tags: CodeStub[]; healthElementId?: string; modified?: number }): Promise<HealthElement> {\n const he = await api.healthcareElementApi.newInstance(\n user,\n patient,\n new HealthElement({\n id: randomUUID(),\n healthElementId: opts.healthElementId,\n tags: opts.tags,\n modified: opts.modified,\n note: 'Test health element',\n })\n )\n return api.healthcareElementApi.createHealthElementWithUser(user, he)\n }\n\n // 1. A health element with the matching tag and no healthElementId\n const he1 = await createHealthElement({ tags: [matchingTag] })\n\n // 2. A health element with the matching tag and a healthElementId\n const he2HealthElementId = randomUUID()\n const he2 = await createHealthElement({ tags: [matchingTag], healthElementId: he2HealthElementId })\n\n // 3. Two health elements with same healthElementId, different modified times:\n // 3a. lowest modified has matching tag\n // 3b. highest modified does not have matching tag (this is the latest version)\n const he3HealthElementId = randomUUID()\n const he3a = await createHealthElement({\n tags: [matchingTag],\n healthElementId: he3HealthElementId,\n modified: 1000,\n })\n const he3b = await createHealthElement({\n tags: [nonMatchingTag],\n healthElementId: he3HealthElementId,\n modified: 2000,\n })\n\n // 4. Two health elements with same healthElementId, different modified times:\n // 4a. lowest modified does not have matching tag\n // 4b. highest modified has matching tag (this is the latest version)\n const he4HealthElementId = randomUUID()\n const he4a = await createHealthElement({\n tags: [nonMatchingTag],\n healthElementId: he4HealthElementId,\n modified: 1000,\n })\n const he4b = await createHealthElement({\n tags: [matchingTag],\n healthElementId: he4HealthElementId,\n modified: 2000,\n })\n\n // 5. A health element without the matching tag and no healthElementId\n const he5 = await createHealthElement({ tags: [nonMatchingTag] })\n\n // 6. A health element without the matching tag and a healthElementId\n const he6HealthElementId = randomUUID()\n const he6 = await createHealthElement({ tags: [nonMatchingTag], healthElementId: he6HealthElementId })\n\n // When - Use the filter with match method\n const filter = new HealthElementByHcPartyTagFilter({\n healthcarePartyId: hcpId,\n tagType: targetTagType,\n tagCode: targetTagCode,\n versionFiltering: VersionFiltering.LATEST,\n })\n\n const matchedIds = await api.healthcareElementApi.matchHealthElementsBy(filter)\n\n // Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6\n expect(matchedIds).to.have.members([he1.id, he2.id, he4b.id])\n })\n\n it('HealthElementByHcPartyCodeFilter with VersionFiltering.LATEST should return correct health elements', async () => {\n // Given - Create a new HCP and initialize the api\n const { api, user, patient } = await initHcpApiAndPatient()\n const hcpId = user.healthcarePartyId!\n\n // Target code to search for\n const targetCodeType = 'SNOMED'\n const targetCodeCode = '38341003'\n const matchingCode = new CodeStub({ id: `${targetCodeType}|${targetCodeCode}|2`, type: targetCodeType, code: targetCodeCode, version: '2' })\n const nonMatchingCode = new CodeStub({ id: 'SNOMED|73211009|2', type: 'SNOMED', code: '73211009', version: '2' })\n\n // Helper to create and save a health element\n async function createHealthElement(opts: { codes: CodeStub[]; healthElementId?: string; modified?: number }): Promise<HealthElement> {\n const he = await api.healthcareElementApi.newInstance(\n user,\n patient,\n new HealthElement({\n id: randomUUID(),\n healthElementId: opts.healthElementId,\n codes: opts.codes,\n modified: opts.modified,\n note: 'Test health element',\n })\n )\n return api.healthcareElementApi.createHealthElementWithUser(user, he)\n }\n\n // 1. A health element with the matching code and no healthElementId\n const he1 = await createHealthElement({ codes: [matchingCode] })\n\n // 2. A health element with the matching code and a healthElementId\n const he2HealthElementId = randomUUID()\n const he2 = await createHealthElement({ codes: [matchingCode], healthElementId: he2HealthElementId })\n\n // 3. Two health elements with same healthElementId, different modified times:\n // 3a. lowest modified has matching code\n // 3b. highest modified does not have matching code (this is the latest version)\n const he3HealthElementId = randomUUID()\n const he3a = await createHealthElement({\n codes: [matchingCode],\n healthElementId: he3HealthElementId,\n modified: 1000,\n })\n const he3b = await createHealthElement({\n codes: [nonMatchingCode],\n healthElementId: he3HealthElementId,\n modified: 2000,\n })\n\n // 4. Two health elements with same healthElementId, different modified times:\n // 4a. lowest modified does not have matching code\n // 4b. highest modified has matching code (this is the latest version)\n const he4HealthElementId = randomUUID()\n const he4a = await createHealthElement({\n codes: [nonMatchingCode],\n healthElementId: he4HealthElementId,\n modified: 1000,\n })\n const he4b = await createHealthElement({\n codes: [matchingCode],\n healthElementId: he4HealthElementId,\n modified: 2000,\n })\n\n // 5. A health element without the matching code and no healthElementId\n const he5 = await createHealthElement({ codes: [nonMatchingCode] })\n\n // 6. A health element without the matching code and a healthElementId\n const he6HealthElementId = randomUUID()\n const he6 = await createHealthElement({ codes: [nonMatchingCode], healthElementId: he6HealthElementId })\n\n // When - Use the filter with match method\n const filter = new HealthElementByHcPartyCodeFilter({\n healthcarePartyId: hcpId,\n codeType: targetCodeType,\n codeCode: targetCodeCode,\n versionFiltering: VersionFiltering.LATEST,\n })\n\n const matchedIds = await api.healthcareElementApi.matchHealthElementsBy(filter)\n\n // Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6\n expect(matchedIds).to.have.members([he1.id, he2.id, he4b.id])\n })\n\n it('HealthElementByHcPartyIdentifiersVersioningFilter with VersionFiltering.LATEST should return correct health elements', async () => {\n // Given - Create a new HCP and initialize the api\n const { api, user, patient } = await initHcpApiAndPatient()\n const hcpId = user.healthcarePartyId!\n\n // Target identifier to search for\n const matchingIdentifier = new Identifier({\n system: 'https://www.ehealth.fgov.be/standards/kmehr/id/ehealth',\n value: 'test-identifier-123',\n })\n const nonMatchingIdentifier = new Identifier({\n system: 'https://www.ehealth.fgov.be/standards/kmehr/id/ehealth',\n value: 'other-identifier-456',\n })\n\n // Helper to create and save a health element\n async function createHealthElement(opts: { identifiers: Identifier[]; healthElementId?: string; modified?: number }): Promise<HealthElement> {\n const he = await api.healthcareElementApi.newInstance(\n user,\n patient,\n new HealthElement({\n id: randomUUID(),\n healthElementId: opts.healthElementId,\n identifiers: opts.identifiers,\n modified: opts.modified,\n note: 'Test health element',\n })\n )\n return api.healthcareElementApi.createHealthElementWithUser(user, he)\n }\n\n // 1. A health element with the matching identifier and no healthElementId\n const he1 = await createHealthElement({ identifiers: [matchingIdentifier] })\n\n // 2. A health element with the matching identifier and a healthElementId\n const he2HealthElementId = randomUUID()\n const he2 = await createHealthElement({ identifiers: [matchingIdentifier], healthElementId: he2HealthElementId })\n\n // 3. Two health elements with same healthElementId, different modified times:\n // 3a. lowest modified has matching identifier\n // 3b. highest modified does not have matching identifier (this is the latest version)\n const he3HealthElementId = randomUUID()\n const he3a = await createHealthElement({\n identifiers: [matchingIdentifier],\n healthElementId: he3HealthElementId,\n modified: 1000,\n })\n const he3b = await createHealthElement({\n identifiers: [nonMatchingIdentifier],\n healthElementId: he3HealthElementId,\n modified: 2000,\n })\n\n // 4. Two health elements with same healthElementId, different modified times:\n // 4a. lowest modified does not have matching identifier\n // 4b. highest modified has matching identifier (this is the latest version)\n const he4HealthElementId = randomUUID()\n const he4a = await createHealthElement({\n identifiers: [nonMatchingIdentifier],\n healthElementId: he4HealthElementId,\n modified: 1000,\n })\n const he4b = await createHealthElement({\n identifiers: [matchingIdentifier],\n healthElementId: he4HealthElementId,\n modified: 2000,\n })\n\n // 5. A health element without the matching identifier and no healthElementId\n const he5 = await createHealthElement({ identifiers: [nonMatchingIdentifier] })\n\n // 6. A health element without the matching identifier and a healthElementId\n const he6HealthElementId = randomUUID()\n const he6 = await createHealthElement({ identifiers: [nonMatchingIdentifier], healthElementId: he6HealthElementId })\n\n // When - Use the filter with match method\n const filter = new HealthElementByHcPartyIdentifiersVersioningFilter({\n hcPartyId: hcpId,\n identifiers: [matchingIdentifier],\n versionFiltering: VersionFiltering.LATEST,\n })\n\n const matchedIds = await api.healthcareElementApi.matchHealthElementsBy(filter)\n\n // Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6\n expect(matchedIds).to.have.members([he1.id, he2.id, he4b.id])\n })\n\n it('HealthElementByHcPartyStatusVersioningFilter with VersionFiltering.LATEST should return correct health elements', async () => {\n // Given - Create a new HCP and initialize the api\n const { api, user, patient } = await initHcpApiAndPatient()\n const hcpId = user.healthcarePartyId!\n\n // Target status to search for (bit 0: active=0/inactive=1, bit 1: relevant=0/irrelevant=1, bit 2: present=0/absent=1)\n const matchingStatus = 0 // active, relevant, present\n const nonMatchingStatus = 1 // inactive, relevant, present\n\n // Helper to create and save a health element\n async function createHealthElement(opts: { status: number; healthElementId?: string; modified?: number }): Promise<HealthElement> {\n const he = await api.healthcareElementApi.newInstance(\n user,\n patient,\n new HealthElement({\n id: randomUUID(),\n healthElementId: opts.healthElementId,\n status: opts.status,\n modified: opts.modified,\n note: 'Test health element',\n })\n )\n return api.healthcareElementApi.createHealthElementWithUser(user, he)\n }\n\n // 1. A health element with the matching status and no healthElementId\n const he1 = await createHealthElement({ status: matchingStatus })\n\n // 2. A health element with the matching status and a healthElementId\n const he2HealthElementId = randomUUID()\n const he2 = await createHealthElement({ status: matchingStatus, healthElementId: he2HealthElementId })\n\n // 3. Two health elements with same healthElementId, different modified times:\n // 3a. lowest modified has matching status\n // 3b. highest modified does not have matching status (this is the latest version)\n const he3HealthElementId = randomUUID()\n const he3a = await createHealthElement({\n status: matchingStatus,\n healthElementId: he3HealthElementId,\n modified: 1000,\n })\n const he3b = await createHealthElement({\n status: nonMatchingStatus,\n healthElementId: he3HealthElementId,\n modified: 2000,\n })\n\n // 4. Two health elements with same healthElementId, different modified times:\n // 4a. lowest modified does not have matching status\n // 4b. highest modified has matching status (this is the latest version)\n const he4HealthElementId = randomUUID()\n const he4a = await createHealthElement({\n status: nonMatchingStatus,\n healthElementId: he4HealthElementId,\n modified: 1000,\n })\n const he4b = await createHealthElement({\n status: matchingStatus,\n healthElementId: he4HealthElementId,\n modified: 2000,\n })\n\n // 5. A health element without the matching status and no healthElementId\n const he5 = await createHealthElement({ status: nonMatchingStatus })\n\n // 6. A health element without the matching status and a healthElementId\n const he6HealthElementId = randomUUID()\n const he6 = await createHealthElement({ status: nonMatchingStatus, healthElementId: he6HealthElementId })\n\n // When - Use the filter with match method\n const filter = new HealthElementByHcPartyStatusVersioningFilter({\n hcPartyId: hcpId,\n status: matchingStatus,\n versionFiltering: VersionFiltering.LATEST,\n })\n\n const matchedIds = await api.healthcareElementApi.matchHealthElementsBy(filter)\n\n // Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6\n expect(matchedIds).to.have.members([he1.id, he2.id, he4b.id])\n })\n})\n"]}
@@ -1 +0,0 @@
1
- import 'isomorphic-fetch';