@icure/api 7.1.13 → 8.0.0-RC.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/icc-api/api/IccAccesslogApi.d.ts +23 -1
  2. package/icc-api/api/IccAccesslogApi.js +154 -84
  3. package/icc-api/api/IccAccesslogApi.js.map +1 -1
  4. package/icc-api/api/IccBemikronoApi.d.ts +81 -0
  5. package/icc-api/api/IccBemikronoApi.js +163 -0
  6. package/icc-api/api/IccBemikronoApi.js.map +1 -0
  7. package/icc-api/api/IccCalendarItemApi.d.ts +21 -1
  8. package/icc-api/api/IccCalendarItemApi.js +183 -117
  9. package/icc-api/api/IccCalendarItemApi.js.map +1 -1
  10. package/icc-api/api/IccClassificationApi.d.ts +21 -1
  11. package/icc-api/api/IccClassificationApi.js +119 -63
  12. package/icc-api/api/IccClassificationApi.js.map +1 -1
  13. package/icc-api/api/IccContactApi.d.ts +21 -1
  14. package/icc-api/api/IccContactApi.js +385 -294
  15. package/icc-api/api/IccContactApi.js.map +1 -1
  16. package/icc-api/api/IccDocumentApi.d.ts +32 -25
  17. package/icc-api/api/IccDocumentApi.js +264 -212
  18. package/icc-api/api/IccDocumentApi.js.map +1 -1
  19. package/icc-api/api/IccExchangeDataApi.d.ts +19 -0
  20. package/icc-api/api/IccExchangeDataApi.js +85 -0
  21. package/icc-api/api/IccExchangeDataApi.js.map +1 -0
  22. package/icc-api/api/IccExchangeDataMapApi.d.ts +18 -0
  23. package/icc-api/api/IccExchangeDataMapApi.js +65 -0
  24. package/icc-api/api/IccExchangeDataMapApi.js.map +1 -0
  25. package/icc-api/api/IccFormApi.d.ts +28 -5
  26. package/icc-api/api/IccFormApi.js +328 -222
  27. package/icc-api/api/IccFormApi.js.map +1 -1
  28. package/icc-api/api/IccGroupApi.d.ts +40 -7
  29. package/icc-api/api/IccGroupApi.js +91 -16
  30. package/icc-api/api/IccGroupApi.js.map +1 -1
  31. package/icc-api/api/IccHelementApi.d.ts +21 -1
  32. package/icc-api/api/IccHelementApi.js +207 -137
  33. package/icc-api/api/IccHelementApi.js.map +1 -1
  34. package/icc-api/api/IccInvoiceApi.d.ts +21 -1
  35. package/icc-api/api/IccInvoiceApi.js +404 -298
  36. package/icc-api/api/IccInvoiceApi.js.map +1 -1
  37. package/icc-api/api/IccMaintenanceTaskApi.d.ts +12 -1
  38. package/icc-api/api/IccMaintenanceTaskApi.js +79 -43
  39. package/icc-api/api/IccMaintenanceTaskApi.js.map +1 -1
  40. package/icc-api/api/IccMessageApi.d.ts +12 -1
  41. package/icc-api/api/IccMessageApi.js +257 -191
  42. package/icc-api/api/IccMessageApi.js.map +1 -1
  43. package/icc-api/api/IccPatientApi.d.ts +12 -1
  44. package/icc-api/api/IccPatientApi.js +447 -351
  45. package/icc-api/api/IccPatientApi.js.map +1 -1
  46. package/icc-api/api/IccReceiptApi.d.ts +22 -8
  47. package/icc-api/api/IccReceiptApi.js +121 -64
  48. package/icc-api/api/IccReceiptApi.js.map +1 -1
  49. package/icc-api/api/IccRestApiPath.js +1 -1
  50. package/icc-api/api/IccRestApiPath.js.map +1 -1
  51. package/icc-api/api/IccTimeTableApi.d.ts +12 -1
  52. package/icc-api/api/IccTimeTableApi.js +86 -48
  53. package/icc-api/api/IccTimeTableApi.js.map +1 -1
  54. package/icc-api/api/XHR.js +1 -1
  55. package/icc-api/api/XHR.js.map +1 -1
  56. package/icc-api/index.d.ts +1 -0
  57. package/icc-api/index.js +1 -0
  58. package/icc-api/index.js.map +1 -1
  59. package/icc-api/model/AccessLog.d.ts +4 -0
  60. package/icc-api/model/AccessLog.js +1 -0
  61. package/icc-api/model/AccessLog.js.map +1 -1
  62. package/icc-api/model/Article.d.ts +4 -0
  63. package/icc-api/model/Article.js +1 -0
  64. package/icc-api/model/Article.js.map +1 -1
  65. package/icc-api/model/CalendarItem.d.ts +6 -1
  66. package/icc-api/model/CalendarItem.js +1 -0
  67. package/icc-api/model/CalendarItem.js.map +1 -1
  68. package/icc-api/model/Classification.d.ts +4 -0
  69. package/icc-api/model/Classification.js +1 -0
  70. package/icc-api/model/Classification.js.map +1 -1
  71. package/icc-api/model/ClassificationTemplate.d.ts +2 -0
  72. package/icc-api/model/ClassificationTemplate.js.map +1 -1
  73. package/icc-api/model/Contact.d.ts +4 -0
  74. package/icc-api/model/Contact.js +1 -0
  75. package/icc-api/model/Contact.js.map +1 -1
  76. package/icc-api/model/Device.d.ts +4 -4
  77. package/icc-api/model/Device.js.map +1 -1
  78. package/icc-api/model/Document.d.ts +4 -0
  79. package/icc-api/model/Document.js +1 -0
  80. package/icc-api/model/Document.js.map +1 -1
  81. package/icc-api/model/ExchangeData.d.ts +61 -0
  82. package/icc-api/model/ExchangeData.js +12 -0
  83. package/icc-api/model/ExchangeData.js.map +1 -0
  84. package/icc-api/model/ExchangeDataMap.d.ts +21 -0
  85. package/icc-api/model/ExchangeDataMap.js +10 -0
  86. package/icc-api/model/ExchangeDataMap.js.map +1 -0
  87. package/icc-api/model/ExchangeDataMapCreationBatch.d.ts +13 -0
  88. package/icc-api/model/ExchangeDataMapCreationBatch.js +10 -0
  89. package/icc-api/model/ExchangeDataMapCreationBatch.js.map +1 -0
  90. package/icc-api/model/Form.d.ts +4 -0
  91. package/icc-api/model/Form.js +1 -0
  92. package/icc-api/model/Form.js.map +1 -1
  93. package/icc-api/model/FormTemplate.d.ts +2 -1
  94. package/icc-api/model/FormTemplate.js +2 -1
  95. package/icc-api/model/FormTemplate.js.map +1 -1
  96. package/icc-api/model/Group.d.ts +7 -0
  97. package/icc-api/model/Group.js.map +1 -1
  98. package/icc-api/model/GroupDatabasesInfo.d.ts +1 -0
  99. package/icc-api/model/GroupDatabasesInfo.js.map +1 -1
  100. package/icc-api/model/HealthElement.d.ts +4 -0
  101. package/icc-api/model/HealthElement.js +1 -0
  102. package/icc-api/model/HealthElement.js.map +1 -1
  103. package/icc-api/model/HealthcareParty.d.ts +2 -2
  104. package/icc-api/model/HealthcareParty.js.map +1 -1
  105. package/icc-api/model/IcureStub.d.ts +2 -0
  106. package/icc-api/model/IcureStub.js.map +1 -1
  107. package/icc-api/model/Invoice.d.ts +4 -0
  108. package/icc-api/model/Invoice.js +1 -0
  109. package/icc-api/model/Invoice.js.map +1 -1
  110. package/icc-api/model/MaintenanceTask.d.ts +4 -0
  111. package/icc-api/model/MaintenanceTask.js +1 -0
  112. package/icc-api/model/MaintenanceTask.js.map +1 -1
  113. package/icc-api/model/Message.d.ts +4 -0
  114. package/icc-api/model/Message.js +1 -0
  115. package/icc-api/model/Message.js.map +1 -1
  116. package/icc-api/model/OperationToken.d.ts +18 -0
  117. package/icc-api/model/OperationToken.js +21 -0
  118. package/icc-api/model/OperationToken.js.map +1 -0
  119. package/icc-api/model/PaginatedListExchangeData.d.ts +9 -0
  120. package/icc-api/model/PaginatedListExchangeData.js +10 -0
  121. package/icc-api/model/PaginatedListExchangeData.js.map +1 -0
  122. package/icc-api/model/Patient.d.ts +6 -2
  123. package/icc-api/model/Patient.js +1 -0
  124. package/icc-api/model/Patient.js.map +1 -1
  125. package/icc-api/model/PatientByHcPartyGenderEducationProfession.d.ts +31 -0
  126. package/icc-api/model/PatientByHcPartyGenderEducationProfession.js +32 -0
  127. package/icc-api/model/PatientByHcPartyGenderEducationProfession.js.map +1 -0
  128. package/icc-api/model/Receipt.d.ts +4 -0
  129. package/icc-api/model/Receipt.js +1 -0
  130. package/icc-api/model/Receipt.js.map +1 -1
  131. package/icc-api/model/SecureDelegation.d.ts +52 -0
  132. package/icc-api/model/SecureDelegation.js +16 -0
  133. package/icc-api/model/SecureDelegation.js.map +1 -0
  134. package/icc-api/model/SecurityMetadata.d.ts +33 -0
  135. package/icc-api/model/SecurityMetadata.js +13 -0
  136. package/icc-api/model/SecurityMetadata.js.map +1 -0
  137. package/icc-api/model/Service.d.ts +2 -0
  138. package/icc-api/model/Service.js.map +1 -1
  139. package/icc-api/model/TimeTable.d.ts +4 -0
  140. package/icc-api/model/TimeTable.js +1 -0
  141. package/icc-api/model/TimeTable.js.map +1 -1
  142. package/icc-api/model/models.d.ts +20 -39
  143. package/icc-api/model/models.js +15 -37
  144. package/icc-api/model/models.js.map +1 -1
  145. package/icc-api/model/requests/EntityBulkShareResult.d.ts +28 -0
  146. package/icc-api/model/requests/EntityBulkShareResult.js +16 -0
  147. package/icc-api/model/requests/EntityBulkShareResult.js.map +1 -0
  148. package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.d.ts +10 -0
  149. package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js +17 -0
  150. package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js.map +1 -0
  151. package/icc-api/model/requests/EntityShareRequest.d.ts +110 -0
  152. package/icc-api/model/requests/EntityShareRequest.js +63 -0
  153. package/icc-api/model/requests/EntityShareRequest.js.map +1 -0
  154. package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.d.ts +54 -0
  155. package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js +24 -0
  156. package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js.map +1 -0
  157. package/icc-api/model/requests/MinimalEntityBulkShareResult.d.ts +23 -0
  158. package/icc-api/model/requests/MinimalEntityBulkShareResult.js +13 -0
  159. package/icc-api/model/requests/MinimalEntityBulkShareResult.js.map +1 -0
  160. package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.d.ts +21 -0
  161. package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.js +14 -0
  162. package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.js.map +1 -0
  163. package/icc-x-api/basexapi/EncryptedEntityXApi.d.ts +3 -2
  164. package/icc-x-api/basexapi/EncryptedEntityXApi.js.map +1 -1
  165. package/icc-x-api/crypto/AES.js +1 -1
  166. package/icc-x-api/crypto/AES.js.map +1 -1
  167. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.d.ts +16 -0
  168. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js +41 -0
  169. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js.map +1 -0
  170. package/icc-x-api/crypto/AccessControlSecretUtils.d.ts +42 -0
  171. package/icc-x-api/crypto/AccessControlSecretUtils.js +86 -0
  172. package/icc-x-api/crypto/AccessControlSecretUtils.js.map +1 -0
  173. package/icc-x-api/crypto/BaseExchangeDataManager.d.ts +146 -0
  174. package/icc-x-api/crypto/BaseExchangeDataManager.js +342 -0
  175. package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -0
  176. package/icc-x-api/crypto/BaseExchangeKeysManager.d.ts +0 -18
  177. package/icc-x-api/crypto/BaseExchangeKeysManager.js +11 -85
  178. package/icc-x-api/crypto/BaseExchangeKeysManager.js.map +1 -1
  179. package/icc-x-api/crypto/ConfidentialEntities.d.ts +26 -16
  180. package/icc-x-api/crypto/ConfidentialEntities.js +30 -17
  181. package/icc-x-api/crypto/ConfidentialEntities.js.map +1 -1
  182. package/icc-x-api/crypto/CryptoStrategies.d.ts +8 -1
  183. package/icc-x-api/crypto/CryptoStrategies.js.map +1 -1
  184. package/icc-x-api/crypto/ExchangeDataManager.d.ts +95 -0
  185. package/icc-x-api/crypto/ExchangeDataManager.js +493 -0
  186. package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -0
  187. package/icc-x-api/crypto/ExchangeDataMapManager.d.ts +32 -0
  188. package/icc-x-api/crypto/ExchangeDataMapManager.js +70 -0
  189. package/icc-x-api/crypto/ExchangeDataMapManager.js.map +1 -0
  190. package/icc-x-api/crypto/ExchangeKeysManager.d.ts +4 -16
  191. package/icc-x-api/crypto/ExchangeKeysManager.js +4 -62
  192. package/icc-x-api/crypto/ExchangeKeysManager.js.map +1 -1
  193. package/icc-x-api/crypto/ExtendedApisUtils.d.ts +336 -0
  194. package/icc-x-api/crypto/ExtendedApisUtils.js +3 -0
  195. package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -0
  196. package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +181 -0
  197. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +562 -0
  198. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -0
  199. package/icc-x-api/crypto/KeyRecovery.d.ts +5 -2
  200. package/icc-x-api/crypto/KeyRecovery.js +59 -29
  201. package/icc-x-api/crypto/KeyRecovery.js.map +1 -1
  202. package/icc-x-api/crypto/LegacyCryptoStrategies.d.ts +7 -2
  203. package/icc-x-api/crypto/LegacyCryptoStrategies.js +8 -1
  204. package/icc-x-api/crypto/LegacyCryptoStrategies.js.map +1 -1
  205. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.d.ts +39 -0
  206. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js +150 -0
  207. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js.map +1 -0
  208. package/icc-x-api/crypto/RSA.d.ts +34 -8
  209. package/icc-x-api/crypto/RSA.js +80 -13
  210. package/icc-x-api/crypto/RSA.js.map +1 -1
  211. package/icc-x-api/crypto/SecureDelegationsEncryption.d.ts +54 -0
  212. package/icc-x-api/crypto/SecureDelegationsEncryption.js +178 -0
  213. package/icc-x-api/crypto/SecureDelegationsEncryption.js.map +1 -0
  214. package/icc-x-api/crypto/SecureDelegationsManager.d.ts +66 -0
  215. package/icc-x-api/crypto/SecureDelegationsManager.js +261 -0
  216. package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -0
  217. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.d.ts +37 -0
  218. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js +294 -0
  219. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js.map +1 -0
  220. package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +114 -0
  221. package/icc-x-api/crypto/SecurityMetadataDecryptor.js +98 -0
  222. package/icc-x-api/crypto/SecurityMetadataDecryptor.js.map +1 -0
  223. package/icc-x-api/crypto/ShamirKeysManager.d.ts +5 -5
  224. package/icc-x-api/crypto/ShamirKeysManager.js +6 -9
  225. package/icc-x-api/crypto/ShamirKeysManager.js.map +1 -1
  226. package/icc-x-api/crypto/TransferKeysManager.d.ts +8 -6
  227. package/icc-x-api/crypto/TransferKeysManager.js +75 -52
  228. package/icc-x-api/crypto/TransferKeysManager.js.map +1 -1
  229. package/icc-x-api/crypto/{KeyManager.d.ts → UserEncryptionKeysManager.d.ts} +4 -6
  230. package/icc-x-api/crypto/{KeyManager.js → UserEncryptionKeysManager.js} +43 -23
  231. package/icc-x-api/crypto/UserEncryptionKeysManager.js.map +1 -0
  232. package/icc-x-api/crypto/UserSignatureKeysManager.d.ts +26 -0
  233. package/icc-x-api/crypto/UserSignatureKeysManager.js +74 -0
  234. package/icc-x-api/crypto/UserSignatureKeysManager.js.map +1 -0
  235. package/icc-x-api/crypto/utils.d.ts +61 -11
  236. package/icc-x-api/crypto/utils.js +113 -44
  237. package/icc-x-api/crypto/utils.js.map +1 -1
  238. package/icc-x-api/filters/filters.js.map +1 -1
  239. package/icc-x-api/icc-accesslog-x-api.d.ts +46 -11
  240. package/icc-x-api/icc-accesslog-x-api.js +75 -42
  241. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  242. package/icc-x-api/icc-calendar-item-x-api.d.ts +50 -14
  243. package/icc-x-api/icc-calendar-item-x-api.js +99 -49
  244. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  245. package/icc-x-api/icc-classification-x-api.d.ts +44 -9
  246. package/icc-x-api/icc-classification-x-api.js +56 -31
  247. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  248. package/icc-x-api/icc-contact-x-api.d.ts +56 -32
  249. package/icc-x-api/icc-contact-x-api.js +95 -64
  250. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  251. package/icc-x-api/icc-crypto-x-api.d.ts +28 -334
  252. package/icc-x-api/icc-crypto-x-api.js +41 -765
  253. package/icc-x-api/icc-crypto-x-api.js.map +1 -1
  254. package/icc-x-api/icc-data-owner-x-api.d.ts +20 -8
  255. package/icc-x-api/icc-data-owner-x-api.js +31 -10
  256. package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
  257. package/icc-x-api/icc-document-x-api.d.ts +48 -11
  258. package/icc-x-api/icc-document-x-api.js +111 -64
  259. package/icc-x-api/icc-document-x-api.js.map +1 -1
  260. package/icc-x-api/icc-form-x-api.d.ts +45 -10
  261. package/icc-x-api/icc-form-x-api.js +65 -35
  262. package/icc-x-api/icc-form-x-api.js.map +1 -1
  263. package/icc-x-api/icc-hcparty-x-api.d.ts +2 -2
  264. package/icc-x-api/icc-hcparty-x-api.js +3 -3
  265. package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
  266. package/icc-x-api/icc-helement-x-api.d.ts +55 -18
  267. package/icc-x-api/icc-helement-x-api.js +76 -41
  268. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  269. package/icc-x-api/icc-icure-maintenance-x-api.d.ts +7 -2
  270. package/icc-x-api/icc-icure-maintenance-x-api.js +38 -27
  271. package/icc-x-api/icc-icure-maintenance-x-api.js.map +1 -1
  272. package/icc-x-api/icc-invoice-x-api.d.ts +50 -15
  273. package/icc-x-api/icc-invoice-x-api.js +63 -33
  274. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  275. package/icc-x-api/icc-maintenance-task-x-api.d.ts +53 -21
  276. package/icc-x-api/icc-maintenance-task-x-api.js +72 -35
  277. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  278. package/icc-x-api/icc-message-x-api.d.ts +53 -15
  279. package/icc-x-api/icc-message-x-api.js +65 -36
  280. package/icc-x-api/icc-message-x-api.js.map +1 -1
  281. package/icc-x-api/icc-patient-x-api.d.ts +84 -29
  282. package/icc-x-api/icc-patient-x-api.js +313 -378
  283. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  284. package/icc-x-api/icc-receipt-x-api.d.ts +44 -12
  285. package/icc-x-api/icc-receipt-x-api.js +67 -35
  286. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  287. package/icc-x-api/icc-time-table-x-api.d.ts +43 -12
  288. package/icc-x-api/icc-time-table-x-api.js +56 -26
  289. package/icc-x-api/icc-time-table-x-api.js.map +1 -1
  290. package/icc-x-api/icc-user-x-api.d.ts +2 -2
  291. package/icc-x-api/icc-user-x-api.js +3 -3
  292. package/icc-x-api/icc-user-x-api.js.map +1 -1
  293. package/icc-x-api/index.d.ts +4 -2
  294. package/icc-x-api/index.js +154 -135
  295. package/icc-x-api/index.js.map +1 -1
  296. package/icc-x-api/storage/DefaultStorageEntryKeysFactory.d.ts +2 -0
  297. package/icc-x-api/storage/DefaultStorageEntryKeysFactory.js +9 -2
  298. package/icc-x-api/storage/DefaultStorageEntryKeysFactory.js.map +1 -1
  299. package/icc-x-api/storage/IcureStorageFacade.d.ts +23 -2
  300. package/icc-x-api/storage/IcureStorageFacade.js +36 -2
  301. package/icc-x-api/storage/IcureStorageFacade.js.map +1 -1
  302. package/icc-x-api/storage/KeyStorageFacade.d.ts +12 -0
  303. package/icc-x-api/storage/KeyStorageFacade.js.map +1 -1
  304. package/icc-x-api/storage/KeyStorageImpl.d.ts +2 -0
  305. package/icc-x-api/storage/KeyStorageImpl.js +10 -0
  306. package/icc-x-api/storage/KeyStorageImpl.js.map +1 -1
  307. package/icc-x-api/storage/StorageEntryKeysFactory.d.ts +14 -1
  308. package/icc-x-api/storage/StorageEntryKeysFactory.js.map +1 -1
  309. package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +32 -0
  310. package/icc-x-api/utils/EntityWithDelegationTypeName.js +75 -0
  311. package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -0
  312. package/icc-x-api/utils/ShareResult.d.ts +74 -0
  313. package/icc-x-api/utils/ShareResult.js +61 -0
  314. package/icc-x-api/utils/ShareResult.js.map +1 -0
  315. package/icc-x-api/utils/binary-utils.d.ts +1 -0
  316. package/icc-x-api/utils/binary-utils.js +8 -1
  317. package/icc-x-api/utils/binary-utils.js.map +1 -1
  318. package/icc-x-api/utils/collection-utils.d.ts +5 -0
  319. package/icc-x-api/utils/collection-utils.js +26 -1
  320. package/icc-x-api/utils/collection-utils.js.map +1 -1
  321. package/icc-x-api/utils/crypto-utils.d.ts +4 -3
  322. package/icc-x-api/utils/crypto-utils.js +5 -4
  323. package/icc-x-api/utils/crypto-utils.js.map +1 -1
  324. package/icc-x-api/utils/lru-temporised-async-cache.d.ts +26 -3
  325. package/icc-x-api/utils/lru-temporised-async-cache.js +75 -15
  326. package/icc-x-api/utils/lru-temporised-async-cache.js.map +1 -1
  327. package/icc-x-api/utils/websocket.d.ts +10 -10
  328. package/icc-x-api/utils/websocket.js +18 -9
  329. package/icc-x-api/utils/websocket.js.map +1 -1
  330. package/index.d.ts +1 -1
  331. package/index.js +3 -1
  332. package/index.js.map +1 -1
  333. package/package.json +2 -3
  334. package/icc-x-api/crypto/EntitiesEncryption.d.ts +0 -275
  335. package/icc-x-api/crypto/EntitiesEncryption.js +0 -734
  336. package/icc-x-api/crypto/EntitiesEncryption.js.map +0 -1
  337. package/icc-x-api/crypto/KeyManager.js.map +0 -1
