@icure/api 8.11.0 → 8.13.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 (302) hide show
  1. package/icc-api/api/IccUserApi.d.ts +1 -1
  2. package/icc-api/api/IccUserApi.js +2 -2
  3. package/icc-api/api/IccUserApi.js.map +1 -1
  4. package/icc-api/model/HealthElement.d.ts +11 -0
  5. package/icc-api/model/HealthElement.js.map +1 -1
  6. package/icc-api/model/HealthElementAsserter.d.ts +33 -0
  7. package/icc-api/model/HealthElementAsserter.js +28 -0
  8. package/icc-api/model/HealthElementAsserter.js.map +1 -0
  9. package/icc-api/model/HealthElementQualifiedLink.d.ts +31 -0
  10. package/icc-api/model/HealthElementQualifiedLink.js +26 -0
  11. package/icc-api/model/HealthElementQualifiedLink.js.map +1 -0
  12. package/icc-api/model/models.d.ts +2 -0
  13. package/icc-api/model/models.js +2 -0
  14. package/icc-api/model/models.js.map +1 -1
  15. package/icc-x-api/filters/HealthElementByAssociationIdFilter.d.ts +23 -0
  16. package/icc-x-api/filters/HealthElementByAssociationIdFilter.js +30 -0
  17. package/icc-x-api/filters/HealthElementByAssociationIdFilter.js.map +1 -0
  18. package/icc-x-api/filters/HealthElementByQualifiedLinkFilter.d.ts +24 -0
  19. package/icc-x-api/filters/HealthElementByQualifiedLinkFilter.js +30 -0
  20. package/icc-x-api/filters/HealthElementByQualifiedLinkFilter.js.map +1 -0
  21. package/icc-x-api/filters/filters.d.ts +2 -0
  22. package/icc-x-api/filters/filters.js +2 -0
  23. package/icc-x-api/filters/filters.js.map +1 -1
  24. package/icc-x-api/index.js +1 -1
  25. package/icc-x-api/index.js.map +1 -1
  26. package/package.json +1 -1
  27. package/test/benchmarks/lzma-benchmark.spec.d.ts +0 -1
  28. package/test/benchmarks/lzma-benchmark.spec.js +0 -131
  29. package/test/benchmarks/lzma-benchmark.spec.js.map +0 -1
  30. package/test/benchmarks/lzma-compat.spec.d.ts +0 -1
  31. package/test/benchmarks/lzma-compat.spec.js +0 -187
  32. package/test/benchmarks/lzma-compat.spec.js.map +0 -1
  33. package/test/benchmarks/playwright.config.d.ts +0 -2
  34. package/test/benchmarks/playwright.config.js +0 -18
  35. package/test/benchmarks/playwright.config.js.map +0 -1
  36. package/test/icc-api/api/IccAgendaApi.d.ts +0 -1
  37. package/test/icc-api/api/IccAgendaApi.js +0 -64
  38. package/test/icc-api/api/IccAgendaApi.js.map +0 -1
  39. package/test/icc-api/api/IccAnonymousAccessApi.d.ts +0 -1
  40. package/test/icc-api/api/IccAnonymousAccessApi.js +0 -58
  41. package/test/icc-api/api/IccAnonymousAccessApi.js.map +0 -1
  42. package/test/icc-api/api/IccCalendarItemApi.d.ts +0 -1
  43. package/test/icc-api/api/IccCalendarItemApi.js +0 -67
  44. package/test/icc-api/api/IccCalendarItemApi.js.map +0 -1
  45. package/test/icc-api/api/IccCalendarItemTypeApi.d.ts +0 -1
  46. package/test/icc-api/api/IccCalendarItemTypeApi.js +0 -96
  47. package/test/icc-api/api/IccCalendarItemTypeApi.js.map +0 -1
  48. package/test/icc-api/api/IccCodeApi.d.ts +0 -1
  49. package/test/icc-api/api/IccCodeApi.js +0 -38
  50. package/test/icc-api/api/IccCodeApi.js.map +0 -1
  51. package/test/icc-api/api/IccDocumentApi.d.ts +0 -1
  52. package/test/icc-api/api/IccDocumentApi.js +0 -199
  53. package/test/icc-api/api/IccDocumentApi.js.map +0 -1
  54. package/test/icc-api/api/IccGroupApi.d.ts +0 -1
  55. package/test/icc-api/api/IccGroupApi.js +0 -50
  56. package/test/icc-api/api/IccGroupApi.js.map +0 -1
  57. package/test/icc-api/api/IccKeywordApi.d.ts +0 -1
  58. package/test/icc-api/api/IccKeywordApi.js +0 -64
  59. package/test/icc-api/api/IccKeywordApi.js.map +0 -1
  60. package/test/icc-api/api/IccMedicalLocationApi.d.ts +0 -1
  61. package/test/icc-api/api/IccMedicalLocationApi.js +0 -64
  62. package/test/icc-api/api/IccMedicalLocationApi.js.map +0 -1
  63. package/test/icc-api/api/IccPlaceApi.d.ts +0 -1
  64. package/test/icc-api/api/IccPlaceApi.js +0 -64
  65. package/test/icc-api/api/IccPlaceApi.js.map +0 -1
  66. package/test/icc-api/api/IccRecoveryDataApi.d.ts +0 -1
  67. package/test/icc-api/api/IccRecoveryDataApi.js +0 -95
  68. package/test/icc-api/api/IccRecoveryDataApi.js.map +0 -1
  69. package/test/icc-api/api/IccRoleApi.d.ts +0 -1
  70. package/test/icc-api/api/IccRoleApi.js +0 -34
  71. package/test/icc-api/api/IccRoleApi.js.map +0 -1
  72. package/test/icc-api/api/IccUserApi.d.ts +0 -1
  73. package/test/icc-api/api/IccUserApi.js +0 -96
  74. package/test/icc-api/api/IccUserApi.js.map +0 -1
  75. package/test/icc-api/e2e/IccCalendarItemApi.d.ts +0 -1
  76. package/test/icc-api/e2e/IccCalendarItemApi.js +0 -46
  77. package/test/icc-api/e2e/IccCalendarItemApi.js.map +0 -1
  78. package/test/icc-api/model/modelHelpersTest.d.ts +0 -1
  79. package/test/icc-api/model/modelHelpersTest.js +0 -45
  80. package/test/icc-api/model/modelHelpersTest.js.map +0 -1
  81. package/test/icc-x-api/auth/group-switch-test.d.ts +0 -1
  82. package/test/icc-x-api/auth/group-switch-test.js +0 -81
  83. package/test/icc-x-api/auth/group-switch-test.js.map +0 -1
  84. package/test/icc-x-api/auth/jwt-concurrency-test.d.ts +0 -2
  85. package/test/icc-x-api/auth/jwt-concurrency-test.js +0 -112
  86. package/test/icc-x-api/auth/jwt-concurrency-test.js.map +0 -1
  87. package/test/icc-x-api/auth/jwt-provider-test.d.ts +0 -1
  88. package/test/icc-x-api/auth/jwt-provider-test.js +0 -197
  89. package/test/icc-x-api/auth/jwt-provider-test.js.map +0 -1
  90. package/test/icc-x-api/auth/smart-auth-provider-test.d.ts +0 -1
  91. package/test/icc-x-api/auth/smart-auth-provider-test.js +0 -224
  92. package/test/icc-x-api/auth/smart-auth-provider-test.js.map +0 -1
  93. package/test/icc-x-api/autofix-anonymity-test.d.ts +0 -1
  94. package/test/icc-x-api/autofix-anonymity-test.js +0 -122
  95. package/test/icc-x-api/autofix-anonymity-test.js.map +0 -1
  96. package/test/icc-x-api/confidential-entities-test.d.ts +0 -1
  97. package/test/icc-x-api/confidential-entities-test.js +0 -168
  98. package/test/icc-x-api/confidential-entities-test.js.map +0 -1
  99. package/test/icc-x-api/crud/comprehensive-crud-test.d.ts +0 -1
  100. package/test/icc-x-api/crud/comprehensive-crud-test.js +0 -276
  101. package/test/icc-x-api/crud/comprehensive-crud-test.js.map +0 -1
  102. package/test/icc-x-api/crud/entities-crud-test-interface.d.ts +0 -16
  103. package/test/icc-x-api/crud/entities-crud-test-interface.js +0 -407
  104. package/test/icc-x-api/crud/entities-crud-test-interface.js.map +0 -1
  105. package/test/icc-x-api/crypto/anonymous-delegations-test.d.ts +0 -1
  106. package/test/icc-x-api/crypto/anonymous-delegations-test.js +0 -587
  107. package/test/icc-x-api/crypto/anonymous-delegations-test.js.map +0 -1
  108. package/test/icc-x-api/crypto/concurrency.d.ts +0 -1
  109. package/test/icc-x-api/crypto/concurrency.js +0 -35
  110. package/test/icc-x-api/crypto/concurrency.js.map +0 -1
  111. package/test/icc-x-api/crypto/crypto-utils.d.ts +0 -1
  112. package/test/icc-x-api/crypto/crypto-utils.js +0 -79
  113. package/test/icc-x-api/crypto/crypto-utils.js.map +0 -1
  114. package/test/icc-x-api/crypto/cryptoTest.d.ts +0 -2
  115. package/test/icc-x-api/crypto/cryptoTest.js +0 -402
  116. package/test/icc-x-api/crypto/cryptoTest.js.map +0 -1
  117. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.d.ts +0 -1
  118. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js +0 -166
  119. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js.map +0 -1
  120. package/test/icc-x-api/crypto/exchange-data-manager-test.d.ts +0 -1
  121. package/test/icc-x-api/crypto/exchange-data-manager-test.js +0 -674
  122. package/test/icc-x-api/crypto/exchange-data-manager-test.js.map +0 -1
  123. package/test/icc-x-api/crypto/full-crypto-test.d.ts +0 -1
  124. package/test/icc-x-api/crypto/full-crypto-test.js +0 -454
  125. package/test/icc-x-api/crypto/full-crypto-test.js.map +0 -1
  126. package/test/icc-x-api/crypto/legacy-metadata-migration-test.d.ts +0 -1
  127. package/test/icc-x-api/crypto/legacy-metadata-migration-test.js +0 -379
  128. package/test/icc-x-api/crypto/legacy-metadata-migration-test.js.map +0 -1
  129. package/test/icc-x-api/crypto/secure-delegations-manager-test.d.ts +0 -1
  130. package/test/icc-x-api/crypto/secure-delegations-manager-test.js +0 -278
  131. package/test/icc-x-api/crypto/secure-delegations-manager-test.js.map +0 -1
  132. package/test/icc-x-api/crypto/shamir.d.ts +0 -2
  133. package/test/icc-x-api/crypto/shamir.js +0 -167
  134. package/test/icc-x-api/crypto/shamir.js.map +0 -1
  135. package/test/icc-x-api/crypto/share-deduplication-test.d.ts +0 -1
  136. package/test/icc-x-api/crypto/share-deduplication-test.js +0 -250
  137. package/test/icc-x-api/crypto/share-deduplication-test.js.map +0 -1
  138. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.d.ts +0 -1
  139. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js +0 -71
  140. package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js.map +0 -1
  141. package/test/icc-x-api/crypto/soft-deleted-data-owners.d.ts +0 -2
  142. package/test/icc-x-api/crypto/soft-deleted-data-owners.js +0 -113
  143. package/test/icc-x-api/crypto/soft-deleted-data-owners.js.map +0 -1
  144. package/test/icc-x-api/crypto/user-encryption-keys-manager-test.d.ts +0 -1
  145. package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js +0 -246
  146. package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js.map +0 -1
  147. package/test/icc-x-api/entity-with-attachments-api-test.d.ts +0 -1
  148. package/test/icc-x-api/entity-with-attachments-api-test.js +0 -142
  149. package/test/icc-x-api/entity-with-attachments-api-test.js.map +0 -1
  150. package/test/icc-x-api/filters/filters.d.ts +0 -1
  151. package/test/icc-x-api/filters/filters.js +0 -49
  152. package/test/icc-x-api/filters/filters.js.map +0 -1
  153. package/test/icc-x-api/filters/healthelement.d.ts +0 -1
  154. package/test/icc-x-api/filters/healthelement.js +0 -333
  155. package/test/icc-x-api/filters/healthelement.js.map +0 -1
  156. package/test/icc-x-api/icc-accesslog-x-api.d.ts +0 -1
  157. package/test/icc-x-api/icc-accesslog-x-api.js +0 -106
  158. package/test/icc-x-api/icc-accesslog-x-api.js.map +0 -1
  159. package/test/icc-x-api/icc-application-settings-x-api.d.ts +0 -1
  160. package/test/icc-x-api/icc-application-settings-x-api.js +0 -91
  161. package/test/icc-x-api/icc-application-settings-x-api.js.map +0 -1
  162. package/test/icc-x-api/icc-auth-api.d.ts +0 -1
  163. package/test/icc-x-api/icc-auth-api.js +0 -47
  164. package/test/icc-x-api/icc-auth-api.js.map +0 -1
  165. package/test/icc-x-api/icc-calendar-item-x-api.d.ts +0 -1
  166. package/test/icc-x-api/icc-calendar-item-x-api.js +0 -150
  167. package/test/icc-x-api/icc-calendar-item-x-api.js.map +0 -1
  168. package/test/icc-x-api/icc-code-x-api-test.d.ts +0 -1
  169. package/test/icc-x-api/icc-code-x-api-test.js +0 -74
  170. package/test/icc-x-api/icc-code-x-api-test.js.map +0 -1
  171. package/test/icc-x-api/icc-contact-x-api.d.ts +0 -1
  172. package/test/icc-x-api/icc-contact-x-api.js +0 -355
  173. package/test/icc-x-api/icc-contact-x-api.js.map +0 -1
  174. package/test/icc-x-api/icc-document-x-api.d.ts +0 -1
  175. package/test/icc-x-api/icc-document-x-api.js +0 -76
  176. package/test/icc-x-api/icc-document-x-api.js.map +0 -1
  177. package/test/icc-x-api/icc-form-x-api.d.ts +0 -1
  178. package/test/icc-x-api/icc-form-x-api.js +0 -413
  179. package/test/icc-x-api/icc-form-x-api.js.map +0 -1
  180. package/test/icc-x-api/icc-hcparty-x-api-test.d.ts +0 -1
  181. package/test/icc-x-api/icc-hcparty-x-api-test.js +0 -43
  182. package/test/icc-x-api/icc-hcparty-x-api-test.js.map +0 -1
  183. package/test/icc-x-api/icc-helement-x-api-test.d.ts +0 -1
  184. package/test/icc-x-api/icc-helement-x-api-test.js +0 -155
  185. package/test/icc-x-api/icc-helement-x-api-test.js.map +0 -1
  186. package/test/icc-x-api/icc-invoice-x-api.d.ts +0 -1
  187. package/test/icc-x-api/icc-invoice-x-api.js +0 -99
  188. package/test/icc-x-api/icc-invoice-x-api.js.map +0 -1
  189. package/test/icc-x-api/icc-maintenance-task-x-api-test.d.ts +0 -1
  190. package/test/icc-x-api/icc-maintenance-task-x-api-test.js +0 -222
  191. package/test/icc-x-api/icc-maintenance-task-x-api-test.js.map +0 -1
  192. package/test/icc-x-api/icc-message-x-api.d.ts +0 -1
  193. package/test/icc-x-api/icc-message-x-api.js +0 -54
  194. package/test/icc-x-api/icc-message-x-api.js.map +0 -1
  195. package/test/icc-x-api/icc-patient-x-api-test.d.ts +0 -1
  196. package/test/icc-x-api/icc-patient-x-api-test.js +0 -209
  197. package/test/icc-x-api/icc-patient-x-api-test.js.map +0 -1
  198. package/test/icc-x-api/icc-recovery-x-api.d.ts +0 -1
  199. package/test/icc-x-api/icc-recovery-x-api.js +0 -175
  200. package/test/icc-x-api/icc-recovery-x-api.js.map +0 -1
  201. package/test/icc-x-api/icc-topic-x-api.d.ts +0 -1
  202. package/test/icc-x-api/icc-topic-x-api.js +0 -269
  203. package/test/icc-x-api/icc-topic-x-api.js.map +0 -1
  204. package/test/icc-x-api/icc-user-x-api-test.d.ts +0 -1
  205. package/test/icc-x-api/icc-user-x-api-test.js +0 -99
  206. package/test/icc-x-api/icc-user-x-api-test.js.map +0 -1
  207. package/test/icc-x-api/keyless-api.d.ts +0 -1
  208. package/test/icc-x-api/keyless-api.js +0 -125
  209. package/test/icc-x-api/keyless-api.js.map +0 -1
  210. package/test/icc-x-api/patient-user.d.ts +0 -2
  211. package/test/icc-x-api/patient-user.js +0 -103
  212. package/test/icc-x-api/patient-user.js.map +0 -1
  213. package/test/icc-x-api/storage/storage.d.ts +0 -1
  214. package/test/icc-x-api/storage/storage.js +0 -48
  215. package/test/icc-x-api/storage/storage.js.map +0 -1
  216. package/test/icc-x-api/test-api-no-parent.d.ts +0 -1
  217. package/test/icc-x-api/test-api-no-parent.js +0 -79
  218. package/test/icc-x-api/test-api-no-parent.js.map +0 -1
  219. package/test/icc-x-api/test-legacy-data-support.d.ts +0 -1
  220. package/test/icc-x-api/test-legacy-data-support.js +0 -375
  221. package/test/icc-x-api/test-legacy-data-support.js.map +0 -1
  222. package/test/icc-x-api/utils/date-encode-test.d.ts +0 -1
  223. package/test/icc-x-api/utils/date-encode-test.js +0 -150
  224. package/test/icc-x-api/utils/date-encode-test.js.map +0 -1
  225. package/test/icc-x-api/utils/graph-test.d.ts +0 -1
  226. package/test/icc-x-api/utils/graph-test.js +0 -54
  227. package/test/icc-x-api/utils/graph-test.js.map +0 -1
  228. package/test/icc-x-api/utils/lru-temporised-async-cache-test.d.ts +0 -1
  229. package/test/icc-x-api/utils/lru-temporised-async-cache-test.js +0 -364
  230. package/test/icc-x-api/utils/lru-temporised-async-cache-test.js.map +0 -1
  231. package/test/icc-x-api/utils/lzma-benchmark-test.d.ts +0 -1
  232. package/test/icc-x-api/utils/lzma-benchmark-test.js +0 -132
  233. package/test/icc-x-api/utils/lzma-benchmark-test.js.map +0 -1
  234. package/test/icc-x-api/utils/lzma-compat-test.d.ts +0 -1
  235. package/test/icc-x-api/utils/lzma-compat-test.js +0 -218
  236. package/test/icc-x-api/utils/lzma-compat-test.js.map +0 -1
  237. package/test/icc-x-api/utils/mutex-test.d.ts +0 -1
  238. package/test/icc-x-api/utils/mutex-test.js +0 -114
  239. package/test/icc-x-api/utils/mutex-test.js.map +0 -1
  240. package/test/icc-x-api/utils/to-moment-test.d.ts +0 -1
  241. package/test/icc-x-api/utils/to-moment-test.js +0 -110
  242. package/test/icc-x-api/utils/to-moment-test.js.map +0 -1
  243. package/test/support/CSM-185.d.ts +0 -1
  244. package/test/support/CSM-185.js +0 -124
  245. package/test/support/CSM-185.js.map +0 -1
  246. package/test/support/CSM-243.d.ts +0 -1
  247. package/test/support/CSM-243.js +0 -120
  248. package/test/support/CSM-243.js.map +0 -1
  249. package/test/support/CSM-543.d.ts +0 -1
  250. package/test/support/CSM-543.js +0 -164
  251. package/test/support/CSM-543.js.map +0 -1
  252. package/test/support/CSM-729.d.ts +0 -1
  253. package/test/support/CSM-729.js +0 -225
  254. package/test/support/CSM-729.js.map +0 -1
  255. package/test/support/CSM-814.d.ts +0 -1
  256. package/test/support/CSM-814.js +0 -475
  257. package/test/support/CSM-814.js.map +0 -1
  258. package/test/support/CSM-87.d.ts +0 -0
  259. package/test/support/CSM-87.js +0 -21
  260. package/test/support/CSM-87.js.map +0 -1
  261. package/test/support/CSM-93.d.ts +0 -1
  262. package/test/support/CSM-93.js +0 -112
  263. package/test/support/CSM-93.js.map +0 -1
  264. package/test/utils/FakeDataOwnerApi.d.ts +0 -32
  265. package/test/utils/FakeDataOwnerApi.js +0 -136
  266. package/test/utils/FakeDataOwnerApi.js.map +0 -1
  267. package/test/utils/FakeEncryptionKeysManager.d.ts +0 -36
  268. package/test/utils/FakeEncryptionKeysManager.js +0 -97
  269. package/test/utils/FakeEncryptionKeysManager.js.map +0 -1
  270. package/test/utils/FakeExchangeDataApi.d.ts +0 -32
  271. package/test/utils/FakeExchangeDataApi.js +0 -92
  272. package/test/utils/FakeExchangeDataApi.js.map +0 -1
  273. package/test/utils/FakeExchangeDataManager.d.ts +0 -48
  274. package/test/utils/FakeExchangeDataManager.js +0 -82
  275. package/test/utils/FakeExchangeDataManager.js.map +0 -1
  276. package/test/utils/FakeExchangeDataMapManager.d.ts +0 -12
  277. package/test/utils/FakeExchangeDataMapManager.js +0 -38
  278. package/test/utils/FakeExchangeDataMapManager.js.map +0 -1
  279. package/test/utils/FakeGenericApi.d.ts +0 -16
  280. package/test/utils/FakeGenericApi.js +0 -65
  281. package/test/utils/FakeGenericApi.js.map +0 -1
  282. package/test/utils/KeylessCryptoStrategies.d.ts +0 -23
  283. package/test/utils/KeylessCryptoStrategies.js +0 -26
  284. package/test/utils/KeylessCryptoStrategies.js.map +0 -1
  285. package/test/utils/TestApi.d.ts +0 -3
  286. package/test/utils/TestApi.js +0 -30
  287. package/test/utils/TestApi.js.map +0 -1
  288. package/test/utils/TestCollectionUtils.d.ts +0 -1
  289. package/test/utils/TestCollectionUtils.js +0 -310
  290. package/test/utils/TestCollectionUtils.js.map +0 -1
  291. package/test/utils/TestCryptoStrategies.d.ts +0 -42
  292. package/test/utils/TestCryptoStrategies.js +0 -80
  293. package/test/utils/TestCryptoStrategies.js.map +0 -1
  294. package/test/utils/TestStorage.d.ts +0 -23
  295. package/test/utils/TestStorage.js +0 -61
  296. package/test/utils/TestStorage.js.map +0 -1
  297. package/test/utils/roles.d.ts +0 -14
  298. package/test/utils/roles.js +0 -345
  299. package/test/utils/roles.js.map +0 -1
  300. package/test/utils/test_utils.d.ts +0 -87
  301. package/test/utils/test_utils.js +0 -452
  302. package/test/utils/test_utils.js.map +0 -1
