@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,92 +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
- exports.FakeExchangeDataApi = void 0;
13
- const IccExchangeDataApi_1 = require("../../icc-api/api/internal/IccExchangeDataApi");
14
- const ExchangeData_1 = require("../../icc-api/model/internal/ExchangeData");
15
- const PaginatedListExchangeData_1 = require("../../icc-api/model/PaginatedListExchangeData");
16
- const FakeGenericApi_1 = require("./FakeGenericApi");
17
- const PaginatedDocumentKeyIdPairObject_1 = require("../../icc-api/model/PaginatedDocumentKeyIdPairObject");
18
- const _ = require("lodash");
19
- const chai_1 = require("chai");
20
- class FakeExchangeDataApi extends IccExchangeDataApi_1.IccExchangeDataApi {
21
- get callCount() {
22
- return _.cloneDeep(this._callCount);
23
- }
24
- compareCallCountFromBaseline(baseline, expected) {
25
- for (const [key, v] of Object.entries(expected)) {
26
- const curr = this._callCount[key];
27
- const currBaseline = baseline[key];
28
- (0, chai_1.expect)(curr).to.equal(currBaseline + v, `Actual call count for ${key} does not match expected
29
- Current: ${JSON.stringify(this._callCount)}
30
- Baseline: ${JSON.stringify(baseline)}
31
- ExpectedDifference: ${JSON.stringify(expected)}
32
- `);
33
- }
34
- }
35
- constructor() {
36
- super('fake', {}, null, null);
37
- this.data = new FakeGenericApi_1.FakeGenericApi();
38
- this._callCount = {
39
- createExchangeData: 0,
40
- modifyExchangeData: 0,
41
- getExchangeDataByDelegatorDelegate: 0,
42
- getExchangeDataByParticipant: 0,
43
- getExchangeDataByIds: 0,
44
- };
45
- }
46
- createExchangeData(body) {
47
- this._callCount.createExchangeData += 1;
48
- return Promise.resolve(new ExchangeData_1.ExchangeData(this.data.createObject(body)));
49
- }
50
- modifyExchangeData(body) {
51
- this._callCount.modifyExchangeData += 1;
52
- return Promise.resolve(new ExchangeData_1.ExchangeData(this.data.modifyObject(body)));
53
- }
54
- getExchangeDataById(exchangeDataId) {
55
- throw new Error('Individual retrieve should not be used anymore');
56
- }
57
- getExchangeDataByIds(body) {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- this._callCount.getExchangeDataByIds += 1;
60
- const allRetrieved = [];
61
- for (const id of body.ids) {
62
- const retrieved = this.data.getById(id);
63
- if (retrieved) {
64
- allRetrieved.push(new ExchangeData_1.ExchangeData(retrieved));
65
- }
66
- }
67
- return Promise.resolve(allRetrieved);
68
- });
69
- }
70
- getExchangeDataByDelegatorDelegate(delegatorId, delegateId) {
71
- this._callCount.getExchangeDataByDelegatorDelegate += 1;
72
- return Promise.resolve(this.data
73
- .getAll()
74
- .filter((x) => x.delegate === delegateId && x.delegator === delegatorId)
75
- .map((x) => new ExchangeData_1.ExchangeData(x)));
76
- }
77
- getExchangeDataByParticipant(dataOwnerId, startDocumentId, limit) {
78
- this._callCount.getExchangeDataByParticipant += 1;
79
- const retrieved = this.data.getPaged(startDocumentId, limit !== null && limit !== void 0 ? limit : 1000);
80
- return Promise.resolve(new PaginatedListExchangeData_1.PaginatedListExchangeData({
81
- pageSize: retrieved.rows.length,
82
- totalSize: retrieved.rows.length,
83
- rows: retrieved.rows.filter((x) => x.delegator === dataOwnerId || x.delegate === dataOwnerId).map((x) => new ExchangeData_1.ExchangeData(x)),
84
- nextKeyPair: new PaginatedDocumentKeyIdPairObject_1.PaginatedDocumentKeyIdPairObject({ startKeyDocId: retrieved.nextId }),
85
- }));
86
- }
87
- getAll() {
88
- return this.data.getAll().map((x) => new ExchangeData_1.ExchangeData(x));
89
- }
90
- }
91
- exports.FakeExchangeDataApi = FakeExchangeDataApi;
92
- //# sourceMappingURL=FakeExchangeDataApi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FakeExchangeDataApi.js","sourceRoot":"","sources":["../../../test/utils/FakeExchangeDataApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sFAAkF;AAClF,4EAAwE;AACxE,6FAAyF;AACzF,qDAAiD;AACjD,2GAAuG;AACvG,4BAA2B;AAC3B,+BAA6B;AAoB7B,MAAa,mBAAoB,SAAQ,uCAAkB;IAUzD,IAAW,SAAS;QAClB,OAAO,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACrC,CAAC;IAED,4BAA4B,CAAC,QAAmB,EAAE,QAA2B;QAC3E,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChD,MAAM,IAAI,GAAI,IAAI,CAAC,UAAkB,CAAC,GAAG,CAAW,CAAA;YACpD,MAAM,YAAY,GAAI,QAAgB,CAAC,GAAG,CAAW,CAAA;YACrD,IAAA,aAAM,EAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CACnB,YAAY,GAAG,CAAC,EAChB,yBAAyB,GAAG;mBACjB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;o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AAI,mEAAgC,CAAC,EAAE,aAAa,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC;SACvF,CAAC,CACH,CAAA;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,2BAAY,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3D,CAAC;CACF;AArFD,kDAqFC","sourcesContent":["import { IccExchangeDataApi } from '../../icc-api/api/internal/IccExchangeDataApi'\nimport { ExchangeData } from '../../icc-api/model/internal/ExchangeData'\nimport { PaginatedListExchangeData } from '../../icc-api/model/PaginatedListExchangeData'\nimport { FakeGenericApi } from './FakeGenericApi'\nimport { PaginatedDocumentKeyIdPairObject } from '../../icc-api/model/PaginatedDocumentKeyIdPairObject'\nimport * as _ from 'lodash'\nimport { expect } from 'chai'\nimport base = Mocha.reporters.base\nimport { ListOfIds } from '../../icc-api/model/ListOfIds'\n\nexport type CallCount = {\n createExchangeData: number\n modifyExchangeData: number\n getExchangeDataByParticipant: number\n getExchangeDataByDelegatorDelegate: number\n getExchangeDataByIds: number\n}\n\nexport type ExpectedCallCount = {\n createExchangeData?: number\n modifyExchangeData?: number\n getExchangeDataByParticipant?: number\n getExchangeDataByDelegatorDelegate?: number\n getExchangeDataByIds?: number\n}\n\nexport class FakeExchangeDataApi extends IccExchangeDataApi {\n private readonly data = new FakeGenericApi<ExchangeData>()\n private _callCount: CallCount = {\n createExchangeData: 0,\n modifyExchangeData: 0,\n getExchangeDataByDelegatorDelegate: 0,\n getExchangeDataByParticipant: 0,\n getExchangeDataByIds: 0,\n }\n\n public get callCount(): CallCount {\n return _.cloneDeep(this._callCount)\n }\n\n compareCallCountFromBaseline(baseline: CallCount, expected: ExpectedCallCount) {\n for (const [key, v] of Object.entries(expected)) {\n const curr = (this._callCount as any)[key] as number\n const currBaseline = (baseline as any)[key] as number\n expect(curr).to.equal(\n currBaseline + v,\n `Actual call count for ${key} does not match expected\n Current: ${JSON.stringify(this._callCount)}\n Baseline: ${JSON.stringify(baseline)}\n ExpectedDifference: ${JSON.stringify(expected)}\n `\n )\n }\n }\n\n constructor() {\n super('fake', {}, null as any, null as any)\n }\n\n createExchangeData(body: ExchangeData): Promise<ExchangeData> {\n this._callCount.createExchangeData += 1\n return Promise.resolve(new ExchangeData(this.data.createObject(body)))\n }\n\n modifyExchangeData(body: ExchangeData): Promise<ExchangeData> {\n this._callCount.modifyExchangeData += 1\n return Promise.resolve(new ExchangeData(this.data.modifyObject(body)))\n }\n\n getExchangeDataById(exchangeDataId: string): Promise<ExchangeData> {\n throw new Error('Individual retrieve should not be used anymore')\n }\n\n async getExchangeDataByIds(body: ListOfIds): Promise<ExchangeData[]> {\n this._callCount.getExchangeDataByIds += 1\n const allRetrieved: ExchangeData[] = []\n for (const id of body.ids!) {\n const retrieved = this.data.getById(id)\n if (retrieved) {\n allRetrieved.push(new ExchangeData(retrieved))\n }\n }\n return Promise.resolve(allRetrieved)\n }\n\n getExchangeDataByDelegatorDelegate(delegatorId: string, delegateId: string): Promise<ExchangeData[]> {\n this._callCount.getExchangeDataByDelegatorDelegate += 1\n return Promise.resolve(\n this.data\n .getAll()\n .filter((x) => x.delegate === delegateId && x.delegator === delegatorId)\n .map((x) => new ExchangeData(x))\n )\n }\n\n getExchangeDataByParticipant(dataOwnerId: string, startDocumentId?: string, limit?: number): Promise<PaginatedListExchangeData> {\n this._callCount.getExchangeDataByParticipant += 1\n const retrieved = this.data.getPaged(startDocumentId, limit ?? 1000)\n return Promise.resolve(\n new PaginatedListExchangeData({\n pageSize: retrieved.rows.length,\n totalSize: retrieved.rows.length,\n rows: retrieved.rows.filter((x) => x.delegator === dataOwnerId || x.delegate === dataOwnerId).map((x) => new ExchangeData(x)),\n nextKeyPair: new PaginatedDocumentKeyIdPairObject({ startKeyDocId: retrieved.nextId }),\n })\n )\n }\n\n getAll(): ExchangeData[] {\n return this.data.getAll().map((x) => new ExchangeData(x))\n }\n}\n"]}
@@ -1,48 +0,0 @@
1
- import { ExchangeDataManager } from '../../icc-x-api/crypto/ExchangeDataManager';
2
- import { EntityWithDelegationTypeName } from '../../icc-x-api/utils/EntityWithDelegationTypeName';
3
- import { ExchangeData } from '../../icc-api/model/internal/ExchangeData';
4
- import { BaseExchangeDataManager } from '../../icc-x-api/crypto/BaseExchangeDataManager';
5
- import { CryptoPrimitives } from '../../icc-x-api';
6
- export declare class FakeDecryptionExchangeDataManager implements ExchangeDataManager {
7
- private readonly cryptoPrimitives;
8
- constructor(cryptoPrimitives: CryptoPrimitives);
9
- private readonly dataByHash;
10
- private readonly dataById;
11
- clearOrRepopulateCache(): Promise<void>;
12
- getAccessControlKeysValue(entityType: EntityWithDelegationTypeName): Promise<string | undefined>;
13
- getCachedDecryptionDataKeyByAccessControlHash(hashes: string[]): Promise<{
14
- [p: string]: {
15
- exchangeData: ExchangeData;
16
- exchangeKey: CryptoKey;
17
- accessControlSecret: string;
18
- };
19
- }>;
20
- getDecryptionDataKeyByIds(ids: string[], retrieveIfNotCached: boolean): Promise<{
21
- [id: string]: {
22
- exchangeKey: CryptoKey | undefined;
23
- accessControlSecret: string | undefined;
24
- exchangeData: ExchangeData;
25
- };
26
- }>;
27
- getOrCreateEncryptionDataTo(delegateId: string): Promise<{
28
- exchangeData: ExchangeData;
29
- accessControlSecret: string;
30
- exchangeKey: CryptoKey;
31
- sharedSignatureKey: CryptoKey;
32
- }>;
33
- cacheFakeData(exchangeData: ExchangeData, keyAndHashesFromSecret: {
34
- exchangeKey: CryptoKey;
35
- accessControlSecret?: string;
36
- hashes: string[];
37
- } | undefined, fakeNonCached?: boolean): void;
38
- giveAccessBackTo(otherDataOwner: string, newDataOwnerPublicKey: string): Promise<void>;
39
- getAllDelegationKeys(entityType: EntityWithDelegationTypeName): Promise<string[] | undefined>;
40
- get base(): BaseExchangeDataManager;
41
- injectDecryptedExchangeData(exchangeDataDetails: {
42
- exchangeDataId: string;
43
- accessControlSecret: ArrayBuffer;
44
- exchangeKey: ArrayBuffer;
45
- sharedSignatureKey: ArrayBuffer;
46
- verified: boolean;
47
- }[], reEncryptWithOwnKeys: boolean): Promise<void>;
48
- }
@@ -1,82 +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
- exports.FakeDecryptionExchangeDataManager = void 0;
13
- class FakeDecryptionExchangeDataManager {
14
- constructor(cryptoPrimitives) {
15
- this.cryptoPrimitives = cryptoPrimitives;
16
- this.dataByHash = {};
17
- this.dataById = {};
18
- }
19
- clearOrRepopulateCache() {
20
- throw new Error('This method is not supported by fake exchange data manager and should not be used.');
21
- }
22
- getAccessControlKeysValue(entityType) {
23
- throw new Error('This method is not supported by fake exchange data manager and should not be used.');
24
- }
25
- getCachedDecryptionDataKeyByAccessControlHash(hashes) {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- const res = {};
28
- for (const hash of hashes) {
29
- const retrieved = this.dataByHash[hash];
30
- if (retrieved)
31
- res[hash] = retrieved;
32
- }
33
- return res;
34
- });
35
- }
36
- getDecryptionDataKeyByIds(ids, retrieveIfNotCached) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- const res = {};
39
- for (const id of ids) {
40
- const retrieved = this.dataById[id];
41
- if (retrieved) {
42
- if (retrieveIfNotCached || !retrieved.fakeNonCached) {
43
- res[id] = retrieved;
44
- }
45
- }
46
- }
47
- return res;
48
- });
49
- }
50
- getOrCreateEncryptionDataTo(delegateId) {
51
- throw new Error('This method should not be used with this fake exchange data manager: only retrieval decryption data is supported');
52
- }
53
- cacheFakeData(exchangeData, keyAndHashesFromSecret, fakeNonCached) {
54
- var _a;
55
- const acSecret = !!keyAndHashesFromSecret ? (_a = keyAndHashesFromSecret.accessControlSecret) !== null && _a !== void 0 ? _a : this.cryptoPrimitives.randomUuid() : undefined;
56
- this.dataById[exchangeData.id] = {
57
- exchangeData,
58
- exchangeKey: keyAndHashesFromSecret === null || keyAndHashesFromSecret === void 0 ? void 0 : keyAndHashesFromSecret.exchangeKey,
59
- fakeNonCached: fakeNonCached !== null && fakeNonCached !== void 0 ? fakeNonCached : false,
60
- accessControlSecret: acSecret,
61
- };
62
- if (keyAndHashesFromSecret) {
63
- for (const hash of keyAndHashesFromSecret.hashes) {
64
- this.dataByHash[hash] = { exchangeData, exchangeKey: keyAndHashesFromSecret.exchangeKey, accessControlSecret: acSecret };
65
- }
66
- }
67
- }
68
- giveAccessBackTo(otherDataOwner, newDataOwnerPublicKey) {
69
- throw new Error('This method should not be used with this fake exchange data manager: only retrieval decryption data is supported');
70
- }
71
- getAllDelegationKeys(entityType) {
72
- throw new Error('This method should not be used with this fake exchange data manager: only retrieval decryption data is supported');
73
- }
74
- get base() {
75
- throw new Error('This method should not be used with this fake exchange data manager: only retrieval decryption data is supported');
76
- }
77
- injectDecryptedExchangeData(exchangeDataDetails, reEncryptWithOwnKeys) {
78
- throw new Error('This method should not be used with this fake exchange data manager: only retrieval decryption data is supported');
79
- }
80
- }
81
- exports.FakeDecryptionExchangeDataManager = FakeDecryptionExchangeDataManager;
82
- //# sourceMappingURL=FakeExchangeDataManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FakeExchangeDataManager.js","sourceRoot":"","sources":["../../../test/utils/FakeExchangeDataManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAQA,MAAa,iCAAiC;IAC5C,YAA6B,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAE9C,eAAU,G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,CAAC,CAAC,CAAC,SAAS,CAAA;QACxI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAG,CAAC,GAAG;YAChC,YAAY;YACZ,WAAW,EAAE,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAE,WAAW;YAChD,aAAa,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,KAAK;YACrC,mBAAmB,EAAE,QAAQ;SAC9B,CAAA;QACD,IAAI,sBAAsB,EAAE,CAAC;YAC3B,KAAK,MAAM,IAAI,IAAI,sBAAsB,CAAC,MAAM,EAAE,CAAC;gBACjD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,WAAW,EAAE,sBAAsB,CAAC,WAAW,EAAE,mBAAmB,EAAE,QAAS,EAAE,CAAA;YAC3H,CAAC;QACH,CAAC;IACH,CAAC;IAED,gBAAgB,CAAC,cAAsB,EAAE,qBAA6B;QACpE,MAAM,IAAI,KAAK,CAAC,kHAAkH,CAAC,CAAA;IACrI,CAAC;IAED,oBAAoB,CAAC,UAAwC;QAC3D,MAAM,IAAI,KAAK,CAAC,kHAAkH,CAAC,CAAA;IACrI,CAAC;IAED,IAAI,IAAI;QACN,MAAM,IAAI,KAAK,CAAC,kHAAkH,CAAC,CAAA;IACrI,CAAC;IAED,2BAA2B,CACzB,mBAMG,EACH,oBAA6B;QAE7B,MAAM,IAAI,KAAK,CAAC,kHAAkH,CAAC,CAAA;IACrI,CAAC;CACF;AAlGD,8EAkGC","sourcesContent":["import { ExchangeDataManager } from '../../icc-x-api/crypto/ExchangeDataManager'\nimport { EntityWithDelegationTypeName } from '../../icc-x-api/utils/EntityWithDelegationTypeName'\nimport { ExchangeData } from '../../icc-api/model/internal/ExchangeData'\nimport { expect } from 'chai'\nimport { BaseExchangeDataManager } from '../../icc-x-api/crypto/BaseExchangeDataManager'\nimport { CryptoPrimitives } from '../../icc-x-api'\nimport { id } from 'date-fns/locale'\n\nexport class FakeDecryptionExchangeDataManager implements ExchangeDataManager {\n constructor(private readonly cryptoPrimitives: CryptoPrimitives) {}\n\n private readonly dataByHash: { [hash: string]: { exchangeData: ExchangeData; exchangeKey: CryptoKey; accessControlSecret: string } } = {}\n private readonly dataById: {\n [id: string]: { exchangeData: ExchangeData; exchangeKey: CryptoKey | undefined; accessControlSecret: string | undefined; fakeNonCached: boolean }\n } = {}\n\n clearOrRepopulateCache(): Promise<void> {\n throw new Error('This method is not supported by fake exchange data manager and should not be used.')\n }\n\n getAccessControlKeysValue(entityType: EntityWithDelegationTypeName): Promise<string | undefined> {\n throw new Error('This method is not supported by fake exchange data manager and should not be used.')\n }\n\n async getCachedDecryptionDataKeyByAccessControlHash(\n hashes: string[]\n ): Promise<{ [p: string]: { exchangeData: ExchangeData; exchangeKey: CryptoKey; accessControlSecret: string } }> {\n const res: { [p: string]: { exchangeData: ExchangeData; accessControlSecret: string; exchangeKey: CryptoKey } } = {}\n for (const hash of hashes) {\n const retrieved = this.dataByHash[hash]\n if (retrieved) res[hash] = retrieved\n }\n return res\n }\n\n async getDecryptionDataKeyByIds(\n ids: string[],\n retrieveIfNotCached: boolean\n ): Promise<{ [id: string]: { exchangeKey: CryptoKey | undefined; accessControlSecret: string | undefined; exchangeData: ExchangeData } }> {\n const res: { [id: string]: { exchangeKey: CryptoKey | undefined; accessControlSecret: string | undefined; exchangeData: ExchangeData } } = {}\n for (const id of ids) {\n const retrieved = this.dataById[id]\n if (retrieved) {\n if (retrieveIfNotCached || !retrieved.fakeNonCached) {\n res[id] = retrieved\n }\n }\n }\n return res\n }\n\n getOrCreateEncryptionDataTo(\n delegateId: string\n ): Promise<{ exchangeData: ExchangeData; accessControlSecret: string; exchangeKey: CryptoKey; sharedSignatureKey: CryptoKey }> {\n throw new Error('This method should not be used with this fake exchange data manager: only retrieval decryption data is supported')\n }\n\n cacheFakeData(\n exchangeData: ExchangeData,\n keyAndHashesFromSecret:\n | {\n exchangeKey: CryptoKey\n accessControlSecret?: string\n hashes: string[]\n }\n | undefined,\n fakeNonCached?: boolean\n ) {\n const acSecret = !!keyAndHashesFromSecret ? keyAndHashesFromSecret.accessControlSecret ?? this.cryptoPrimitives.randomUuid() : undefined\n this.dataById[exchangeData.id!] = {\n exchangeData,\n exchangeKey: keyAndHashesFromSecret?.exchangeKey,\n fakeNonCached: fakeNonCached ?? false,\n accessControlSecret: acSecret,\n }\n if (keyAndHashesFromSecret) {\n for (const hash of keyAndHashesFromSecret.hashes) {\n this.dataByHash[hash] = { exchangeData, exchangeKey: keyAndHashesFromSecret.exchangeKey, accessControlSecret: acSecret! }\n }\n }\n }\n\n giveAccessBackTo(otherDataOwner: string, newDataOwnerPublicKey: string): Promise<void> {\n throw new Error('This method should not be used with this fake exchange data manager: only retrieval decryption data is supported')\n }\n\n getAllDelegationKeys(entityType: EntityWithDelegationTypeName): Promise<string[] | undefined> {\n throw new Error('This method should not be used with this fake exchange data manager: only retrieval decryption data is supported')\n }\n\n get base(): BaseExchangeDataManager {\n throw new Error('This method should not be used with this fake exchange data manager: only retrieval decryption data is supported')\n }\n\n injectDecryptedExchangeData(\n exchangeDataDetails: {\n exchangeDataId: string\n accessControlSecret: ArrayBuffer\n exchangeKey: ArrayBuffer\n sharedSignatureKey: ArrayBuffer\n verified: boolean\n }[],\n reEncryptWithOwnKeys: boolean\n ): Promise<void> {\n throw new Error('This method should not be used with this fake exchange data manager: only retrieval decryption data is supported')\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- import { ExchangeDataMapManager } from '../../icc-x-api/crypto/ExchangeDataMapManager';
2
- import { ExchangeDataMap } from '../../icc-api/model/internal/ExchangeDataMap';
3
- export declare class FakeExchangeDataMapManager extends ExchangeDataMapManager {
4
- private fakeApi;
5
- constructor();
6
- createExchangeDataMaps(batch: {
7
- [accessControlKeyHash: string]: {
8
- [fp: string]: string;
9
- };
10
- }): Promise<void>;
11
- getExchangeDataMapBatch(accessControlKeyHashes: string[]): Promise<ExchangeDataMap[]>;
12
- }
@@ -1,38 +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
- exports.FakeExchangeDataMapManager = void 0;
13
- const ExchangeDataMapManager_1 = require("../../icc-x-api/crypto/ExchangeDataMapManager");
14
- const IccExchangeDataMapApi_1 = require("../../icc-api/api/internal/IccExchangeDataMapApi");
15
- const ExchangeDataMap_1 = require("../../icc-api/model/internal/ExchangeDataMap");
16
- const FakeGenericApi_1 = require("./FakeGenericApi");
17
- class FakeExchangeDataMapManager extends ExchangeDataMapManager_1.ExchangeDataMapManager {
18
- constructor() {
19
- super(new IccExchangeDataMapApi_1.IccExchangeDataMapApi('', {}));
20
- this.fakeApi = new FakeGenericApi_1.FakeGenericApi();
21
- }
22
- createExchangeDataMaps(batch) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- Object.entries(batch).forEach(([hash, encryptedIds]) => {
25
- this.fakeApi.createObject(new ExchangeDataMap_1.ExchangeDataMap({ id: hash, encryptedExchangeDataIds: encryptedIds }));
26
- });
27
- });
28
- }
29
- getExchangeDataMapBatch(accessControlKeyHashes) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- return accessControlKeyHashes.reduce((prev, curr) => {
32
- return [...prev, this.fakeApi.getById(curr)];
33
- }, []);
34
- });
35
- }
36
- }
37
- exports.FakeExchangeDataMapManager = FakeExchangeDataMapManager;
38
- //# sourceMappingURL=FakeExchangeDataMapManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FakeExchangeDataMapManager.js","sourceRoot":"","sources":["../../../test/utils/FakeExchangeDataMapManager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0FAAsF;AACtF,4FAAwF;AACxF,kFAA8E;AAC9E,qDAAiD;AAEjD,MAAa,0BAA2B,SAAQ,+CAAsB;IAGpE;QACE,KAAK,CAAC,IAAI,6CAAqB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QAHlC,YAAO,GAAG,IAAI,+BAAc,EAAmB,CAAA;IAIvD,CAAC;IAEK,sBAAsB,CAAC,KAAmE;;YAC9F,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,EAAE;gBACrD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,iCAAe,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,YAAY,EAAE,CAAC,CAAC,CAAA;YACtG,CAAC,CAAC,CAAA;QACJ,CAAC;KAAA;IAEK,uBAAuB,CAAC,sBAAgC;;YAC5D,OAAO,sBAAsB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;gBAClD,OAAO,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAE,CAAC,CAAA;YAC/C,CAAC,EAAE,EAAuB,CAAC,CAAA;QAC7B,CAAC;KAAA;CACF;AAlBD,gEAkBC","sourcesContent":["import { ExchangeDataMapManager } from '../../icc-x-api/crypto/ExchangeDataMapManager'\nimport { IccExchangeDataMapApi } from '../../icc-api/api/internal/IccExchangeDataMapApi'\nimport { ExchangeDataMap } from '../../icc-api/model/internal/ExchangeDataMap'\nimport { FakeGenericApi } from './FakeGenericApi'\n\nexport class FakeExchangeDataMapManager extends ExchangeDataMapManager {\n private fakeApi = new FakeGenericApi<ExchangeDataMap>()\n\n constructor() {\n super(new IccExchangeDataMapApi('', {}))\n }\n\n async createExchangeDataMaps(batch: { [accessControlKeyHash: string]: { [fp: string]: string } }): Promise<void> {\n Object.entries(batch).forEach(([hash, encryptedIds]) => {\n this.fakeApi.createObject(new ExchangeDataMap({ id: hash, encryptedExchangeDataIds: encryptedIds }))\n })\n }\n\n async getExchangeDataMapBatch(accessControlKeyHashes: string[]): Promise<ExchangeDataMap[]> {\n return accessControlKeyHashes.reduce((prev, curr) => {\n return [...prev, this.fakeApi.getById(curr)!]\n }, [] as ExchangeDataMap[])\n }\n}\n"]}
@@ -1,16 +0,0 @@
1
- export declare class FakeGenericApi<T extends {
2
- id?: string;
3
- rev?: string;
4
- }> {
5
- private readonly data;
6
- private readonly primitives;
7
- createObject(obj: T): T;
8
- modifyObject(obj: T): T;
9
- getAll(): T[];
10
- getPaged(startId: string | undefined, limit: number): {
11
- rows: T[];
12
- nextId: string | undefined;
13
- };
14
- getById(id: string): T | undefined;
15
- private nextRev;
16
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FakeGenericApi = void 0;
4
- const _ = require("lodash");
5
- const CryptoPrimitives_1 = require("../../icc-x-api/crypto/CryptoPrimitives");
6
- const crypto_1 = require("crypto");
7
- class FakeGenericApi {
8
- constructor() {
9
- this.data = new Map();
10
- this.primitives = new CryptoPrimitives_1.WebCryptoPrimitives(crypto_1.webcrypto);
11
- }
12
- createObject(obj) {
13
- if (!obj.id)
14
- throw new Error(`New object should have id`);
15
- if (obj.rev)
16
- throw new Error(`New object should not have rev`);
17
- if (this.data.get(obj.id))
18
- throw new Error(`Object with id ${obj.id} already exists.`);
19
- const withRev = _.cloneDeep(obj);
20
- withRev.rev = this.nextRev(withRev.rev);
21
- this.data.set(obj.id, withRev);
22
- return _.cloneDeep(withRev);
23
- }
24
- modifyObject(obj) {
25
- if (!obj.id)
26
- throw new Error(`Modified object should have id`);
27
- const existing = this.data.get(obj.id);
28
- if (!existing)
29
- throw new Error(`No object with id ${obj.id}`);
30
- if (existing.rev !== obj.rev)
31
- throw new Error(`Object with id ${obj.id} has wrong rev: ${obj.rev} but expected ${existing.rev}.`);
32
- const withNewRev = _.cloneDeep(obj);
33
- withNewRev.rev = this.nextRev(withNewRev.rev);
34
- this.data.set(obj.id, withNewRev);
35
- return _.cloneDeep(withNewRev);
36
- }
37
- getAll() {
38
- return [...this.data.values()].map((x) => _.cloneDeep(x));
39
- }
40
- getPaged(startId, limit) {
41
- let rows = [...this.data.values()];
42
- let nextId = undefined;
43
- if (startId) {
44
- const startIndex = rows.findIndex((x) => x.id === startId);
45
- rows = rows.slice(startIndex);
46
- }
47
- if (rows.length > limit) {
48
- nextId = rows[limit].id;
49
- rows = rows.slice(0, limit);
50
- }
51
- return { rows: rows.map((x) => _.cloneDeep(x)), nextId };
52
- }
53
- getById(id) {
54
- const retrieved = this.data.get(id);
55
- return retrieved ? _.cloneDeep(retrieved) : undefined;
56
- }
57
- nextRev(rev) {
58
- if (!rev)
59
- return `1-${this.primitives.randomUuid()}`;
60
- const prevRevNumber = parseInt(rev.split('-')[0]);
61
- return `${prevRevNumber + 1}-${this.primitives.randomUuid()}`;
62
- }
63
- }
64
- exports.FakeGenericApi = FakeGenericApi;
65
- //# sourceMappingURL=FakeGenericApi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FakeGenericApi.js","sourceRoot":"","sources":["../../../test/utils/FakeGenericApi.ts"],"names":[],"mappings":";;;AAAA,4BAA2B;AAC3B,8EAA+F;AAC/F,mCAAkC;AAElC,MAAa,cAAc;IAA3B;QACmB,SAAI,GAAmB,IAAI,GAAG,EAAE,CAAA;QAChC,eAAU,GAAqB,IAAI,sCAAmB,CAAC,kBAAgB,CAAC,CAAA;IAyD3F,CAAC;IAvDC,YAAY,CAAC,GAAM;QACjB,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QACzD,IAAI,GAAG,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK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;YAAE,OAAO,KAAK,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,EAAE,CAAA;QACpD,MAAM,aAAa,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACjD,OAAO,GAAG,aAAa,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,EAAE,CAAA;IAC/D,CAAC;CACF;AA3DD,wCA2DC","sourcesContent":["import * as _ from 'lodash'\nimport { CryptoPrimitives, WebCryptoPrimitives } from '../../icc-x-api/crypto/CryptoPrimitives'\nimport { webcrypto } from 'crypto'\n\nexport class FakeGenericApi<T extends { id?: string; rev?: string }> {\n private readonly data: Map<string, T> = new Map()\n private readonly primitives: CryptoPrimitives = new WebCryptoPrimitives(webcrypto as any)\n\n createObject(obj: T): T {\n if (!obj.id) throw new Error(`New object should have id`)\n if (obj.rev) throw new Error(`New object should not have rev`)\n if (this.data.get(obj.id!)) throw new Error(`Object with id ${obj.id} already exists.`)\n const withRev = _.cloneDeep(obj)\n withRev.rev = this.nextRev(withRev.rev)\n this.data.set(obj.id, withRev)\n return _.cloneDeep(withRev)\n }\n\n modifyObject(obj: T): T {\n if (!obj.id) throw new Error(`Modified object should have id`)\n const existing = this.data.get(obj.id!)\n if (!existing) throw new Error(`No object with id ${obj.id}`)\n if (existing.rev !== obj.rev) throw new Error(`Object with id ${obj.id} has wrong rev: ${obj.rev} but expected ${existing.rev}.`)\n const withNewRev = _.cloneDeep(obj)\n withNewRev.rev = this.nextRev(withNewRev.rev)\n this.data.set(obj.id, withNewRev)\n return _.cloneDeep(withNewRev)\n }\n\n getAll(): T[] {\n return [...this.data.values()].map((x) => _.cloneDeep(x))\n }\n\n getPaged(\n startId: string | undefined,\n limit: number\n ): {\n rows: T[]\n nextId: string | undefined\n } {\n let rows = [...this.data.values()]\n let nextId = undefined\n if (startId) {\n const startIndex = rows.findIndex((x) => x.id === startId)\n rows = rows.slice(startIndex)\n }\n if (rows.length > limit) {\n nextId = rows[limit].id\n rows = rows.slice(0, limit)\n }\n return { rows: rows.map((x) => _.cloneDeep(x)), nextId }\n }\n\n getById(id: string): T | undefined {\n const retrieved = this.data.get(id)\n return retrieved ? _.cloneDeep(retrieved) : undefined\n }\n\n private nextRev(rev: string | undefined): string {\n if (!rev) return `1-${this.primitives.randomUuid()}`\n const prevRevNumber = parseInt(rev.split('-')[0])\n return `${prevRevNumber + 1}-${this.primitives.randomUuid()}`\n }\n}\n"]}
@@ -1,23 +0,0 @@
1
- import { CryptoPrimitives, CryptoStrategies, KeyPair } from '../../icc-x-api';
2
- import { CryptoActorStubWithType } from '../../icc-api/model/CryptoActorStub';
3
- import { DataOwnerWithType } from '../../icc-api/model/DataOwnerWithType';
4
- export declare class KeylessCryptoStrategies implements CryptoStrategies {
5
- requestedKey: boolean;
6
- dataOwnerRequiresAnonymousDelegation(dataOwner: CryptoActorStubWithType): boolean;
7
- generateNewKeyForDataOwner(): Promise<KeyPair<CryptoKey> | boolean | 'keyless'>;
8
- recoverAndVerifySelfHierarchyKeys(keysData: {
9
- dataOwner: DataOwnerWithType;
10
- unknownKeys: string[];
11
- unavailableKeys: string[];
12
- }[]): Promise<{
13
- [p: string]: {
14
- recoveredKeys: {
15
- [p: string]: KeyPair<CryptoKey>;
16
- };
17
- keyAuthenticity: {
18
- [p: string]: boolean;
19
- };
20
- };
21
- }>;
22
- verifyDelegatePublicKeys(delegate: CryptoActorStubWithType, publicKeys: string[], cryptoPrimitives: CryptoPrimitives): Promise<string[]>;
23
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeylessCryptoStrategies = void 0;
4
- const DataOwnerTypeEnum_1 = require("../../icc-api/model/DataOwnerTypeEnum");
5
- class KeylessCryptoStrategies {
6
- constructor() {
7
- this.requestedKey = false;
8
- }
9
- dataOwnerRequiresAnonymousDelegation(dataOwner) {
10
- return dataOwner.type != DataOwnerTypeEnum_1.DataOwnerTypeEnum.Hcp;
11
- }
12
- generateNewKeyForDataOwner() {
13
- this.requestedKey = true;
14
- return Promise.resolve('keyless');
15
- }
16
- recoverAndVerifySelfHierarchyKeys(keysData) {
17
- const res = {};
18
- keysData.forEach((x) => (res[x.dataOwner.dataOwner.id] = { recoveredKeys: {}, keyAuthenticity: {} }));
19
- return Promise.resolve(res);
20
- }
21
- verifyDelegatePublicKeys(delegate, publicKeys, cryptoPrimitives) {
22
- return Promise.resolve(publicKeys);
23
- }
24
- }
25
- exports.KeylessCryptoStrategies = KeylessCryptoStrategies;
26
- //# sourceMappingURL=KeylessCryptoStrategies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeylessCryptoStrategies.js","sourceRoot":"","sources":["../../../test/utils/KeylessCryptoStrategies.ts"],"names":[],"mappings":";;;AAEA,6EAAyE;AAGzE,MAAa,uBAAuB;IAApC;QACE,iBAAY,GAAY,KAAK,CAAA;IA8B/B,CAAC;IA5BC,oCAAoC,CAAC,SAAkC;QACrE,OAAO,SAAS,CAAC,IAAI,IAAI,qCAAiB,CAAC,GAAG,CAAA;IAChD,CAAC;IAED,0BAA0B;QACxB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAA;QACxB,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACnC,CAAC;IAED,iCAAiC,CAC/B,QAIG;QAIH,MAAM,GAAG,GAEL,EAAE,CAAA;QACN,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,EAAG,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QACtG,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC7B,CAAC;IAED,wBAAwB,CAAC,QAAiC,EAAE,UAAoB,EAAE,gBAAkC;QAClH,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IACpC,CAAC;CACF;AA/BD,0DA+BC","sourcesContent":["import { CryptoPrimitives, CryptoStrategies, KeyPair } from '../../icc-x-api'\nimport { CryptoActorStubWithType } from '../../icc-api/model/CryptoActorStub'\nimport { DataOwnerTypeEnum } from '../../icc-api/model/DataOwnerTypeEnum'\nimport { DataOwnerWithType } from '../../icc-api/model/DataOwnerWithType'\n\nexport class KeylessCryptoStrategies implements CryptoStrategies {\n requestedKey: boolean = false\n\n dataOwnerRequiresAnonymousDelegation(dataOwner: CryptoActorStubWithType): boolean {\n return dataOwner.type != DataOwnerTypeEnum.Hcp\n }\n\n generateNewKeyForDataOwner(): Promise<KeyPair<CryptoKey> | boolean | 'keyless'> {\n this.requestedKey = true\n return Promise.resolve('keyless')\n }\n\n recoverAndVerifySelfHierarchyKeys(\n keysData: {\n dataOwner: DataOwnerWithType\n unknownKeys: string[]\n unavailableKeys: string[]\n }[]\n ): Promise<{\n [p: string]: { recoveredKeys: { [p: string]: KeyPair<CryptoKey> }; keyAuthenticity: { [p: string]: boolean } }\n }> {\n const res: {\n [p: string]: { recoveredKeys: { [p: string]: KeyPair<CryptoKey> }; keyAuthenticity: { [p: string]: boolean } }\n } = {}\n keysData.forEach((x) => (res[x.dataOwner.dataOwner.id!] = { recoveredKeys: {}, keyAuthenticity: {} }))\n return Promise.resolve(res)\n }\n\n verifyDelegatePublicKeys(delegate: CryptoActorStubWithType, publicKeys: string[], cryptoPrimitives: CryptoPrimitives): Promise<string[]> {\n return Promise.resolve(publicKeys)\n }\n}\n"]}
@@ -1,3 +0,0 @@
1
- import { IcureApi, IcureApiOptions, KeyPair } from '../../icc-x-api';
2
- import 'isomorphic-fetch';
3
- export declare const TestApi: (host: string, username: string, password: string, crypto?: Crypto, keyPair?: KeyPair<CryptoKey>, options?: IcureApiOptions) => Promise<IcureApi>;
@@ -1,30 +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
- exports.TestApi = void 0;
13
- const icc_x_api_1 = require("../../icc-x-api");
14
- const TestStorage_1 = require("./TestStorage");
15
- const TestCryptoStrategies_1 = require("./TestCryptoStrategies");
16
- require("isomorphic-fetch");
17
- const TestApi = function (host_1, username_1, password_1) {
18
- return __awaiter(this, arguments, void 0, function* (host, username, password, crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : {}, keyPair, options = {}) {
19
- const initialisedKeys = keyPair !== null && keyPair !== void 0 ? keyPair : (yield new icc_x_api_1.RSAUtilsImpl(crypto).generateKeyPair(icc_x_api_1.ShaVersion.Sha256));
20
- return icc_x_api_1.IcureApi.initialise(host, {
21
- username,
22
- password,
23
- }, new TestCryptoStrategies_1.TestCryptoStrategies(initialisedKeys), crypto, typeof window !== 'undefined' ? window.fetch : typeof self !== 'undefined' ? self.fetch : fetch, Object.assign({
24
- storage: new TestStorage_1.TestStorage(),
25
- keyStorage: new TestStorage_1.TestKeyStorage(),
26
- }, options));
27
- });
28
- };
29
- exports.TestApi = TestApi;
30
- //# sourceMappingURL=TestApi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TestApi.js","sourceRoot":"","sources":["../../../test/utils/TestApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAwG;AACxG,+CAA2D;AAC3D,iEAA6D;AAC7D,4BAAyB;AAElB,MAAM,OAAO,GAAG;yDACrB,IAAY,EACZ,QAAgB,EAChB,QAAgB,EAChB,SAAiB,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAE,EAAa,EAC3H,OAA4B,EAC5B,UAA2B,EAAE;QAE7B,MAAM,eAAe,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,CAAC,MAAM,IAAI,wBAAY,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,sBAAU,CAAC,MAAM,CAAC,CAAC,CAAA;QACtG,OAAO,oBAAQ,CAAC,UAAU,CACxB,IAAI,EACJ;YACE,QAAQ;YACR,QAAQ;SACT,EACD,IAAI,2CAAoB,CAAC,eAAe,CAAC,EACzC,MAAM,EACN,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,gBAE1F;YACD,OAAO,EAAE,IAAI,yBAAW,EAAE;YAC1B,UAAU,EAAE,IAAI,4BAAc,EAAE;SACjC,EACE,OAAO,EAEb,CAAA;IACH,CAAC;CAAA,CAAA;AA1BY,QAAA,OAAO,WA0BnB","sourcesContent":["import { IcureApi, IcureApiOptions, KeyPair, RSAUtils, RSAUtilsImpl, ShaVersion } from '../../icc-x-api'\nimport { TestKeyStorage, TestStorage } from './TestStorage'\nimport { TestCryptoStrategies } from './TestCryptoStrategies'\nimport 'isomorphic-fetch'\n\nexport const TestApi = async function (\n host: string,\n username: string,\n password: string,\n crypto: Crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : ({} as Crypto),\n keyPair?: KeyPair<CryptoKey>,\n options: IcureApiOptions = {}\n): Promise<IcureApi> {\n const initialisedKeys = keyPair ?? (await new RSAUtilsImpl(crypto).generateKeyPair(ShaVersion.Sha256))\n return IcureApi.initialise(\n host,\n {\n username,\n password,\n },\n new TestCryptoStrategies(initialisedKeys),\n crypto,\n typeof window !== 'undefined' ? window.fetch : typeof self !== 'undefined' ? self.fetch : fetch,\n {\n ...{\n storage: new TestStorage(),\n keyStorage: new TestKeyStorage(),\n },\n ...options,\n }\n )\n}\n"]}
@@ -1 +0,0 @@
1
- export {};
@@ -1,109 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chai_1 = require("chai");
4
- const collection_utils_1 = require("../../icc-x-api/utils/collection-utils");
5
- describe('setEquals', () => {
6
- it('should return true for two empty sets', () => {
7
- (0, chai_1.expect)((0, collection_utils_1.setEquals)(new Set(), new Set())).to.be.true;
8
- });
9
- it('should return true for two sets with the same elements', () => {
10
- const setA = new Set([1, 2, 3]);
11
- const setB = new Set([3, 1, 2]);
12
- (0, chai_1.expect)((0, collection_utils_1.setEquals)(setA, setB)).to.be.true;
13
- });
14
- it('should return false for sets with different elements', () => {
15
- const setA = new Set([1, 2, 3]);
16
- const setB = new Set([4, 5, 6]);
17
- (0, chai_1.expect)((0, collection_utils_1.setEquals)(setA, setB)).to.be.false;
18
- });
19
- it('should return false for sets of different sizes', () => {
20
- const setA = new Set([1, 2, 3]);
21
- const setB = new Set([1, 2]);
22
- (0, chai_1.expect)((0, collection_utils_1.setEquals)(setA, setB)).to.be.false;
23
- });
24
- });
25
- describe('objectEquals', () => {
26
- it('should return true for two empty objects', () => {
27
- (0, chai_1.expect)((0, collection_utils_1.objectEquals)({}, {})).to.be.true;
28
- });
29
- it('should return true for identical objects', () => {
30
- const objA = { a: 1, b: 2 };
31
- const objB = { a: 1, b: 2 };
32
- (0, chai_1.expect)((0, collection_utils_1.objectEquals)(objA, objB)).to.be.true;
33
- });
34
- it('should return false for objects with different properties', () => {
35
- const objA = { a: 1, b: 2 };
36
- const objB = { a: 1, c: 3 };
37
- (0, chai_1.expect)((0, collection_utils_1.objectEquals)(objA, objB)).to.be.false;
38
- });
39
- it('should return true for objects with nested identical objects', () => {
40
- const objA = { a: 1, b: { c: 3, d: 4 } };
41
- const objB = { a: 1, b: { c: 3, d: 4 } };
42
- (0, chai_1.expect)((0, collection_utils_1.objectEquals)(objA, objB)).to.be.true;
43
- });
44
- it('should return false for objects with nested different objects', () => {
45
- const objA = { a: 1, b: { c: 3, d: 4 } };
46
- const objB = { a: 1, b: { c: 3, d: 5 } };
47
- (0, chai_1.expect)((0, collection_utils_1.objectEquals)(objA, objB)).to.be.false;
48
- });
49
- it('should return true for objects with identical arrays', () => {
50
- const objA = { a: 1, b: [1, 2, 3] };
51
- const objB = { a: 1, b: [1, 2, 3] };
52
- (0, chai_1.expect)((0, collection_utils_1.objectEquals)(objA, objB)).to.be.true;
53
- });
54
- it('should return false for objects with different arrays', () => {
55
- const objA = { a: 1, b: [1, 2, 3] };
56
- const objB = { a: 1, b: [1, 2, 4] };
57
- (0, chai_1.expect)((0, collection_utils_1.objectEquals)(objA, objB)).to.be.false;
58
- });
59
- it('should return true for deeply nested objects', () => {
60
- const objA = { a: 1, b: { c: { d: 4, e: 5 } } };
61
- const objB = { a: 1, b: { c: { d: 4, e: 5 } } };
62
- (0, chai_1.expect)((0, collection_utils_1.objectEquals)(objA, objB)).to.be.true;
63
- });
64
- it('should respect ignoredProperties', () => {
65
- const objA = { a: 1, b: 2, c: 3 };
66
- const objB = { a: 1, b: 2, d: 4 };
67
- (0, chai_1.expect)((0, collection_utils_1.objectEquals)(objA, objB, ['c', 'd'])).to.be.true;
68
- });
69
- });
70
- describe('arrayEquals', () => {
71
- it('should return true for two empty arrays', () => {
72
- (0, chai_1.expect)((0, collection_utils_1.arrayEquals)([], [])).to.be.true;
73
- });
74
- it('should return true for two identical arrays of primitives', () => {
75
- (0, chai_1.expect)((0, collection_utils_1.arrayEquals)(['1', 2, 3], ['1', 2, 3])).to.be.true;
76
- });
77
- it('should return false for two different arrays of primitives', () => {
78
- (0, chai_1.expect)((0, collection_utils_1.arrayEquals)(['1', 2, 3], [1, 2, 3])).to.be.false;
79
- });
80
- it('should return false for arrays of different primitives', () => {
81
- (0, chai_1.expect)((0, collection_utils_1.arrayEquals)([1, 2, 3], [1, 2, 4])).to.be.false;
82
- });
83
- it('should return true for nested arrays with the same elements', () => {
84
- (0, chai_1.expect)((0, collection_utils_1.arrayEquals)([1, [2, 3], 4], [1, [2, 3], 4])).to.be.true;
85
- });
86
- it('should return false for nested arrays with different elements', () => {
87
- (0, chai_1.expect)((0, collection_utils_1.arrayEquals)([1, [2, 3], 4], [1, [2, 4], 4])).to.be.false;
88
- });
89
- it('should return true for arrays with identical objects', () => {
90
- const objA = { a: 1, b: 2 };
91
- const objB = { a: 1, b: 2 };
92
- (0, chai_1.expect)((0, collection_utils_1.arrayEquals)([objA], [objB])).to.be.true;
93
- });
94
- it('should return false for arrays with different objects', () => {
95
- const objA = { a: 1, b: 2 };
96
- const objB = { a: 1, c: 3 };
97
- (0, chai_1.expect)((0, collection_utils_1.arrayEquals)([objA], [objB])).to.be.false;
98
- });
99
- it('should return true for arrays with deeply nested structures', () => {
100
- const nestedArray = [1, { a: [2, 3, { b: 4 }] }, 5];
101
- (0, chai_1.expect)((0, collection_utils_1.arrayEquals)(nestedArray, nestedArray)).to.be.true;
102
- });
103
- it('should return false for arrays with differently nested structures', () => {
104
- const nestedArray1 = [1, { a: [2, 3, { b: 4 }] }, 5];
105
- const nestedArray2 = [1, { a: [2, 3, { b: 5 }] }, 5];
106
- (0, chai_1.expect)((0, collection_utils_1.arrayEquals)(nestedArray1, nestedArray2)).to.be.false;
107
- });
108
- });
109
- //# sourceMappingURL=TestCollectionUtils.js.map