@@ -1,4 +1,13 @@
1
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
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.IccDocumentApi = void 0;
4
13
  /**
@@ -18,15 +27,19 @@ const Document_1 = require("../model/Document");
18
27
  const IcureStub_1 = require("../model/IcureStub");
19
28
  const AuthenticationProvider_1 = require("../../icc-x-api/auth/AuthenticationProvider");
20
29
  const IccRestApiPath_1 = require("./IccRestApiPath");
30
+ const EntityBulkShareResult_1 = require("../model/requests/EntityBulkShareResult");
21
31
  class IccDocumentApi {
32
+ get headers() {
33
+ return Promise.resolve(this._headers);
34
+ }
22
35
  constructor(host, headers, authenticationProvider, fetchImpl) {
23
36
  this.host = (0, IccRestApiPath_1.iccRestApiPath)(host);
24
- this.headers = Object.keys(headers).map((k) => new XHR_1.XHR.Header(k, headers[k]));
37
+ this._headers = Object.keys(headers).map((k) => new XHR_1.XHR.Header(k, headers[k]));
25
38
  this.authenticationProvider = !!authenticationProvider ? authenticationProvider : new AuthenticationProvider_1.NoAuthenticationProvider();
26
39
  this.fetchImpl = fetchImpl;
27
40
  }
28
41
  setHeaders(h) {
29
- this.headers = h;
42
+ this._headers = h;
30
43
  }
31
44
  handleError(e) {
32
45
  throw e;
@@ -37,14 +50,16 @@ class IccDocumentApi {
37
50
  * @param body
38
51
  */