@@ -1,452 +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
- var _a, _b, _c, _d;
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.TestUtils = exports.deviceUsername = exports.patUsername = exports.hcp3Username = exports.hcp2Username = exports.hcp1Username = void 0;
14
- exports.getTempEmail = getTempEmail;
15
- exports.setLocalStorage = setLocalStorage;
16
- exports.getEnvironmentInitializer = getEnvironmentInitializer;
17
- exports.getApiAndAddPrivateKeysForUser = getApiAndAddPrivateKeysForUser;
18
- exports.createNewHcpApi = createNewHcpApi;
19
- exports.createNewPatientApi = createNewPatientApi;
20
- exports.createNewKeylessApi = createNewKeylessApi;
21
- exports.createHcpHierarchyApis = createHcpHierarchyApis;
22
- exports.createNewHcpWithoutKeyAndParentWithKey = createNewHcpWithoutKeyAndParentWithKey;
23
- exports.testSetupMasterApi = testSetupMasterApi;
24
- exports.createUserInMultipleGroups = createUserInMultipleGroups;
25
- exports.isLiteTest = isLiteTest;
26
- exports.describeNoLite = describeNoLite;
27
- exports.itNoLite = itNoLite;
28
- const icc_x_api_1 = require("../../icc-x-api");
29
- const os_1 = require("os");
30
- const util_1 = require("util");
31
- const uuid_1 = require("uuid");
32
- const crypto_1 = require("crypto");
33
- const TestApi_1 = require("./TestApi");
34
- const apiV7_1 = require("@icure/apiV7");
35
- const TestStorage_1 = require("./TestStorage");
36
- const TestCryptoStrategies_1 = require("./TestCryptoStrategies");
37
- const User_1 = require("../../icc-api/model/User");
38
- const builder_1 = require("@icure/test-setup/builder");
39
- const types_1 = require("@icure/test-setup/types");
40
- require("isomorphic-fetch");
41
- const creation_1 = require("@icure/test-setup/creation");
42
- const icc_api_1 = require("../../icc-api");
43
- const mocha_1 = require("mocha");
44
- const Patient_1 = require("../../icc-api/model/Patient");
45
- const KeylessCryptoStrategies_1 = require("./KeylessCryptoStrategies");
46
- const roles_1 = require("./roles");
47
- function getTempEmail() {
48
- return `${(0, uuid_1.v4)().substring(0, 8)}@icure.com`;
49
- }
50
- function setLocalStorage(fetch) {
51
- ;
52
- global.localStorage = new (require('node-localstorage').LocalStorage)((0, os_1.tmpdir)(), 5 * Math.pow(1024, 3));
53
- global.fetch = fetch;
54
- global.Storage = '';
55
- global.TextDecoder = util_1.TextDecoder;
56
- global.TextEncoder = util_1.TextEncoder;
57
- global.headers = Headers;
58
- }
59
- exports.hcp1Username = (_a = process.env.ICURE_TS_TEST_HCP_USER) !== null && _a !== void 0 ? _a : getTempEmail();
60
- exports.hcp2Username = (_b = process.env.ICURE_TS_TEST_HCP_2_USER) !== null && _b !== void 0 ? _b : getTempEmail();
61
- exports.hcp3Username = (_c = process.env.ICURE_TS_TEST_HCP_3_USER) !== null && _c !== void 0 ? _c : getTempEmail();
62
- exports.patUsername = (_d = process.env.ICURE_TS_TEST_PAT_USER) !== null && _d !== void 0 ? _d : getTempEmail();
63
- exports.deviceUsername = getTempEmail();
64
- let cachedInitializer;
65
- function getEnvironmentInitializer() {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- if (!cachedInitializer) {
68
- const env = (0, types_1.getEnvVariables)();
69
- const scratchDir = 'test/scratch';
70
- const baseEnvironment = env.testEnvironment === 'docker' || env.testEnvironment === 'oss'
71
- ? new builder_1.TestEnvironmentBuilder().setUpDockerEnvironment(scratchDir, ['mock'])
72
- : new builder_1.TestEnvironmentBuilder();
73
- cachedInitializer = yield baseEnvironment
74
- .withGroup(fetch, {
75
- patient: ['BASIC_USER', 'BASIC_DATA_OWNER'],
76
- hcp: [
77
- 'BASIC_USER',
78
- 'BASIC_DATA_OWNER',
79
- 'PATIENT_USER_MANAGER',
80
- 'HIERARCHICAL_DATA_OWNER',
81
- 'TOPIC_MANAGER',
82
- 'TOPIC_PARTICIPANT',
83
- 'LEGACY_MESSAGE_MANAGER',
84
- ],
85
- device: ['BASIC_USER', 'BASIC_DATA_OWNER'],
86
- user: ['BASIC_USER'],
87
- })
88
- .withMasterUser(fetch)
89
- .withRoles(roles_1.defaultRoles)
90
- .addHcp({ login: exports.hcp1Username })
91
- .addHcp({ login: exports.hcp2Username })
92
- .addHcp({ login: exports.hcp3Username })
93
- .addPatient({ login: exports.patUsername })
94
- .addDevice({ login: exports.deviceUsername })
95
- .withSafeguard()
96
- .withEnvironmentSummary()
97
- .build();
98
- }
99
- return cachedInitializer;
100
- });
101
- }
102
- var TestUtils;
103
- (function (TestUtils) {
104
- function initApi(envVars_1) {
105
- return __awaiter(this, arguments, void 0, function* (envVars, userName = exports.hcp1Username, options) {
106
- return yield getApiAndAddPrivateKeysForUser(envVars.iCureUrl, envVars.dataOwnerDetails[userName], options);
107
- });
108
- }
109
- TestUtils.initApi = initApi;
110
- function initMasterApi(envVars, options) {
111
- return __awaiter(this, void 0, void 0, function* () {
112
- return yield getApiAndAddPrivateKeysForUser(envVars.iCureUrl, envVars.masterHcp, options);
113
- });
114
- }
115
- TestUtils.initMasterApi = initMasterApi;
116
- })(TestUtils || (exports.TestUtils = TestUtils = {}));
117
- function getApiAndAddPrivateKeysForUser(iCureUrl, details, options) {
118
- return __awaiter(this, void 0, void 0, function* () {
119
- const RSA = new icc_x_api_1.RSAUtilsImpl(crypto_1.webcrypto);
120
- const keys = {
121
- publicKey: yield RSA.importKey('spki', (0, icc_x_api_1.ua2ab)((0, icc_x_api_1.hex2ua)(details.publicKey)), ['encrypt'], icc_x_api_1.ShaVersion.Sha1),
122
- privateKey: yield RSA.importKey('pkcs8', (0, icc_x_api_1.ua2ab)((0, icc_x_api_1.hex2ua)(details.privateKey)), ['decrypt'], icc_x_api_1.ShaVersion.Sha1),
123
- };
124
- return yield (0, TestApi_1.TestApi)(iCureUrl, details.user, details.password, crypto_1.webcrypto, keys, options);
125
- });
126
- }
127
- function createHealthcarePartyUser(api, userLogin, userToken, publicKey, privateKey) {
128
- return __awaiter(this, void 0, void 0, function* () {
129
- const { publicKey: newPublicKey, privateKey: newPrivateKey } = yield api.cryptoApi.RSA.generateKeyPair();
130
- const publicKeyHex = !!publicKey && !!privateKey ? publicKey : (0, icc_x_api_1.ua2hex)(yield api.cryptoApi.RSA.exportKey(newPublicKey, 'spki'));
131
- const privateKeyHex = !!publicKey && !!privateKey ? privateKey : (0, icc_x_api_1.ua2hex)(yield api.cryptoApi.RSA.exportKey(newPrivateKey, 'pkcs8'));
132
- const hcp = yield api.healthcarePartyApi.createHealthcareParty({
133
- id: (0, uuid_1.v4)(),
134
- firstName: (0, uuid_1.v4)().substring(0, 6),
135
- lastName: (0, uuid_1.v4)().substring(0, 6),
136
- publicKey: publicKeyHex,
137
- });
138
- const hcpUser = yield api.userApi.createUser(new User_1.User({
139
- id: (0, uuid_1.v4)(),
140
- name: userLogin,
141
- login: userLogin,
142
- email: userLogin,
143
- healthcarePartyId: hcp.id,
144
- }));
145
- const token = yield api.userApi.getToken(hcpUser.id, (0, uuid_1.v4)(), 24 * 60 * 60, userToken);
146
- return {
147
- user: hcpUser.login,
148
- dataOwnerId: hcp.id,
149
- password: token,
150
- publicKey: publicKeyHex,
151
- privateKey: privateKeyHex,
152
- };
153
- });
154
- }
155
- function createNewHcpApi(env_1) {
156
- return __awaiter(this, arguments, void 0, function* (env, options = {}) {
157
- const initialisationApi = yield testSetupMasterApi(env);
158
- const primitives = new icc_x_api_1.WebCryptoPrimitives(crypto_1.webcrypto);
159
- const credentials = yield createHealthcarePartyUser(initialisationApi, `user-${primitives.randomUuid()}@icure.com`, primitives.randomUuid());
160
- const storage = yield (0, TestStorage_1.testStorageWithKeys)([
161
- {
162
- dataOwnerId: credentials.dataOwnerId,
163
- pairs: [{ keyPair: { privateKey: credentials.privateKey, publicKey: credentials.publicKey }, shaVersion: icc_x_api_1.ShaVersion.Sha1 }],
164
- },
165
- ]);
166
- const api = yield icc_x_api_1.IcureApi.initialise(env.iCureUrl, { username: credentials.user, password: credentials.password }, new TestCryptoStrategies_1.TestCryptoStrategies(), crypto_1.webcrypto, fetch, {
167
- storage: storage.storage,
168
- keyStorage: storage.keyStorage,
169
- entryKeysFactory: storage.keyFactory,
170
- encryptedFieldsConfig: options.encryptedFieldsConfig,
171
- });
172
- return { api, credentials, user: yield api.userApi.getCurrentUser() };
173
- });
174
- }
175
- function createNewPatientApi(env) {
176
- return __awaiter(this, void 0, void 0, function* () {
177
- const initialisationApi = yield testSetupMasterApi(env);
178
- const primitives = new icc_x_api_1.WebCryptoPrimitives(crypto_1.webcrypto);
179
- const credentials = yield (0, creation_1.createPatientUser)(initialisationApi, `user-${primitives.randomUuid()}@icure.com`, primitives.randomUuid());
180
- const storage = yield (0, TestStorage_1.testStorageWithKeys)([
181
- {
182
- dataOwnerId: credentials.dataOwnerId,
183
- pairs: [{ keyPair: { privateKey: credentials.privateKey, publicKey: credentials.publicKey }, shaVersion: icc_x_api_1.ShaVersion.Sha1 }],
184
- },
185
- ]);
186
- const api = yield icc_x_api_1.IcureApi.initialise(env.iCureUrl, { username: credentials.user, password: credentials.password }, new TestCryptoStrategies_1.TestCryptoStrategies(), crypto_1.webcrypto, fetch, {
187
- storage: storage.storage,
188
- keyStorage: storage.keyStorage,
189
- entryKeysFactory: storage.keyFactory,
190
- });
191
- return { api, credentials, user: yield api.userApi.getCurrentUser() };
192
- });
193
- }
194
- function createNewKeylessApi(env) {
195
- return __awaiter(this, void 0, void 0, function* () {
196
- const initialisationApi = yield icc_x_api_1.IcureBasicApi.initialise(env.iCureUrl, { username: env.masterHcp.user, password: env.masterHcp.password }, fetch);
197
- const login = `${(0, crypto_1.randomUUID)()}@test.icure.com`;
198
- const password = (0, crypto_1.randomUUID)();
199
- const patient = new Patient_1.Patient({
200
- id: (0, crypto_1.randomUUID)(),
201
- firstName: 'Gino',
202
- lastName: 'Pino',
203
- });
204
- const user = new User_1.User({
205
- id: (0, crypto_1.randomUUID)(),
206
- login,
207
- passwordHash: password,
208
- patientId: patient.id,
209
- });
210
- yield initialisationApi.userApi.createUser(user);
211
- yield initialisationApi.patientApi.createPatient(patient);
212
- const credentials = { username: login, password };
213
- const cryptoStrategies = new KeylessCryptoStrategies_1.KeylessCryptoStrategies();
214
- const api = yield icc_x_api_1.IcureApi.initialise(env.iCureUrl, credentials, cryptoStrategies, crypto_1.webcrypto, fetch, {});
215
- if (!cryptoStrategies.requestedKey)
216
- throw new Error('Illegal state: did not request key');
217
- return { api, credentials };
218
- });
219
- }
220
- /**
221
- * Creates a hierarchy of HCPs with the following structure:
222
- * grand HCP -+-> parent HCP ---> child HCP
223
- * |
224
- * +-> child2 HCP
225
- */
226
- function createHcpHierarchyApis(env_1) {
227
- return __awaiter(this, arguments, void 0, function* (env, setupAutodelegations = true, disableParentKeysInitialisation = false) {
228
- const shaVersion = icc_x_api_1.ShaVersion.Sha1;
229
- const initialisationApi = yield testSetupMasterApi(env);
230
- const primitives = new icc_x_api_1.WebCryptoPrimitives(crypto_1.webcrypto);
231
- const grandCredentials = yield createHealthcarePartyUser(initialisationApi, `grand-${primitives.randomUuid()}@icure.com`, primitives.randomUuid());
232
- const parentCredentials = yield createHealthcarePartyUser(initialisationApi, `parent-${primitives.randomUuid()}@icure.com`, primitives.randomUuid());
233
- const childCredentials = yield createHealthcarePartyUser(initialisationApi, `child-${primitives.randomUuid()}@icure.com`, primitives.randomUuid());
234
- const child2Credentials = yield createHealthcarePartyUser(initialisationApi, `child2-${primitives.randomUuid()}@icure.com`, primitives.randomUuid());
235
- yield initialisationApi.healthcarePartyApi.modifyHealthcareParty(Object.assign(Object.assign({}, (yield initialisationApi.healthcarePartyApi.getHealthcareParty(parentCredentials.dataOwnerId))), { parentId: grandCredentials.dataOwnerId }));
236
- yield initialisationApi.healthcarePartyApi.modifyHealthcareParty(Object.assign(Object.assign({}, (yield initialisationApi.healthcarePartyApi.getHealthcareParty(childCredentials.dataOwnerId))), { parentId: parentCredentials.dataOwnerId }));
237
- yield initialisationApi.healthcarePartyApi.modifyHealthcareParty(Object.assign(Object.assign({}, (yield initialisationApi.healthcarePartyApi.getHealthcareParty(child2Credentials.dataOwnerId))), { parentId: grandCredentials.dataOwnerId }));
238
- const grandStorage = yield (0, TestStorage_1.testStorageWithKeys)([
239
- {
240
- dataOwnerId: grandCredentials.dataOwnerId,
241
- pairs: [{ keyPair: { privateKey: grandCredentials.privateKey, publicKey: grandCredentials.publicKey }, shaVersion: shaVersion }],
242
- },
243
- ]);
244
- const grandApi = yield icc_x_api_1.IcureApi.initialise(env.iCureUrl, { username: grandCredentials.user, password: grandCredentials.password }, new TestCryptoStrategies_1.TestCryptoStrategies(), crypto_1.webcrypto, fetch, {
245
- storage: grandStorage.storage,
246
- keyStorage: grandStorage.keyStorage,
247
- entryKeysFactory: grandStorage.keyFactory,
248
- disableParentKeysInitialisation,
249
- });
250
- const parentStorage = yield (0, TestStorage_1.testStorageWithKeys)([
251
- {
252
- dataOwnerId: grandCredentials.dataOwnerId,
253
- pairs: [{ keyPair: { privateKey: grandCredentials.privateKey, publicKey: grandCredentials.publicKey }, shaVersion: shaVersion }],
254
- },
255
- {
256
- dataOwnerId: parentCredentials.dataOwnerId,
257
- pairs: [{ keyPair: { privateKey: parentCredentials.privateKey, publicKey: parentCredentials.publicKey }, shaVersion: shaVersion }],
258
- },
259
- ]);
260
- const parentApi = yield icc_x_api_1.IcureApi.initialise(env.iCureUrl, { username: parentCredentials.user, password: parentCredentials.password }, new TestCryptoStrategies_1.TestCryptoStrategies(), crypto_1.webcrypto, fetch, {
261
- storage: parentStorage.storage,
262
- keyStorage: parentStorage.keyStorage,
263
- entryKeysFactory: parentStorage.keyFactory,
264
- disableParentKeysInitialisation,
265
- });
266
- const parentUser = setupAutodelegations
267
- ? yield parentApi.userApi.modifyUser(Object.assign(Object.assign({}, (yield parentApi.userApi.getCurrentUser())), { autoDelegations: { all: [grandCredentials.dataOwnerId] } }))
268
- : yield parentApi.userApi.getCurrentUser();
269
- const childStorage = yield (0, TestStorage_1.testStorageWithKeys)([
270
- {
271
- dataOwnerId: grandCredentials.dataOwnerId,
272
- pairs: [{ keyPair: { privateKey: grandCredentials.privateKey, publicKey: grandCredentials.publicKey }, shaVersion: shaVersion }],
273
- },
274
- {
275
- dataOwnerId: parentCredentials.dataOwnerId,
276
- pairs: [{ keyPair: { privateKey: parentCredentials.privateKey, publicKey: parentCredentials.publicKey }, shaVersion: shaVersion }],
277
- },
278
- {
279
- dataOwnerId: childCredentials.dataOwnerId,
280
- pairs: [{ keyPair: { privateKey: childCredentials.privateKey, publicKey: childCredentials.publicKey }, shaVersion: shaVersion }],
281
- },
282
- ]);
283
- const childApi = yield icc_x_api_1.IcureApi.initialise(env.iCureUrl, { username: childCredentials.user, password: childCredentials.password }, new TestCryptoStrategies_1.TestCryptoStrategies(), crypto_1.webcrypto, fetch, {
284
- storage: childStorage.storage,
285
- keyStorage: childStorage.keyStorage,
286
- entryKeysFactory: childStorage.keyFactory,
287
- disableParentKeysInitialisation,
288
- });
289
- const childUser = setupAutodelegations
290
- ? yield childApi.userApi.modifyUser(Object.assign(Object.assign({}, (yield childApi.userApi.getCurrentUser())), { autoDelegations: { all: [grandCredentials.dataOwnerId, parentCredentials.dataOwnerId] } }))
291
- : yield childApi.userApi.getCurrentUser();
292
- const child2Storage = yield (0, TestStorage_1.testStorageWithKeys)([
293
- {
294
- dataOwnerId: grandCredentials.dataOwnerId,
295
- pairs: [{ keyPair: { privateKey: grandCredentials.privateKey, publicKey: grandCredentials.publicKey }, shaVersion: shaVersion }],
296
- },
297
- {
298
- dataOwnerId: child2Credentials.dataOwnerId,
299
- pairs: [{ keyPair: { privateKey: child2Credentials.privateKey, publicKey: child2Credentials.publicKey }, shaVersion: shaVersion }],
300
- },
301
- ]);
302
- const child2Api = yield icc_x_api_1.IcureApi.initialise(env.iCureUrl, { username: child2Credentials.user, password: child2Credentials.password }, new TestCryptoStrategies_1.TestCryptoStrategies(), crypto_1.webcrypto, fetch, {
303
- storage: child2Storage.storage,
304
- keyStorage: child2Storage.keyStorage,
305
- entryKeysFactory: child2Storage.keyFactory,
306
- disableParentKeysInitialisation,
307
- });
308
- const child2User = setupAutodelegations
309
- ? yield child2Api.userApi.modifyUser(Object.assign(Object.assign({}, (yield child2Api.userApi.getCurrentUser())), { autoDelegations: { all: [grandCredentials.dataOwnerId] } }))
310
- : yield child2Api.userApi.getCurrentUser();
311
- return {
312
- grandApi,
313
- grandUser: yield grandApi.userApi.getCurrentUser(),
314
- grandCredentials,
315
- parentApi,
316
- parentUser,
317
- parentCredentials,
318
- childApi,
319
- childUser,
320
- childCredentials,
321
- child2Api,
322
- child2User,
323
- child2Credentials,
324
- };
325
- });
326
- }
327
- /**
328
- * Create a parent HCP with a key and a child HCP without any initialised key
329
- */
330
- function createNewHcpWithoutKeyAndParentWithKey(env_1) {
331
- return __awaiter(this, arguments, void 0, function* (env, props = {}) {
332
- const initialisationApi = yield testSetupMasterApi(env);
333
- const primitives = new icc_x_api_1.WebCryptoPrimitives(crypto_1.webcrypto);
334
- const parentCredentials = yield createHealthcarePartyUser(initialisationApi, `parent-${primitives.randomUuid()}@icure.com`, primitives.randomUuid());
335
- const childUser = (0, uuid_1.v4)() + '@email.com';
336
- const childPassword = (0, uuid_1.v4)();
337
- const childHcp = {
338
- id: (0, uuid_1.v4)(),
339
- firstName: (0, uuid_1.v4)().substring(0, 6),
340
- lastName: (0, uuid_1.v4)().substring(0, 6),
341
- parentId: parentCredentials.dataOwnerId,
342
- publicKey: undefined,
343
- };
344
- if (props.initialiseEmptyKeyForChild) {
345
- childHcp.publicKey = '';
346
- }
347
- yield initialisationApi.healthcarePartyApi.createHealthcareParty(childHcp);
348
- yield initialisationApi.userApi.createUser(new User_1.User({
349
- id: (0, uuid_1.v4)(),
350
- name: childUser,
351
- login: childUser,
352
- email: childUser,
353
- passwordHash: childPassword,
354
- healthcarePartyId: childHcp.id,
355
- }));
356
- return {
357
- parentCredentials,
358
- childUser,
359
- childPassword,
360
- childDataOwnerId: childHcp.id,
361
- };
362
- });
363
- }
364
- function testSetupMasterApi(env) {
365
- return apiV7_1.IcureApi.initialise(env.iCureUrl, { username: env.masterHcp.user, password: env.masterHcp.password }, {
366
- generateNewKeyForDataOwner() {
367
- return Promise.resolve(true);
368
- },
369
- recoverAndVerifySelfHierarchyKeys() {
370
- throw new Error('Unsupported');
371
- },
372
- verifyDelegatePublicKeys(delegate, publicKeys) {
373
- return Promise.resolve(publicKeys);
374
- },
375
- }, crypto_1.webcrypto, fetch);
376
- }
377
- function createUserInMultipleGroups(env) {
378
- return __awaiter(this, void 0, void 0, function* () {
379
- const primitives = new icc_x_api_1.WebCryptoPrimitives(crypto_1.webcrypto);
380
- const userGroup1Id = primitives.randomUuid(); // Same username-pw as group 2
381
- const userGroup2Id = primitives.randomUuid(); // Same username-pw as group 1
382
- const userGroup3Id = primitives.randomUuid(); // Same username as group 1/2, different pw
383
- const userLogin = `maria-${primitives.randomUuid()}@pompei.it`;
384
- const userPw12 = `geppetto-${primitives.randomUuid()}`;
385
- const userPw3 = `pinocchio-${primitives.randomUuid()}`;
386
- const user1Id = primitives.randomUuid();
387
- const user2Id = primitives.randomUuid();
388
- const user3Id = primitives.randomUuid();
389
- const api = yield icc_x_api_1.IcureBasicApi.initialise(env.iCureUrl, { username: 'john', password: 'LetMeIn' }, fetch); // pragma: allowlist secret
390
- const group1 = yield api.groupApi.createGroup(userGroup1Id, `test-group-1-${primitives.randomUuid()}`, primitives.randomUuid(), undefined, undefined, undefined, undefined, undefined, {});
391
- const group2 = yield api.groupApi.createGroup(userGroup2Id, `test-group-2-${primitives.randomUuid()}`, primitives.randomUuid(), undefined, undefined, undefined, undefined, undefined, {});
392
- const group3 = yield api.groupApi.createGroup(userGroup3Id, `test-group-3-${primitives.randomUuid()}`, primitives.randomUuid(), undefined, undefined, undefined, undefined, undefined, {});
393
- const user1 = yield api.userApi.createUserInGroup(userGroup1Id, {
394
- id: user1Id,
395
- name: userLogin,
396
- login: userLogin,
397
- email: userLogin,
398
- passwordHash: userPw12,
399
- });
400
- const user2 = yield api.userApi.createUserInGroup(userGroup2Id, {
401
- id: user2Id,
402
- name: userLogin,
403
- login: userLogin,
404
- email: userLogin,
405
- passwordHash: userPw12,
406
- });
407
- const user3 = yield api.userApi.createUserInGroup(userGroup3Id, {
408
- id: user3Id,
409
- name: userLogin,
410
- login: userLogin,
411
- email: userLogin,
412
- passwordHash: userPw3,
413
- });
414
- console.log(`Waiting for user to be created - ${userLogin}`);
415
- yield (0, icc_x_api_1.retry)(() => __awaiter(this, void 0, void 0, function* () {
416
- yield new icc_api_1.IccUserApi(env.iCureUrl, {}, new icc_x_api_1.BasicAuthenticationProvider(`${userGroup1Id}/${user1Id}`, userPw12), fetch).getCurrentUser();
417
- yield new icc_api_1.IccUserApi(env.iCureUrl, {}, new icc_x_api_1.BasicAuthenticationProvider(`${userGroup2Id}/${user2Id}`, userPw12), fetch).getCurrentUser();
418
- yield new icc_api_1.IccUserApi(env.iCureUrl, {}, new icc_x_api_1.BasicAuthenticationProvider(`${userGroup3Id}/${user3Id}`, userPw3), fetch).getCurrentUser();
419
- }), 10, 5000, 1);
420
- return {
421
- user1,
422
- user2,
423
- user3,
424
- group1,
425
- group2,
426
- group3,
427
- userPw12,
428
- userPw3,
429
- userLogin,
430
- };
431
- });
432
- }
433
- function isLiteTest() {
434
- return (0, types_1.getEnvVariables)().testEnvironment == 'oss';
435
- }
436
- function describeNoLite(title, fn) {
437
- if (isLiteTest()) {
438
- return mocha_1.describe.skip(title, fn);
439
- }
440
- else {
441
- return (0, mocha_1.describe)(title, fn);
442
- }
443
- }
444
- function itNoLite(title, fn) {
445
- if (isLiteTest()) {
446
- return it.skip(title, fn);
447
- }
448
- else {
449
- return it(title, fn);
450
- }
451
- }
452
- //# sourceMappingURL=test_utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test_utils.js","sourceRoot":"","sources":["../../../test/utils/test_utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAwCA,oCAEC;AAED,0CAOC;AAWD,8DAoCC;AAYD,wEAOC;AAuCD,0CAiCC;AAED,kDA2BC;AAED,kDAyBC;AAQD,wDAiKC;AAKD,wFA2CC;AAED,gDAkBC;AAaD,gEAwFC;AAED,gCAEC;AAED,wCAMC;AAED,4BAMC;AA3lBD,+CAawB;AACxB,2BAA2B;AAC3B,+BAA+C;AAC/C,+BAAiC;AACjC,mCAA8C;AAC9C,uCAAmC;AACnC,wCAAuD;AACvD,+CAAmD;AACnD,iEAA6D;AAC7D,mDAA+C;AAC/C,uDAAkE;AAClE,mDAAgF;AAEhF,4BAAy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IAC5B,CAAC;AACH,CAAC;AAED,SAAgB,QAAQ,CAAC,KAAa,EAAE,EAAuC;IAC7E,IAAI,UAAU,EAAE,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IAC3B,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACtB,CAAC;AACH,CAAC","sourcesContent":["import {\n BasicAuthenticationProvider,\n EncryptedFieldsConfig,\n hex2ua,\n IcureApi,\n IcureApiOptions,\n IcureBasicApi,\n retry,\n RSAUtilsImpl,\n ShaVersion,\n ua2ab,\n ua2hex,\n WebCryptoPrimitives,\n} from '../../icc-x-api'\nimport { tmpdir } from 'os'\nimport { TextDecoder, TextEncoder } from 'util'\nimport { v4 as uuid } from 'uuid'\nimport { randomUUID, webcrypto } from 'crypto'\nimport { TestApi } from './TestApi'\nimport { IcureApi as TestSetupApi } from '@icure/apiV7'\nimport { testStorageWithKeys } from './TestStorage'\nimport { TestCryptoStrategies } from './TestCryptoStrategies'\nimport { User } from '../../icc-api/model/User'\nimport { TestEnvironmentBuilder } from '@icure/test-setup/builder'\nimport { getEnvVariables, TestVars, UserDetails } from '@icure/test-setup/types'\nimport { EnvInitializer } from '@icure/test-setup/decorators'\nimport 'isomorphic-fetch'\nimport { createPatientUser } from '@icure/test-setup/creation'\nimport { IccUserApi } from '../../icc-api'\nimport { Context, describe, Suite, Test } from 'mocha'\nimport { Group } from '../../icc-api/model/Group'\nimport { Patient } from '../../icc-api/model/Patient'\nimport { CryptoActorStubWithType } from '../../icc-api/model/CryptoActorStub'\nimport { DataOwnerTypeEnum } from '../../icc-api/model/DataOwnerTypeEnum'\nimport { DataOwnerWithType } from '../../icc-api/model/DataOwnerWithType'\nimport { KeyPairRecoverer } from '../../icc-x-api/crypto/KeyPairRecoverer'\nimport { KeylessCryptoStrategies } from './KeylessCryptoStrategies'\nimport { XHR } from '../../icc-api/api/XHR'\nimport { defaultRoles } from './roles'\n\nexport function getTempEmail(): string {\n return `${uuid().substring(0, 8)}@icure.com`\n}\n\nexport function setLocalStorage(fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>) {\n ;(global as any).localStorage = new (require('node-localstorage').LocalStorage)(tmpdir(), 5 * 1024 ** 3)\n ;(global as any).fetch = fetch\n ;(global as any).Storage = ''\n ;(global as any).TextDecoder = TextDecoder\n ;(global as any).TextEncoder = TextEncoder\n ;(global as any).headers = Headers\n}\n\nexport const hcp1Username = process.env.ICURE_TS_TEST_HCP_USER ?? getTempEmail()\nexport const hcp2Username = process.env.ICURE_TS_TEST_HCP_2_USER ?? getTempEmail()\nexport const hcp3Username = process.env.ICURE_TS_TEST_HCP_3_USER ?? getTempEmail()\nexport const patUsername = process.env.ICURE_TS_TEST_PAT_USER ?? getTempEmail()\n\nexport const deviceUsername = getTempEmail()\n\nlet cachedInitializer: EnvInitializer | undefined\n\nexport async function getEnvironmentInitializer(): Promise<EnvInitializer> {\n if (!cachedInitializer) {\n const env = getEnvVariables()\n const scratchDir = 'test/scratch'\n\n const baseEnvironment =\n env.testEnvironment === 'docker' || env.testEnvironment === 'oss'\n ? new TestEnvironmentBuilder().setUpDockerEnvironment(scratchDir, ['mock'])\n : new TestEnvironmentBuilder()\n cachedInitializer = await baseEnvironment\n .withGroup(fetch, {\n patient: ['BASIC_USER', 'BASIC_DATA_OWNER'],\n hcp: [\n 'BASIC_USER',\n 'BASIC_DATA_OWNER',\n 'PATIENT_USER_MANAGER',\n 'HIERARCHICAL_DATA_OWNER',\n 'TOPIC_MANAGER',\n 'TOPIC_PARTICIPANT',\n 'LEGACY_MESSAGE_MANAGER',\n ],\n device: ['BASIC_USER', 'BASIC_DATA_OWNER'],\n user: ['BASIC_USER'],\n })\n .withMasterUser(fetch)\n .withRoles(defaultRoles)\n .addHcp({ login: hcp1Username })\n .addHcp({ login: hcp2Username })\n .addHcp({ login: hcp3Username })\n .addPatient({ login: patUsername })\n .addDevice({ login: deviceUsername })\n .withSafeguard()\n .withEnvironmentSummary()\n .build()\n }\n return cachedInitializer\n}\n\nexport namespace TestUtils {\n export async function initApi(envVars: TestVars, userName: string = hcp1Username, options?: IcureApiOptions): Promise<IcureApi> {\n return await getApiAndAddPrivateKeysForUser(envVars.iCureUrl, envVars.dataOwnerDetails[userName], options)\n }\n\n export async function initMasterApi(envVars: TestVars, options?: IcureApiOptions): Promise<IcureApi> {\n return await getApiAndAddPrivateKeysForUser(envVars.iCureUrl, envVars.masterHcp!, options)\n }\n}\n\nexport async function getApiAndAddPrivateKeysForUser(iCureUrl: string, details: UserDetails, options?: IcureApiOptions) {\n const RSA = new RSAUtilsImpl(webcrypto as any)\n const keys = {\n publicKey: await RSA.importKey('spki', ua2ab(hex2ua(details.publicKey)), ['encrypt'], ShaVersion.Sha1),\n privateKey: await RSA.importKey('pkcs8', ua2ab(hex2ua(details.privateKey)), ['decrypt'], ShaVersion.Sha1),\n }\n return await TestApi(iCureUrl, details.user, details.password, webcrypto as any, keys, options)\n}\n\nasync function createHealthcarePartyUser(\n api: TestSetupApi,\n userLogin: string,\n userToken: string,\n publicKey?: string,\n privateKey?: string\n): Promise<UserDetails> {\n const { publicKey: newPublicKey, privateKey: newPrivateKey } = await api.cryptoApi.RSA.generateKeyPair()\n\n const publicKeyHex = !!publicKey && !!privateKey ? publicKey : ua2hex(await api.cryptoApi.RSA.exportKey(newPublicKey, 'spki'))\n const privateKeyHex = !!publicKey && !!privateKey ? privateKey : ua2hex(await api.cryptoApi.RSA.exportKey(newPrivateKey, 'pkcs8'))\n\n const hcp = await api.healthcarePartyApi.createHealthcareParty({\n id: uuid(),\n firstName: uuid().substring(0, 6),\n lastName: uuid().substring(0, 6),\n publicKey: publicKeyHex,\n })\n const hcpUser = await api.userApi.createUser(\n new User({\n id: uuid(),\n name: userLogin,\n login: userLogin,\n email: userLogin,\n healthcarePartyId: hcp.id,\n })\n )\n const token = await api.userApi.getToken(hcpUser.id!, uuid(), 24 * 60 * 60, userToken)\n return {\n user: hcpUser.login!,\n dataOwnerId: hcp.id!,\n password: token,\n publicKey: publicKeyHex,\n privateKey: privateKeyHex,\n }\n}\n\nexport async function createNewHcpApi(\n env: TestVars,\n options: {\n encryptedFieldsConfig?: EncryptedFieldsConfig\n } = {}\n): Promise<{\n api: IcureApi\n credentials: UserDetails\n user: User\n}> {\n const initialisationApi = await testSetupMasterApi(env)\n const primitives = new WebCryptoPrimitives(webcrypto as any)\n const credentials = await createHealthcarePartyUser(initialisationApi, `user-${primitives.randomUuid()}@icure.com`, primitives.randomUuid())\n const storage = await testStorageWithKeys([\n {\n dataOwnerId: credentials.dataOwnerId,\n pairs: [{ keyPair: { privateKey: credentials.privateKey, publicKey: credentials.publicKey }, shaVersion: ShaVersion.Sha1 }],\n },\n ])\n const api = await IcureApi.initialise(\n env.iCureUrl,\n { username: credentials.user, password: credentials.password },\n new TestCryptoStrategies(),\n webcrypto as any,\n fetch,\n {\n storage: storage.storage,\n keyStorage: storage.keyStorage,\n entryKeysFactory: storage.keyFactory,\n encryptedFieldsConfig: options.encryptedFieldsConfig,\n }\n )\n return { api, credentials, user: await api.userApi.getCurrentUser() }\n}\n\nexport async function createNewPatientApi(env: TestVars): Promise<{\n api: IcureApi\n credentials: UserDetails\n user: User\n}> {\n const initialisationApi = await testSetupMasterApi(env)\n const primitives = new WebCryptoPrimitives(webcrypto as any)\n const credentials = await createPatientUser(initialisationApi, `user-${primitives.randomUuid()}@icure.com`, primitives.randomUuid())\n const storage = await testStorageWithKeys([\n {\n dataOwnerId: credentials.dataOwnerId,\n pairs: [{ keyPair: { privateKey: credentials.privateKey, publicKey: credentials.publicKey }, shaVersion: ShaVersion.Sha1 }],\n },\n ])\n const api = await IcureApi.initialise(\n env.iCureUrl,\n { username: credentials.user, password: credentials.password },\n new TestCryptoStrategies(),\n webcrypto as any,\n fetch,\n {\n storage: storage.storage,\n keyStorage: storage.keyStorage,\n entryKeysFactory: storage.keyFactory,\n }\n )\n return { api, credentials, user: await api.userApi.getCurrentUser() }\n}\n\nexport async function createNewKeylessApi(env: TestVars): Promise<{\n api: IcureApi\n credentials: { username: string; password: string }\n}> {\n const initialisationApi = await IcureBasicApi.initialise(env.iCureUrl, { username: env.masterHcp!.user, password: env.masterHcp!.password }, fetch)\n const login = `${randomUUID()}@test.icure.com`\n const password = randomUUID()\n const patient = new Patient({\n id: randomUUID(),\n firstName: 'Gino',\n lastName: 'Pino',\n })\n const user = new User({\n id: randomUUID(),\n login,\n passwordHash: password,\n patientId: patient.id,\n })\n await initialisationApi.userApi.createUser(user)\n await initialisationApi.patientApi.createPatient(patient)\n const credentials = { username: login, password }\n const cryptoStrategies = new KeylessCryptoStrategies()\n const api = await IcureApi.initialise(env.iCureUrl, credentials, cryptoStrategies, webcrypto as any, fetch, {})\n if (!cryptoStrategies.requestedKey) throw new Error('Illegal state: did not request key')\n return { api, credentials }\n}\n\n/**\n * Creates a hierarchy of HCPs with the following structure:\n * grand HCP -+-> parent HCP ---> child HCP\n * |\n * +-> child2 HCP\n */\nexport async function createHcpHierarchyApis(\n env: TestVars,\n setupAutodelegations: boolean = true,\n disableParentKeysInitialisation: boolean = false\n): Promise<{\n grandApi: IcureApi\n grandUser: User\n grandCredentials: UserDetails\n parentApi: IcureApi\n parentUser: User\n parentCredentials: UserDetails\n childApi: IcureApi\n childUser: User\n childCredentials: UserDetails\n child2Api: IcureApi\n child2User: User\n child2Credentials: UserDetails\n}> {\n const shaVersion = ShaVersion.Sha1\n const initialisationApi = await testSetupMasterApi(env)\n const primitives = new WebCryptoPrimitives(webcrypto as any)\n const grandCredentials = await createHealthcarePartyUser(initialisationApi, `grand-${primitives.randomUuid()}@icure.com`, primitives.randomUuid())\n const parentCredentials = await createHealthcarePartyUser(initialisationApi, `parent-${primitives.randomUuid()}@icure.com`, primitives.randomUuid())\n const childCredentials = await createHealthcarePartyUser(initialisationApi, `child-${primitives.randomUuid()}@icure.com`, primitives.randomUuid())\n const child2Credentials = await createHealthcarePartyUser(initialisationApi, `child2-${primitives.randomUuid()}@icure.com`, primitives.randomUuid())\n await initialisationApi.healthcarePartyApi.modifyHealthcareParty({\n ...(await initialisationApi.healthcarePartyApi.getHealthcareParty(parentCredentials.dataOwnerId)),\n parentId: grandCredentials.dataOwnerId,\n })\n await initialisationApi.healthcarePartyApi.modifyHealthcareParty({\n ...(await initialisationApi.healthcarePartyApi.getHealthcareParty(childCredentials.dataOwnerId)),\n parentId: parentCredentials.dataOwnerId,\n })\n await initialisationApi.healthcarePartyApi.modifyHealthcareParty({\n ...(await initialisationApi.healthcarePartyApi.getHealthcareParty(child2Credentials.dataOwnerId)),\n parentId: grandCredentials.dataOwnerId,\n })\n const grandStorage = await testStorageWithKeys([\n {\n dataOwnerId: grandCredentials.dataOwnerId,\n pairs: [{ keyPair: { privateKey: grandCredentials.privateKey, publicKey: grandCredentials.publicKey }, shaVersion: shaVersion }],\n },\n ])\n const grandApi = await IcureApi.initialise(\n env.iCureUrl,\n { username: grandCredentials.user, password: grandCredentials.password },\n new TestCryptoStrategies(),\n webcrypto as any,\n fetch,\n {\n storage: grandStorage.storage,\n keyStorage: grandStorage.keyStorage,\n entryKeysFactory: grandStorage.keyFactory,\n disableParentKeysInitialisation,\n }\n )\n const parentStorage = await testStorageWithKeys([\n {\n dataOwnerId: grandCredentials.dataOwnerId,\n pairs: [{ keyPair: { privateKey: grandCredentials.privateKey, publicKey: grandCredentials.publicKey }, shaVersion: shaVersion }],\n },\n {\n dataOwnerId: parentCredentials.dataOwnerId,\n pairs: [{ keyPair: { privateKey: parentCredentials.privateKey, publicKey: parentCredentials.publicKey }, shaVersion: shaVersion }],\n },\n ])\n const parentApi = await IcureApi.initialise(\n env.iCureUrl,\n { username: parentCredentials.user, password: parentCredentials.password },\n new TestCryptoStrategies(),\n webcrypto as any,\n fetch,\n {\n storage: parentStorage.storage,\n keyStorage: parentStorage.keyStorage,\n entryKeysFactory: parentStorage.keyFactory,\n disableParentKeysInitialisation,\n }\n )\n const parentUser = setupAutodelegations\n ? await parentApi.userApi.modifyUser({\n ...(await parentApi.userApi.getCurrentUser()),\n autoDelegations: { all: [grandCredentials.dataOwnerId] },\n })\n : await parentApi.userApi.getCurrentUser()\n const childStorage = await testStorageWithKeys([\n {\n dataOwnerId: grandCredentials.dataOwnerId,\n pairs: [{ keyPair: { privateKey: grandCredentials.privateKey, publicKey: grandCredentials.publicKey }, shaVersion: shaVersion }],\n },\n {\n dataOwnerId: parentCredentials.dataOwnerId,\n pairs: [{ keyPair: { privateKey: parentCredentials.privateKey, publicKey: parentCredentials.publicKey }, shaVersion: shaVersion }],\n },\n {\n dataOwnerId: childCredentials.dataOwnerId,\n pairs: [{ keyPair: { privateKey: childCredentials.privateKey, publicKey: childCredentials.publicKey }, shaVersion: shaVersion }],\n },\n ])\n const childApi = await IcureApi.initialise(\n env.iCureUrl,\n { username: childCredentials.user, password: childCredentials.password },\n new TestCryptoStrategies(),\n webcrypto as any,\n fetch,\n {\n storage: childStorage.storage,\n keyStorage: childStorage.keyStorage,\n entryKeysFactory: childStorage.keyFactory,\n disableParentKeysInitialisation,\n }\n )\n const childUser = setupAutodelegations\n ? await childApi.userApi.modifyUser({\n ...(await childApi.userApi.getCurrentUser()),\n autoDelegations: { all: [grandCredentials.dataOwnerId, parentCredentials.dataOwnerId] },\n })\n : await childApi.userApi.getCurrentUser()\n const child2Storage = await testStorageWithKeys([\n {\n dataOwnerId: grandCredentials.dataOwnerId,\n pairs: [{ keyPair: { privateKey: grandCredentials.privateKey, publicKey: grandCredentials.publicKey }, shaVersion: shaVersion }],\n },\n {\n dataOwnerId: child2Credentials.dataOwnerId,\n pairs: [{ keyPair: { privateKey: child2Credentials.privateKey, publicKey: child2Credentials.publicKey }, shaVersion: shaVersion }],\n },\n ])\n const child2Api = await IcureApi.initialise(\n env.iCureUrl,\n { username: child2Credentials.user, password: child2Credentials.password },\n new TestCryptoStrategies(),\n webcrypto as any,\n fetch,\n {\n storage: child2Storage.storage,\n keyStorage: child2Storage.keyStorage,\n entryKeysFactory: child2Storage.keyFactory,\n disableParentKeysInitialisation,\n }\n )\n const child2User = setupAutodelegations\n ? await child2Api.userApi.modifyUser({\n ...(await child2Api.userApi.getCurrentUser()),\n autoDelegations: { all: [grandCredentials.dataOwnerId] },\n })\n : await child2Api.userApi.getCurrentUser()\n return {\n grandApi,\n grandUser: await grandApi.userApi.getCurrentUser(),\n grandCredentials,\n parentApi,\n parentUser,\n parentCredentials,\n childApi,\n childUser,\n childCredentials,\n child2Api,\n child2User,\n child2Credentials,\n }\n}\n\n/**\n * Create a parent HCP with a key and a child HCP without any initialised key\n */\nexport async function createNewHcpWithoutKeyAndParentWithKey(\n env: TestVars,\n props: {\n initialiseEmptyKeyForChild?: boolean\n } = {}\n): Promise<{\n parentCredentials: UserDetails\n childUser: string\n childDataOwnerId: string\n childPassword: string\n}> {\n const initialisationApi = await testSetupMasterApi(env)\n const primitives = new WebCryptoPrimitives(webcrypto as any)\n const parentCredentials = await createHealthcarePartyUser(initialisationApi, `parent-${primitives.randomUuid()}@icure.com`, primitives.randomUuid())\n const childUser = uuid() + '@email.com'\n const childPassword = uuid()\n const childHcp = {\n id: uuid(),\n firstName: uuid().substring(0, 6),\n lastName: uuid().substring(0, 6),\n parentId: parentCredentials.dataOwnerId,\n publicKey: undefined as string | undefined,\n }\n if (props.initialiseEmptyKeyForChild) {\n childHcp.publicKey = ''\n }\n await initialisationApi.healthcarePartyApi.createHealthcareParty(childHcp)\n await initialisationApi.userApi.createUser(\n new User({\n id: uuid(),\n name: childUser,\n login: childUser,\n email: childUser,\n passwordHash: childPassword,\n healthcarePartyId: childHcp.id,\n })\n )\n return {\n parentCredentials,\n childUser,\n childPassword,\n childDataOwnerId: childHcp.id!,\n }\n}\n\nexport function testSetupMasterApi(env: TestVars): Promise<TestSetupApi> {\n return TestSetupApi.initialise(\n env.iCureUrl,\n { username: env.masterHcp!.user, password: env.masterHcp!.password },\n {\n generateNewKeyForDataOwner(): Promise<boolean> {\n return Promise.resolve(true)\n },\n recoverAndVerifySelfHierarchyKeys(): never {\n throw new Error('Unsupported')\n },\n verifyDelegatePublicKeys(delegate: any, publicKeys: string[]): Promise<string[]> {\n return Promise.resolve(publicKeys)\n },\n },\n webcrypto as any,\n fetch\n )\n}\n\nexport type UserInManyGroupsDetails = {\n user1: User\n user2: User\n group3: Group\n userPw3: string\n user3: User\n group2: Group\n group1: Group\n userPw12: string\n userLogin: string\n}\nexport async function createUserInMultipleGroups(env: TestVars): Promise<UserInManyGroupsDetails> {\n const primitives = new WebCryptoPrimitives(webcrypto as any)\n const userGroup1Id: string = primitives.randomUuid() // Same username-pw as group 2\n const userGroup2Id: string = primitives.randomUuid() // Same username-pw as group 1\n const userGroup3Id: string = primitives.randomUuid() // Same username as group 1/2, different pw\n const userLogin: string = `maria-${primitives.randomUuid()}@pompei.it`\n const userPw12: string = `geppetto-${primitives.randomUuid()}`\n const userPw3: string = `pinocchio-${primitives.randomUuid()}`\n const user1Id: string = primitives.randomUuid()\n const user2Id: string = primitives.randomUuid()\n const user3Id: string = primitives.randomUuid()\n const api = await IcureBasicApi.initialise(env.iCureUrl, { username: 'john', password: 'LetMeIn' }, fetch) // pragma: allowlist secret\n const group1 = await api.groupApi.createGroup(\n userGroup1Id,\n `test-group-1-${primitives.randomUuid()}`,\n primitives.randomUuid(),\n undefined,\n undefined,\n undefined,\n undefined,\n undefined,\n {}\n )\n const group2 = await api.groupApi.createGroup(\n userGroup2Id,\n `test-group-2-${primitives.randomUuid()}`,\n primitives.randomUuid(),\n undefined,\n undefined,\n undefined,\n undefined,\n undefined,\n {}\n )\n const group3 = await api.groupApi.createGroup(\n userGroup3Id,\n `test-group-3-${primitives.randomUuid()}`,\n primitives.randomUuid(),\n undefined,\n undefined,\n undefined,\n undefined,\n undefined,\n {}\n )\n const user1 = await api.userApi.createUserInGroup(userGroup1Id, {\n id: user1Id,\n name: userLogin,\n login: userLogin,\n email: userLogin,\n passwordHash: userPw12,\n })\n const user2 = await api.userApi.createUserInGroup(userGroup2Id, {\n id: user2Id,\n name: userLogin,\n login: userLogin,\n email: userLogin,\n passwordHash: userPw12,\n })\n const user3 = await api.userApi.createUserInGroup(userGroup3Id, {\n id: user3Id,\n name: userLogin,\n login: userLogin,\n email: userLogin,\n passwordHash: userPw3,\n })\n console.log(`Waiting for user to be created - ${userLogin}`)\n await retry(\n async () => {\n await new IccUserApi(env.iCureUrl, {}, new BasicAuthenticationProvider(`${userGroup1Id}/${user1Id}`, userPw12), fetch).getCurrentUser()\n await new IccUserApi(env.iCureUrl, {}, new BasicAuthenticationProvider(`${userGroup2Id}/${user2Id}`, userPw12), fetch).getCurrentUser()\n await new IccUserApi(env.iCureUrl, {}, new BasicAuthenticationProvider(`${userGroup3Id}/${user3Id}`, userPw3), fetch).getCurrentUser()\n },\n 10,\n 5_000,\n 1\n )\n return {\n user1,\n user2,\n user3,\n group1,\n group2,\n group3,\n userPw12,\n userPw3,\n userLogin,\n }\n}\n\nexport function isLiteTest() {\n return getEnvVariables().testEnvironment == 'oss'\n}\n\nexport function describeNoLite(title: string, fn: (this: Suite) => void): Suite | void {\n if (isLiteTest()) {\n return describe.skip(title, fn)\n } else {\n return describe(title, fn)\n }\n}\n\nexport function itNoLite(title: string, fn: (this: Context) => PromiseLike<any>): Test {\n if (isLiteTest()) {\n return it.skip(title, fn)\n } else {\n return it(title, fn)\n }\n}\n"]}