39
52
  createDocument(body) {
40
- let _body = null;
41
- _body = body;
42
- const _url = this.host + `/document` + '?ts=' + new Date().getTime();
43
- let headers = this.headers;
44
- headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
45
- return XHR_1.XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
46
- .then((doc) => new Document_1.Document(doc.body))
47
- .catch((err) => this.handleError(err));
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ let _body = null;
55
+ _body = body;
56
+ const _url = this.host + `/document` + '?ts=' + new Date().getTime();
57
+ let headers = yield this.headers;
58
+ headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
59
+ return XHR_1.XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
60
+ .then((doc) => new Document_1.Document(doc.body))
61
+ .catch((err) => this.handleError(err));
62
+ });
48
63
  }
49
64
  /**
50
65
  * Deletes a document's attachment and returns the modified document instance afterward
@@ -52,12 +67,14 @@ class IccDocumentApi {
52
67
  * @param documentId
53
68
  */
54
69
  deleteAttachment(documentId) {
55
- let _body = null;
56
- const _url = this.host + `/document/${encodeURIComponent(String(documentId))}/attachment` + '?ts=' + new Date().getTime();
57
- let headers = this.headers;
58
- return XHR_1.XHR.sendCommand('DELETE', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
59
- .then((doc) => new Document_1.Document(doc.body))
60
- .catch((err) => this.handleError(err));
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ let _body = null;
72
+ const _url = this.host + `/document/${encodeURIComponent(String(documentId))}/attachment` + '?ts=' + new Date().getTime();
73
+ let headers = yield this.headers;
74
+ return XHR_1.XHR.sendCommand('DELETE', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
75
+ .then((doc) => new Document_1.Document(doc.body))
76
+ .catch((err) => this.handleError(err));
77
+ });
61
78
  }
62
79
  /**
63
80
  * Deletes a batch of documents and returns the list of deleted document ids
@@ -65,12 +82,14 @@ class IccDocumentApi {
65
82
  * @param documentIds
66
83
  */
67
84
  deleteDocument(documentIds) {
68
- let _body = null;
69
- const _url = this.host + `/document/${encodeURIComponent(String(documentIds))}` + '?ts=' + new Date().getTime();
70
- let headers = this.headers;
71
- return XHR_1.XHR.sendCommand('DELETE', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
72
- .then((doc) => doc.body.map((it) => new DocIdentifier_1.DocIdentifier(it)))
73
- .catch((err) => this.handleError(err));
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ let _body = null;
87
+ const _url = this.host + `/document/${encodeURIComponent(String(documentIds))}` + '?ts=' + new Date().getTime();
88
+ let headers = yield this.headers;
89
+ return XHR_1.XHR.sendCommand('DELETE', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
90
+ .then((doc) => doc.body.map((it) => new DocIdentifier_1.DocIdentifier(it)))
91
+ .catch((err) => this.handleError(err));
92
+ });
74
93
  }
75
94
  /**
76
95
  * Keys must be delimited by coma
@@ -80,18 +99,20 @@ class IccDocumentApi {
80
99
  * @param secretFKeys
81
100
  */
82
101
  findByTypeHCPartyMessageSecretFKeys(documentTypeCode, hcPartyId, secretFKeys) {
83
- let _body = null;
84
- const _url = this.host +
85
- `/document/byTypeHcPartySecretForeignKeys` +
86
- '?ts=' +
87
- new Date().getTime() +
88
- (documentTypeCode ? '&documentTypeCode=' + encodeURIComponent(String(documentTypeCode)) : '') +
89
- (hcPartyId ? '&hcPartyId=' + encodeURIComponent(String(hcPartyId)) : '') +
90
- (secretFKeys ? '&secretFKeys=' + encodeURIComponent(String(secretFKeys)) : '');
91
- let headers = this.headers;
92
- return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
93
- .then((doc) => doc.body.map((it) => new Document_1.Document(it)))
94
- .catch((err) => this.handleError(err));
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ let _body = null;
104
+ const _url = this.host +
105
+ `/document/byTypeHcPartySecretForeignKeys` +
106
+ '?ts=' +
107
+ new Date().getTime() +
108
+ (documentTypeCode ? '&documentTypeCode=' + encodeURIComponent(String(documentTypeCode)) : '') +
109
+ (hcPartyId ? '&hcPartyId=' + encodeURIComponent(String(hcPartyId)) : '') +
110
+ (secretFKeys ? '&secretFKeys=' + encodeURIComponent(String(secretFKeys)) : '');
111
+ let headers = yield this.headers;
112
+ return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
113
+ .then((doc) => doc.body.map((it) => new Document_1.Document(it)))
114
+ .catch((err) => this.handleError(err));
115
+ });
95
116
  }
96
117
  /**
97
118
  * Keys must be delimited by coma
@@ -100,17 +121,19 @@ class IccDocumentApi {
100
121
  * @param secretFKeys
101
122
  */
102
123
  findDocumentsByHCPartyPatientForeignKeys(hcPartyId, secretFKeys) {
103
- let _body = null;
104
- const _url = this.host +
105
- `/document/byHcPartySecretForeignKeys` +
106
- '?ts=' +
107
- new Date().getTime() +
108
- (hcPartyId ? '&hcPartyId=' + encodeURIComponent(String(hcPartyId)) : '') +
109
- (secretFKeys ? '&secretFKeys=' + encodeURIComponent(String(secretFKeys)) : '');
110
- let headers = this.headers;
111
- return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
112
- .then((doc) => doc.body.map((it) => new Document_1.Document(it)))
113
- .catch((err) => this.handleError(err));
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ let _body = null;
126
+ const _url = this.host +
127
+ `/document/byHcPartySecretForeignKeys` +
128
+ '?ts=' +
129
+ new Date().getTime() +
130
+ (hcPartyId ? '&hcPartyId=' + encodeURIComponent(String(hcPartyId)) : '') +
131
+ (secretFKeys ? '&secretFKeys=' + encodeURIComponent(String(secretFKeys)) : '');
132
+ let headers = yield this.headers;
133
+ return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
134
+ .then((doc) => doc.body.map((it) => new Document_1.Document(it)))
135
+ .catch((err) => this.handleError(err));
136
+ });
114
137
  }
115
138
  /**
116
139
  * Keys must be delimited by coma
@@ -118,12 +141,14 @@ class IccDocumentApi {
118
141
  * @param limit
119
142
  */
120
143
  findWithoutDelegation(limit) {
121
- let _body = null;
122
- const _url = this.host + `/document/woDelegation` + '?ts=' + new Date().getTime() + (limit ? '&limit=' + encodeURIComponent(String(limit)) : '');
123
- let headers = this.headers;
124
- return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
125
- .then((doc) => doc.body.map((it) => new Document_1.Document(it)))
126
- .catch((err) => this.handleError(err));
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ let _body = null;
146
+ const _url = this.host + `/document/woDelegation` + '?ts=' + new Date().getTime() + (limit ? '&limit=' + encodeURIComponent(String(limit)) : '');
147
+ let headers = yield this.headers;
148
+ return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
149
+ .then((doc) => doc.body.map((it) => new Document_1.Document(it)))
150
+ .catch((err) => this.handleError(err));
151
+ });
127
152
  }
128
153
  /**
129
154
  * Returns the document corresponding to the identifier passed in the request
@@ -131,33 +156,40 @@ class IccDocumentApi {
131
156
  * @param documentId
132
157
  */
133
158
  getDocument(documentId) {
134
- let _body = null;
135
- const _url = this.host + `/document/${encodeURIComponent(String(documentId))}` + '?ts=' + new Date().getTime();
136
- let headers = this.headers;
137
- return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
138
- .then((doc) => new Document_1.Document(doc.body))
139
- .catch((err) => this.handleError(err));
159
+ return __awaiter(this, void 0, void 0, function* () {
160
+ let _body = null;
161
+ const _url = this.host + `/document/${encodeURIComponent(String(documentId))}` + '?ts=' + new Date().getTime();
162
+ let headers = yield this.headers;
163
+ return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
164
+ .then((doc) => new Document_1.Document(doc.body))
165
+ .catch((err) => this.handleError(err));
166
+ });
140
167
  }
141
168
  /**
142
- *
143
- * @summary Load document's attachment
144
- * @param documentId
145
- * @param attachmentId
146
- * @param enckeys
147
- * @param fileName
169
+ * @deprecated use getMainDocumentAttachment instead
148
170
  */
149
171
  getDocumentAttachment(documentId, attachmentId, enckeys, fileName) {
150
- let _body = null;
151
- const _url = this.host +
152
- `/document/${encodeURIComponent(String(documentId))}/attachment/${encodeURIComponent(String(attachmentId))}` +
153
- '?ts=' +
154
- new Date().getTime() +
155
- (enckeys ? '&enckeys=' + encodeURIComponent(String(enckeys)) : '') +
156
- (fileName ? '&fileName=' + encodeURIComponent(String(fileName)) : '');
157
- let headers = this.headers;
158
- return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
159
- .then((doc) => doc.body)
160
- .catch((err) => this.handleError(err));
172
+ return __awaiter(this, void 0, void 0, function* () {
173
+ if (enckeys) {
174
+ throw new Error('Server-side encryption of attachment is not allowed anymore');
175
+ }
176
+ return this.getMainDocumentAttachment(documentId);
177
+ });
178
+ }
179
+ /**
180
+ * Get the main attachment of a document
181
+ * @param documentId id of the document
182
+ * @return the content of the main attachment for the document (if any)
183
+ */
184
+ getMainDocumentAttachment(documentId) {
185
+ return __awaiter(this, void 0, void 0, function* () {
186
+ let _body = null;
187
+ const _url = this.host + `/document/${encodeURIComponent(String(documentId))}/attachment` + '?ts=' + new Date().getTime();
188
+ let headers = yield this.headers;
189
+ return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
190
+ .then((doc) => doc.body)
191
+ .catch((err) => this.handleError(err));
192
+ });
161
193
  }
162
194
  /**
163
195
  * Returns the first document corresponding to the externalUuid passed in the request
@@ -165,12 +197,14 @@ class IccDocumentApi {
165
197
  * @param externalUuid
166
198
  */
167
199
  getDocumentByExternalUuid(externalUuid) {
168
- let _body = null;
169
- const _url = this.host + `/document/externaluuid/${encodeURIComponent(String(externalUuid))}` + '?ts=' + new Date().getTime();
170
- let headers = this.headers;
171
- return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
172
- .then((doc) => new Document_1.Document(doc.body))
173
- .catch((err) => this.handleError(err));
200
+ return __awaiter(this, void 0, void 0, function* () {
201
+ let _body = null;
202
+ const _url = this.host + `/document/externaluuid/${encodeURIComponent(String(externalUuid))}` + '?ts=' + new Date().getTime();
203
+ let headers = yield this.headers;
204
+ return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
205
+ .then((doc) => new Document_1.Document(doc.body))
206
+ .catch((err) => this.handleError(err));
207
+ });
174
208
  }
175
209
  /**
176
210
  * Returns a list of document corresponding to the identifiers passed in the body
@@ -178,14 +212,16 @@ class IccDocumentApi {
178
212
  * @param body
179
213
  */
180
214
  getDocuments(body) {
181
- let _body = null;
182
- _body = body;
183
- const _url = this.host + `/document/batch` + '?ts=' + new Date().getTime();
184
- let headers = this.headers;
185
- headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
186
- return XHR_1.XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
187
- .then((doc) => doc.body.map((it) => new Document_1.Document(it)))
188
- .catch((err) => this.handleError(err));
215
+ return __awaiter(this, void 0, void 0, function* () {
216
+ let _body = null;
217
+ _body = body;
218
+ const _url = this.host + `/document/byIds` + '?ts=' + new Date().getTime();
219
+ let headers = yield this.headers;
220
+ headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
221
+ return XHR_1.XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
222
+ .then((doc) => doc.body.map((it) => new Document_1.Document(it)))
223
+ .catch((err) => this.handleError(err));
224
+ });
189
225
  }
190
226
  /**
191
227
  * Returns a list of document corresponding to the externalUuid passed in the request
@@ -193,12 +229,14 @@ class IccDocumentApi {
193
229
  * @param externalUuid
194
230
  */
195
231
  getDocumentsByExternalUuid(externalUuid) {
196
- let _body = null;
197
- const _url = this.host + `/document/externaluuid/${encodeURIComponent(String(externalUuid))}/all` + '?ts=' + new Date().getTime();
198
- let headers = this.headers;
199
- return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
200
- .then((doc) => doc.body.map((it) => new Document_1.Document(it)))
201
- .catch((err) => this.handleError(err));
232
+ return __awaiter(this, void 0, void 0, function* () {
233
+ let _body = null;
234
+ const _url = this.host + `/document/externaluuid/${encodeURIComponent(String(externalUuid))}/all` + '?ts=' + new Date().getTime();
235
+ let headers = yield this.headers;
236
+ return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
237
+ .then((doc) => doc.body.map((it) => new Document_1.Document(it)))
238
+ .catch((err) => this.handleError(err));
239
+ });
202
240
  }
203
241
  /**
204
242
  * Updates the document and returns an instance of the modified document afterward
@@ -206,14 +244,16 @@ class IccDocumentApi {
206
244
  * @param body
207
245
  */
208
246
  modifyDocument(body) {
209
- let _body = null;
210
- _body = body;
211
- const _url = this.host + `/document` + '?ts=' + new Date().getTime();
212
- let headers = this.headers;
213
- headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
214
- return XHR_1.XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
215
- .then((doc) => new Document_1.Document(doc.body))
216
- .catch((err) => this.handleError(err));
247
+ return __awaiter(this, void 0, void 0, function* () {
248
+ let _body = null;
249
+ _body = body;
250
+ const _url = this.host + `/document` + '?ts=' + new Date().getTime();
251
+ let headers = yield this.headers;
252
+ headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
253
+ return XHR_1.XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
254
+ .then((doc) => new Document_1.Document(doc.body))
255
+ .catch((err) => this.handleError(err));
256
+ });
217
257
  }
218
258
  /**
219
259
  * Returns the modified documents.
@@ -221,86 +261,76 @@ class IccDocumentApi {
221
261
  * @param body
222
262
  */
223
263
  modifyDocuments(body) {
224
- let _body = null;
225
- _body = body;
226
- const _url = this.host + `/document/batch` + '?ts=' + new Date().getTime();
227
- let headers = this.headers;
228
- headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
229
- return XHR_1.XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
230
- .then((doc) => doc.body.map((it) => new Document_1.Document(it)))
231
- .catch((err) => this.handleError(err));
264
+ return __awaiter(this, void 0, void 0, function* () {
265
+ let _body = null;
266
+ _body = body;
267
+ const _url = this.host + `/document/batch` + '?ts=' + new Date().getTime();
268
+ let headers = yield this.headers;
269
+ headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
270
+ return XHR_1.XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
271
+ .then((doc) => doc.body.map((it) => new Document_1.Document(it)))
272
+ .catch((err) => this.handleError(err));
273
+ });
232
274
  }
233
275
  /**
234
- * Creates or updates a document's attachment and returns the modified document instance afterward
235
- * @summary Create a document's attachment
236
- * @param body
237
- * @param documentId
238
- * @param enckeys
276
+ * Creates or updates a main attachment for a document and returns the modified document instance afterward
277
+ * @param documentId id of the document
278
+ * @param documentRev revision of the document
279
+ * @param body content of the attachment (must be compatible with XHR body)
239
280
  * @param utis an array of UTIs for the attachment. The first element will be considered as the main UTI for the document. If provided and non-empty
240
281
  * overrides existing values.
241
282
  */
242
- setDocumentAttachment(documentId, enckeys, body, utis) {
243
- let _body = null;
244
- _body = body;
245
- const _url = this.host +
246
- `/document/${encodeURIComponent(String(documentId))}/attachment` +
247
- '?ts=' +
248
- new Date().getTime() +
249
- (enckeys ? '&enckeys=' + encodeURIComponent(String(enckeys)) : '') +
250
- (utis ? utis.map((x) => '&utis=' + encodeURIComponent(String(x))).join('') : '');
251
- let headers = this.headers;
252
- headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/octet-stream'));
253
- return XHR_1.XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
254
- .then((doc) => new Document_1.Document(doc.body))
255
- .catch((err) => this.handleError(err));
283
+ setMainDocumentAttachment(documentId, documentRev, body, utis) {
284
+ return __awaiter(this, void 0, void 0, function* () {
285
+ if (!documentRev)
286
+ throw new Error('Document rev is required');
287
+ let _body = body;
288
+ const _url = this.host +
289
+ `/document/${encodeURIComponent(String(documentId))}/attachment` +
290
+ '?ts=' +
291
+ new Date().getTime() +
292
+ '&rev=' +
293
+ encodeURIComponent(String(documentRev)) +
294
+ (utis ? utis.map((x) => '&utis=' + encodeURIComponent(String(x))).join('') : '');
295
+ let headers = yield this.headers;
296
+ headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/octet-stream'));
297
+ return XHR_1.XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
298
+ .then((doc) => new Document_1.Document(doc.body))
299
+ .catch((err) => this.handleError(err));
300
+ });
256
301
  }
257
302
  /**
258
- * Creates a document attachment and returns the modified document instance afterward
259
- * @summary Create a document's attachment
260
- * @param body
261
- * @param documentId
262
- * @param enckeys
303
+ * @deprecated use setMainDocumentAttachment instead
263
304
  */
264
- setDocumentAttachmentBody(documentId, enckeys, body) {
265
- let _body = null;
266
- _body = body;
267
- const _url = this.host +
268
- `/document/attachment` +
269
- '?ts=' +
270
- new Date().getTime() +
271
- (documentId ? '&documentId=' + encodeURIComponent(String(documentId)) : '') +
272
- (enckeys ? '&enckeys=' + encodeURIComponent(String(enckeys)) : '');
273
- let headers = this.headers;
274
- headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/octet-stream'));
275
- return XHR_1.XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
276
- .then((doc) => new Document_1.Document(doc.body))
277
- .catch((err) => this.handleError(err));
305
+ setDocumentAttachmentBody(documentId, documentRev, enckeys, body, utis) {
306
+ if (enckeys) {
307
+ throw new Error('Server-side encryption of attachment is not allowed anymore');
308
+ }
309
+ if (!body) {
310
+ throw new Error('body is now required.');
311
+ }
312
+ return this.setMainDocumentAttachment(documentId, documentRev, body, utis);
278
313
  }
279
314
  /**
280
- *
281
- * @summary Creates a document's attachment
282
- * @param attachment
283
- * @param documentId
284
- * @param enckeys
315
+ * @deprecated use setMainDocumentAttachment instead
316
+ */
317
+ setDocumentAttachment(documentId, documentRev, enckeys, body, utis) {
318
+ if (enckeys) {
319
+ throw new Error('Server-side encryption of attachment is not allowed anymore');
320
+ }
321
+ if (!body) {
322
+ throw new Error('body is now required.');
323
+ }
324
+ return this.setMainDocumentAttachment(documentId, documentRev, body, utis);
325
+ }
326
+ /**
327
+ * @deprecated use setMainDocumentAttachment instead
285
328
  */
286
- setDocumentAttachmentMulti(attachment, documentId, enckeys) {
287
- let _body = null;
288
- if (attachment && !_body) {
289
- const parts = Array.isArray(attachment) ? attachment : [attachment];
290
- const _blob = new Blob(parts, { type: 'application/octet-stream' });
291
- _body = new FormData();
292
- _body.append('attachment', _blob);
329
+ setDocumentAttachmentMulti(attachment, documentRev, documentId, enckeys) {
330
+ if (enckeys) {
331
+ throw new Error('Server-side encryption of attachment is not allowed anymore');
293
332
  }
294
- const _url = this.host +
295
- `/document/${encodeURIComponent(String(documentId))}/attachment/multipart` +
296
- '?ts=' +
297
- new Date().getTime() +
298
- (enckeys ? '&enckeys=' + encodeURIComponent(String(enckeys)) : '');
299
- let headers = this.headers;
300
- headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'multipart/form-data'));
301
- return XHR_1.XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
302
- .then((doc) => new Document_1.Document(doc.body))
303
- .catch((err) => this.handleError(err));
333
+ return this.setMainDocumentAttachment(documentId, documentRev, attachment);
304
334
  }
305
335
  /**
306
336
  * Keys must be delimited by coma
@@ -308,14 +338,16 @@ class IccDocumentApi {
308
338
  * @param body
309
339
  */
310
340
  setDocumentsDelegations(body) {
311
- let _body = null;
312
- _body = body;
313
- const _url = this.host + `/document/delegations` + '?ts=' + new Date().getTime();
314
- let headers = this.headers;
315
- headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
316
- return XHR_1.XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
317
- .then((doc) => doc.body.map((it) => new IcureStub_1.IcureStub(it)))
318
- .catch((err) => this.handleError(err));
341
+ return __awaiter(this, void 0, void 0, function* () {
342
+ let _body = null;
343
+ _body = body;
344
+ const _url = this.host + `/document/delegations` + '?ts=' + new Date().getTime();
345
+ let headers = yield this.headers;
346
+ headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
347
+ return XHR_1.XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
348
+ .then((doc) => doc.body.map((it) => new IcureStub_1.IcureStub(it)))
349
+ .catch((err) => this.handleError(err));
350
+ });
319
351
  }
320
352
  /**
321
353
  * Creates or updates a secondary attachment for a document and returns the modified document instance afterward
@@ -329,20 +361,22 @@ class IccDocumentApi {
329
361
  * @return the updated document
330
362
  */
331
363
  setSecondaryAttachment(documentId, key, rev, attachment, utis) {
332
- const _url = this.host +
333
- `/document/` +
334
- encodeURIComponent(String(documentId)) +
335
- '/secondaryAttachments/' +
336
- encodeURIComponent(String(key)) +
337
- '?ts=' +
338
- new Date().getTime() +
339
- (rev ? '&rev=' + encodeURIComponent(String(rev)) : '') +
340
- (utis ? utis.map((x) => '&utis=' + encodeURIComponent(String(x))).join('') : '');
341
- let headers = this.headers;
342
- headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/octet-stream'));
343
- return XHR_1.XHR.sendCommand('PUT', _url, headers, attachment, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
344
- .then((doc) => new Document_1.Document(doc.body))
345
- .catch((err) => this.handleError(err));
364
+ return __awaiter(this, void 0, void 0, function* () {
365
+ const _url = this.host +
366
+ `/document/` +
367
+ encodeURIComponent(String(documentId)) +
368
+ '/secondaryAttachments/' +
369
+ encodeURIComponent(String(key)) +
370
+ '?ts=' +
371
+ new Date().getTime() +
372
+ (rev ? '&rev=' + encodeURIComponent(String(rev)) : '') +
373
+ (utis ? utis.map((x) => '&utis=' + encodeURIComponent(String(x))).join('') : '');
374
+ let headers = yield this.headers;
375
+ headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/octet-stream'));
376
+ return XHR_1.XHR.sendCommand('PUT', _url, headers, attachment, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
377
+ .then((doc) => new Document_1.Document(doc.body))
378
+ .catch((err) => this.handleError(err));
379
+ });
346
380
  }
347
381
  /**
348
382
  * Get the secondary attachment with the provided key for a document
@@ -353,16 +387,18 @@ class IccDocumentApi {
353
387
  * @return the content of the attachment
354
388
  */
355
389
  getSecondaryAttachment(documentId, key, fileName) {
356
- let _body = null;
357
- const _url = this.host +
358
- `/document/${encodeURIComponent(String(documentId))}/secondaryAttachments/${encodeURIComponent(String(key))}` +
359
- '?ts=' +
360
- new Date().getTime() +
361
- (fileName ? '&fileName=' + encodeURIComponent(String(fileName)) : '');
362
- let headers = this.headers;
363
- return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
364
- .then((doc) => doc.body)
365
- .catch((err) => this.handleError(err));
390
+ return __awaiter(this, void 0, void 0, function* () {
391
+ let _body = null;
392
+ const _url = this.host +
393
+ `/document/${encodeURIComponent(String(documentId))}/secondaryAttachments/${encodeURIComponent(String(key))}` +
394
+ '?ts=' +
395
+ new Date().getTime() +
396
+ (fileName ? '&fileName=' + encodeURIComponent(String(fileName)) : '');
397
+ let headers = yield this.headers;
398
+ return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
399
+ .then((doc) => doc.body)
400
+ .catch((err) => this.handleError(err));
401
+ });
366
402
  }
367
403
  /**
368
404
  * Deletes a document's attachment and returns the modified document instance afterward
@@ -373,16 +409,32 @@ class IccDocumentApi {
373
409
  * @return the updated document
374
410
  */
375
411
  deleteSecondaryAttachment(documentId, key, rev) {
376
- let _body = null;
377
- const _url = this.host +
378
- `/document/${encodeURIComponent(String(documentId))}/secondaryAttachments/${encodeURIComponent(String(key))}` +
379
- '?ts=' +
380
- new Date().getTime() +
381
- (rev ? '&rev=' + encodeURIComponent(String(rev)) : '');
382
- let headers = this.headers;
383
- return XHR_1.XHR.sendCommand('DELETE', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
384
- .then((doc) => new Document_1.Document(doc.body))
385
- .catch((err) => this.handleError(err));
412
+ return __awaiter(this, void 0, void 0, function* () {
413
+ let _body = null;
414
+ const _url = this.host +
415
+ `/document/${encodeURIComponent(String(documentId))}/secondaryAttachments/${encodeURIComponent(String(key))}` +
416
+ '?ts=' +
417
+ new Date().getTime() +
418
+ (rev ? '&rev=' + encodeURIComponent(String(rev)) : '');
419
+ let headers = yield this.headers;
420
+ return XHR_1.XHR.sendCommand('DELETE', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
421
+ .then((doc) => new Document_1.Document(doc.body))
422
+ .catch((err) => this.handleError(err));
423
+ });
424
+ }
425
+ // TODO single request multi-attachment update
426
+ /**
427
+ * @internal this method is for internal use only and may be changed without notice
428
+ */
429
+ bulkShareDocument(request) {
430
+ return __awaiter(this, void 0, void 0, function* () {
431
+ const _url = this.host + '/document/bulkSharedMetadataUpdate' + '?ts=' + new Date().getTime();
432
+ let headers = yield this.headers;
433
+ headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
434
+ return XHR_1.XHR.sendCommand('PUT', _url, headers, request, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
435
+ .then((doc) => doc.body.map((x) => new EntityBulkShareResult_1.EntityBulkShareResult(x, Document_1.Document)))
436
+ .catch((err) => this.handleError(err));
437
+ });
386
438
  }
387
439
  }
388
440
  exports.IccDocumentApi = IccDocumentApi;