@icure/api 8.0.0-RC.1 → 8.0.0-RC.2

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 (208) hide show
  1. package/icc-api/api/IccDocumentApi.d.ts +6 -0
  2. package/icc-api/api/IccDocumentApi.js +15 -0
  3. package/icc-api/api/IccDocumentApi.js.map +1 -1
  4. package/icc-api/api/IccExchangeDataApi.d.ts +1 -1
  5. package/icc-api/api/IccExchangeDataApi.js +1 -1
  6. package/icc-api/api/IccExchangeDataApi.js.map +1 -1
  7. package/icc-api/api/IccExchangeDataMapApi.d.ts +1 -1
  8. package/icc-api/api/IccExchangeDataMapApi.js +1 -1
  9. package/icc-api/api/IccExchangeDataMapApi.js.map +1 -1
  10. package/icc-api/api/IccMessageApi.d.ts +16 -0
  11. package/icc-api/api/IccMessageApi.js +38 -1
  12. package/icc-api/api/IccMessageApi.js.map +1 -1
  13. package/icc-api/api/IccSecureDelegationKeyMapApi.d.ts +26 -0
  14. package/icc-api/api/IccSecureDelegationKeyMapApi.js +71 -0
  15. package/icc-api/api/IccSecureDelegationKeyMapApi.js.map +1 -0
  16. package/icc-api/api/IccTopicApi.d.ts +90 -0
  17. package/icc-api/api/IccTopicApi.js +193 -0
  18. package/icc-api/api/IccTopicApi.js.map +1 -0
  19. package/icc-api/index.d.ts +1 -0
  20. package/icc-api/index.js +1 -0
  21. package/icc-api/index.js.map +1 -1
  22. package/icc-api/model/AbstractFilterMessage.d.ts +15 -0
  23. package/icc-api/model/AbstractFilterMessage.js +21 -0
  24. package/icc-api/model/AbstractFilterMessage.js.map +1 -0
  25. package/icc-api/model/AbstractFilterTopic.d.ts +15 -0
  26. package/icc-api/model/AbstractFilterTopic.js +21 -0
  27. package/icc-api/model/AbstractFilterTopic.js.map +1 -0
  28. package/icc-api/model/AccessLog.d.ts +0 -2
  29. package/icc-api/model/AccessLog.js +0 -1
  30. package/icc-api/model/AccessLog.js.map +1 -1
  31. package/icc-api/model/Article.d.ts +0 -2
  32. package/icc-api/model/Article.js +0 -1
  33. package/icc-api/model/Article.js.map +1 -1
  34. package/icc-api/model/CalendarItem.d.ts +0 -2
  35. package/icc-api/model/CalendarItem.js +0 -1
  36. package/icc-api/model/CalendarItem.js.map +1 -1
  37. package/icc-api/model/Classification.d.ts +0 -2
  38. package/icc-api/model/Classification.js +0 -1
  39. package/icc-api/model/Classification.js.map +1 -1
  40. package/icc-api/model/Connection.d.ts +1 -1
  41. package/icc-api/model/Connection.js.map +1 -1
  42. package/icc-api/model/Contact.d.ts +0 -2
  43. package/icc-api/model/Contact.js +0 -1
  44. package/icc-api/model/Contact.js.map +1 -1
  45. package/icc-api/model/Document.d.ts +0 -2
  46. package/icc-api/model/Document.js +0 -1
  47. package/icc-api/model/Document.js.map +1 -1
  48. package/icc-api/model/FilterChainMessage.d.ts +19 -0
  49. package/icc-api/model/FilterChainMessage.js +11 -0
  50. package/icc-api/model/FilterChainMessage.js.map +1 -0
  51. package/icc-api/model/FilterChainTopic.d.ts +19 -0
  52. package/icc-api/model/FilterChainTopic.js +11 -0
  53. package/icc-api/model/FilterChainTopic.js.map +1 -0
  54. package/icc-api/model/Form.d.ts +0 -2
  55. package/icc-api/model/Form.js +0 -1
  56. package/icc-api/model/Form.js.map +1 -1
  57. package/icc-api/model/HealthElement.d.ts +0 -2
  58. package/icc-api/model/HealthElement.js +0 -1
  59. package/icc-api/model/HealthElement.js.map +1 -1
  60. package/icc-api/model/HealthcareParty.js +13 -1
  61. package/icc-api/model/HealthcareParty.js.map +1 -1
  62. package/icc-api/model/Invoice.d.ts +0 -2
  63. package/icc-api/model/Invoice.js +0 -1
  64. package/icc-api/model/Invoice.js.map +1 -1
  65. package/icc-api/model/MaintenanceTask.d.ts +11 -10
  66. package/icc-api/model/MaintenanceTask.js +13 -12
  67. package/icc-api/model/MaintenanceTask.js.map +1 -1
  68. package/icc-api/model/Message.d.ts +0 -2
  69. package/icc-api/model/Message.js +0 -1
  70. package/icc-api/model/Message.js.map +1 -1
  71. package/icc-api/model/PaginatedListExchangeData.d.ts +1 -1
  72. package/icc-api/model/PaginatedListExchangeData.js.map +1 -1
  73. package/icc-api/model/PaginatedListTopic.d.ts +20 -0
  74. package/icc-api/model/PaginatedListTopic.js +10 -0
  75. package/icc-api/model/PaginatedListTopic.js.map +1 -0
  76. package/icc-api/model/Patient.d.ts +0 -2
  77. package/icc-api/model/Patient.js +0 -1
  78. package/icc-api/model/Patient.js.map +1 -1
  79. package/icc-api/model/Receipt.d.ts +0 -2
  80. package/icc-api/model/Receipt.js +0 -1
  81. package/icc-api/model/Receipt.js.map +1 -1
  82. package/icc-api/model/TimeTable.d.ts +0 -2
  83. package/icc-api/model/TimeTable.js +0 -1
  84. package/icc-api/model/TimeTable.js.map +1 -1
  85. package/icc-api/model/Topic.d.ts +95 -0
  86. package/icc-api/model/Topic.js +16 -0
  87. package/icc-api/model/Topic.js.map +1 -0
  88. package/icc-api/model/{ExchangeData.d.ts → internal/ExchangeData.d.ts} +3 -0
  89. package/icc-api/model/{ExchangeData.js → internal/ExchangeData.js} +3 -0
  90. package/icc-api/model/internal/ExchangeData.js.map +1 -0
  91. package/icc-api/model/{ExchangeDataMap.d.ts → internal/ExchangeDataMap.d.ts} +3 -0
  92. package/icc-api/model/{ExchangeDataMap.js → internal/ExchangeDataMap.js} +3 -0
  93. package/icc-api/model/internal/ExchangeDataMap.js.map +1 -0
  94. package/icc-api/model/internal/SecureDelegationKeyMap.d.ts +14 -0
  95. package/icc-api/model/internal/SecureDelegationKeyMap.js +13 -0
  96. package/icc-api/model/internal/SecureDelegationKeyMap.js.map +1 -0
  97. package/icc-api/model/models.d.ts +6 -1
  98. package/icc-api/model/models.js +4 -0
  99. package/icc-api/model/models.js.map +1 -1
  100. package/icc-x-api/basexapi/EncryptedEntityXApi.d.ts +52 -4
  101. package/icc-x-api/basexapi/EncryptedEntityXApi.js.map +1 -1
  102. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.d.ts +2 -0
  103. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js +13 -4
  104. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js.map +1 -1
  105. package/icc-x-api/crypto/AccessControlSecretUtils.d.ts +1 -0
  106. package/icc-x-api/crypto/AccessControlSecretUtils.js +11 -0
  107. package/icc-x-api/crypto/AccessControlSecretUtils.js.map +1 -1
  108. package/icc-x-api/crypto/BaseExchangeDataManager.d.ts +1 -1
  109. package/icc-x-api/crypto/BaseExchangeDataManager.js +1 -1
  110. package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -1
  111. package/icc-x-api/crypto/DelegationsDeAnonymization.d.ts +44 -0
  112. package/icc-x-api/crypto/DelegationsDeAnonymization.js +235 -0
  113. package/icc-x-api/crypto/DelegationsDeAnonymization.js.map +1 -0
  114. package/icc-x-api/crypto/ExchangeDataManager.d.ts +3 -1
  115. package/icc-x-api/crypto/ExchangeDataManager.js +27 -19
  116. package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
  117. package/icc-x-api/crypto/ExchangeDataMapManager.d.ts +1 -1
  118. package/icc-x-api/crypto/ExchangeDataMapManager.js.map +1 -1
  119. package/icc-x-api/crypto/ExtendedApisUtils.d.ts +0 -10
  120. package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -1
  121. package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +0 -7
  122. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +4 -7
  123. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -1
  124. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.d.ts +0 -6
  125. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js +0 -9
  126. package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js.map +1 -1
  127. package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -1
  128. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.d.ts +14 -5
  129. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js +44 -26
  130. package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js.map +1 -1
  131. package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +1 -18
  132. package/icc-x-api/crypto/SecurityMetadataDecryptor.js +4 -23
  133. package/icc-x-api/crypto/SecurityMetadataDecryptor.js.map +1 -1
  134. package/icc-x-api/filters/LatestMessageByHcPartyTransportGuidFilter.d.ts +8 -0
  135. package/icc-x-api/filters/LatestMessageByHcPartyTransportGuidFilter.js +13 -0
  136. package/icc-x-api/filters/LatestMessageByHcPartyTransportGuidFilter.js.map +1 -0
  137. package/icc-x-api/filters/MessageByHcPartyFilter.d.ts +7 -0
  138. package/icc-x-api/filters/MessageByHcPartyFilter.js +13 -0
  139. package/icc-x-api/filters/MessageByHcPartyFilter.js.map +1 -0
  140. package/icc-x-api/filters/MessageByHcPartyTransportGuidFilter.d.ts +8 -0
  141. package/icc-x-api/filters/MessageByHcPartyTransportGuidFilter.js +13 -0
  142. package/icc-x-api/filters/MessageByHcPartyTransportGuidFilter.js.map +1 -0
  143. package/icc-x-api/filters/TopicByHcPartyFilter.d.ts +7 -0
  144. package/icc-x-api/filters/TopicByHcPartyFilter.js +13 -0
  145. package/icc-x-api/filters/TopicByHcPartyFilter.js.map +1 -0
  146. package/icc-x-api/filters/TopicByParticipantFilter.d.ts +7 -0
  147. package/icc-x-api/filters/TopicByParticipantFilter.js +13 -0
  148. package/icc-x-api/filters/TopicByParticipantFilter.js.map +1 -0
  149. package/icc-x-api/filters/filters.d.ts +5 -0
  150. package/icc-x-api/filters/filters.js +5 -0
  151. package/icc-x-api/filters/filters.js.map +1 -1
  152. package/icc-x-api/icc-accesslog-x-api.d.ts +3 -1
  153. package/icc-x-api/icc-accesslog-x-api.js +7 -3
  154. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  155. package/icc-x-api/icc-calendar-item-x-api.d.ts +3 -1
  156. package/icc-x-api/icc-calendar-item-x-api.js +7 -3
  157. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  158. package/icc-x-api/icc-classification-x-api.d.ts +3 -1
  159. package/icc-x-api/icc-classification-x-api.js +7 -3
  160. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  161. package/icc-x-api/icc-contact-x-api.d.ts +3 -1
  162. package/icc-x-api/icc-contact-x-api.js +8 -4
  163. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  164. package/icc-x-api/icc-crypto-x-api.d.ts +7 -1
  165. package/icc-x-api/icc-crypto-x-api.js +8 -1
  166. package/icc-x-api/icc-crypto-x-api.js.map +1 -1
  167. package/icc-x-api/icc-document-x-api.d.ts +3 -1
  168. package/icc-x-api/icc-document-x-api.js +8 -4
  169. package/icc-x-api/icc-document-x-api.js.map +1 -1
  170. package/icc-x-api/icc-form-x-api.d.ts +3 -1
  171. package/icc-x-api/icc-form-x-api.js +7 -3
  172. package/icc-x-api/icc-form-x-api.js.map +1 -1
  173. package/icc-x-api/icc-helement-x-api.d.ts +4 -2
  174. package/icc-x-api/icc-helement-x-api.js +8 -8
  175. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  176. package/icc-x-api/icc-invoice-x-api.d.ts +3 -1
  177. package/icc-x-api/icc-invoice-x-api.js +7 -3
  178. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  179. package/icc-x-api/icc-maintenance-task-x-api.d.ts +3 -1
  180. package/icc-x-api/icc-maintenance-task-x-api.js +7 -3
  181. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  182. package/icc-x-api/icc-message-x-api.d.ts +24 -6
  183. package/icc-x-api/icc-message-x-api.js +66 -6
  184. package/icc-x-api/icc-message-x-api.js.map +1 -1
  185. package/icc-x-api/icc-patient-x-api.d.ts +3 -1
  186. package/icc-x-api/icc-patient-x-api.js +7 -3
  187. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  188. package/icc-x-api/icc-receipt-x-api.d.ts +3 -1
  189. package/icc-x-api/icc-receipt-x-api.js +7 -3
  190. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  191. package/icc-x-api/icc-time-table-x-api.d.ts +3 -1
  192. package/icc-x-api/icc-time-table-x-api.js +7 -3
  193. package/icc-x-api/icc-time-table-x-api.js.map +1 -1
  194. package/icc-x-api/icc-topic-x-api.d.ts +191 -0
  195. package/icc-x-api/icc-topic-x-api.js +307 -0
  196. package/icc-x-api/icc-topic-x-api.js.map +1 -0
  197. package/icc-x-api/index.d.ts +15 -0
  198. package/icc-x-api/index.js +99 -70
  199. package/icc-x-api/index.js.map +1 -1
  200. package/icc-x-api/maintenance/KeyPairUpdateRequest.d.ts +1 -1
  201. package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +1 -1
  202. package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -1
  203. package/icc-x-api/utils/websocket.d.ts +4 -0
  204. package/icc-x-api/utils/websocket.js +8 -0
  205. package/icc-x-api/utils/websocket.js.map +1 -1
  206. package/package.json +1 -1
  207. package/icc-api/model/ExchangeData.js.map +0 -1
  208. package/icc-api/model/ExchangeDataMap.js.map +0 -1
@@ -74,6 +74,9 @@ const ExchangeDataMapManager_1 = require("./crypto/ExchangeDataMapManager");
74
74
  const icc_device_x_api_1 = require("./icc-device-x-api");
75
75
  const icc_bekmehr_x_api_1 = require("./icc-bekmehr-x-api");
76
76
  const icc_doctemplate_x_api_1 = require("./icc-doctemplate-x-api");
77
+ const icc_topic_x_api_1 = require("./icc-topic-x-api");
78
+ const DataOwnerTypeEnum_1 = require("../icc-api/model/DataOwnerTypeEnum");
79
+ const DelegationsDeAnonymization_1 = require("./crypto/DelegationsDeAnonymization");
77
80
  __exportStar(require("./icc-accesslog-x-api"), exports);
78
81
  __exportStar(require("./icc-bekmehr-x-api"), exports);
79
82
  __exportStar(require("./icc-calendar-item-x-api"), exports);
@@ -98,6 +101,7 @@ __exportStar(require("./icc-maintenance-task-x-api"), exports);
98
101
  __exportStar(require("./utils"), exports);
99
102
  __exportStar(require("./crypto/RSA"), exports);
100
103
  __exportStar(require("./crypto/CryptoPrimitives"), exports);
104
+ __exportStar(require("./crypto/ShareMetadataBehaviour"), exports);
101
105
  __exportStar(require("./auth/AuthenticationProvider"), exports);
102
106
  var LocalStorageImpl_2 = require("./storage/LocalStorageImpl");
103
107
  Object.defineProperty(exports, "LocalStorageImpl", { enumerable: true, get: function () { return LocalStorageImpl_2.LocalStorageImpl; } });
@@ -119,7 +123,7 @@ var IcureApiOptions;
119
123
  this.storage = (_c = custom.storage) !== null && _c !== void 0 ? _c : new LocalStorageImpl_1.LocalStorageImpl();
120
124
  this.keyStorage = (_d = custom.keyStorage) !== null && _d !== void 0 ? _d : new KeyStorageImpl_1.KeyStorageImpl(this.storage);
121
125
  this.headers = (_e = custom.headers) !== null && _e !== void 0 ? _e : Defaults.headers;
122
- this.encryptedFieldsConfig = (_f = custom.encryptedFieldsConfig) !== null && _f !== void 0 ? _f : EncryptedFieldsConfig.Defaults;
126
+ this.encryptedFieldsConfig = (_f = custom.encryptedFieldsConfig) !== null && _f !== void 0 ? _f : {};
123
127
  this.groupSelector = (_g = custom.groupSelector) !== null && _g !== void 0 ? _g : ((groups) => Promise.resolve(groups[0].groupId));
124
128
  this.disableParentKeysInitialisation = (_h = custom.disableParentKeysInitialisation) !== null && _h !== void 0 ? _h : false;
125
129
  }
@@ -136,6 +140,8 @@ var EncryptedFieldsConfig;
136
140
  healthElement: ['descr', 'note', 'notes[].markdown'],
137
141
  maintenanceTask: ['properties'],
138
142
  patient: ['note', 'notes[].markdown'],
143
+ message: [],
144
+ topic: ['description', 'linkedServices', 'linkedHealthElements'],
139
145
  };
140
146
  })(EncryptedFieldsConfig = exports.EncryptedFieldsConfig || (exports.EncryptedFieldsConfig = {}));
141
147
  var IcureApi;
@@ -177,28 +183,43 @@ var IcureApi;
177
183
  * probably linked to replication of the user in the fallback database.
178
184
  */
179
185
  const groupSpecificAuthenticationProvider = matches.length > 1 ? yield grouplessAuthenticationProvider.switchGroup(chosenGroupId, matches) : grouplessAuthenticationProvider;
180
- const cryptoApis = yield initialiseCryptoWithProvider(host, fetchImpl, groupSpecificAuthenticationProvider, params, cryptoStrategies, crypto);
181
- return new IcureApiImpl(cryptoApis, host, groupSpecificAuthenticationProvider, fetch, grouplessUserApi, matches, matches.find((match) => match.groupId === chosenGroupId), params, cryptoStrategies);
186
+ const cryptoInitInfo = yield initialiseCryptoWithProvider(host, fetchImpl, groupSpecificAuthenticationProvider, params, cryptoStrategies, crypto);
187
+ return new IcureApiImpl(cryptoInitInfo, host, groupSpecificAuthenticationProvider, fetch, grouplessUserApi, matches, matches.find((match) => match.groupId === chosenGroupId), params, cryptoStrategies);
182
188
  });
183
189
  }
184
190
  IcureApi.initialise = initialise;
185
191
  })(IcureApi = exports.IcureApi || (exports.IcureApi = {}));
192
+ const REQUEST_AUTOFIX_ANONYMITY_HEADER = 'Icure-Request-Autofix-Anonymity';
186
193
  function initialiseCryptoWithProvider(host, fetchImpl, groupSpecificAuthenticationProvider, params, cryptoStrategies, crypto) {
187
194
  var _a;
188
195
  return __awaiter(this, void 0, void 0, function* () {
189
- // Here I instantiate a separate instance of the AuthApi that can call also login-protected methods (logout)
190
- const authApi = new icc_api_1.IccAuthApi(host, params.headers, groupSpecificAuthenticationProvider, fetchImpl);
191
- const userApi = new icc_user_x_api_1.IccUserXApi(host, params.headers, groupSpecificAuthenticationProvider, authApi, fetchImpl);
192
- const healthcarePartyApi = new icc_hcparty_x_api_1.IccHcpartyXApi(host, params.headers, groupSpecificAuthenticationProvider, authApi, fetchImpl);
193
- const deviceApi = new icc_device_x_api_1.IccDeviceXApi(host, params.headers, groupSpecificAuthenticationProvider, userApi, authApi, fetchImpl);
194
- const basePatientApi = new icc_api_1.IccPatientApi(host, params.headers, groupSpecificAuthenticationProvider, fetchImpl);
195
- const dataOwnerApi = new icc_data_owner_x_api_1.IccDataOwnerXApi(host, params.headers, groupSpecificAuthenticationProvider, fetchImpl);
196
- const exchangeDataApi = new IccExchangeDataApi_1.IccExchangeDataApi(host, params.headers, groupSpecificAuthenticationProvider, fetchImpl);
196
+ const initialDataOwnerStub = yield new icc_data_owner_x_api_1.IccDataOwnerXApi(host, params.headers, groupSpecificAuthenticationProvider, fetchImpl).getCurrentDataOwnerStub();
197
+ const dataOwnerRequiresAnonymousDelegation = cryptoStrategies.dataOwnerRequiresAnonymousDelegation(initialDataOwnerStub);
198
+ let updatedHeaders = params.headers;
199
+ if (!Object.keys(updatedHeaders).includes(REQUEST_AUTOFIX_ANONYMITY_HEADER)) {
200
+ if (initialDataOwnerStub.type == DataOwnerTypeEnum_1.DataOwnerTypeEnum.Patient || initialDataOwnerStub.type == DataOwnerTypeEnum_1.DataOwnerTypeEnum.Device) {
201
+ if (!dataOwnerRequiresAnonymousDelegation) {
202
+ updatedHeaders = Object.assign(Object.assign({}, updatedHeaders), { [REQUEST_AUTOFIX_ANONYMITY_HEADER]: 'false' });
203
+ }
204
+ }
205
+ else {
206
+ if (dataOwnerRequiresAnonymousDelegation) {
207
+ updatedHeaders = Object.assign(Object.assign({}, updatedHeaders), { [REQUEST_AUTOFIX_ANONYMITY_HEADER]: 'true' });
208
+ }
209
+ }
210
+ }
211
+ const authApi = new icc_api_1.IccAuthApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl);
212
+ const userApi = new icc_user_x_api_1.IccUserXApi(host, updatedHeaders, groupSpecificAuthenticationProvider, authApi, fetchImpl);
213
+ const healthcarePartyApi = new icc_hcparty_x_api_1.IccHcpartyXApi(host, updatedHeaders, groupSpecificAuthenticationProvider, authApi, fetchImpl);
214
+ const deviceApi = new icc_device_x_api_1.IccDeviceXApi(host, updatedHeaders, groupSpecificAuthenticationProvider, userApi, authApi, fetchImpl);
215
+ const basePatientApi = new icc_api_1.IccPatientApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl);
216
+ const dataOwnerApi = new icc_data_owner_x_api_1.IccDataOwnerXApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl);
217
+ const exchangeDataApi = new IccExchangeDataApi_1.IccExchangeDataApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl);
197
218
  // Crypto initialisation
198
219
  const icureStorage = new IcureStorageFacade_1.IcureStorageFacade(params.keyStorage, params.storage, params.entryKeysFactory);
199
220
  const cryptoPrimitives = new CryptoPrimitives_1.CryptoPrimitives(crypto);
200
221
  const baseExchangeKeysManager = new BaseExchangeKeysManager_1.BaseExchangeKeysManager(cryptoPrimitives, dataOwnerApi, healthcarePartyApi, basePatientApi, deviceApi);
201
- const baseExchangeDataManager = new BaseExchangeDataManager_1.BaseExchangeDataManager(exchangeDataApi, dataOwnerApi, cryptoPrimitives, cryptoStrategies.dataOwnerRequiresAnonymousDelegation(yield dataOwnerApi.getCurrentDataOwnerStub()));
222
+ const baseExchangeDataManager = new BaseExchangeDataManager_1.BaseExchangeDataManager(exchangeDataApi, dataOwnerApi, cryptoPrimitives, dataOwnerRequiresAnonymousDelegation);
202
223
  const keyRecovery = new KeyRecovery_1.KeyRecovery(cryptoPrimitives, dataOwnerApi, baseExchangeKeysManager, baseExchangeDataManager);
203
224
  const userEncryptionKeysManager = new UserEncryptionKeysManager_1.UserEncryptionKeysManager(cryptoPrimitives, dataOwnerApi, icureStorage, keyRecovery, cryptoStrategies, !params.disableParentKeysInitialisation);
204
225
  const userSignatureKeysManager = new UserSignatureKeysManager_1.UserSignatureKeysManager(icureStorage, dataOwnerApi, cryptoPrimitives);
@@ -208,14 +229,17 @@ function initialiseCryptoWithProvider(host, fetchImpl, groupSpecificAuthenticati
208
229
  const exchangeKeysManager = new ExchangeKeysManager_1.ExchangeKeysManager(100, 500, 600000, 60000, cryptoStrategies, cryptoPrimitives, userEncryptionKeysManager, baseExchangeKeysManager, dataOwnerApi, !params.disableParentKeysInitialisation, icureStorage);
209
230
  const accessControlSecretUtils = new AccessControlSecretUtils_1.AccessControlSecretUtils(cryptoPrimitives);
210
231
  const exchangeDataManager = yield (0, ExchangeDataManager_1.initialiseExchangeDataManagerForCurrentDataOwner)(baseExchangeDataManager, userEncryptionKeysManager, userSignatureKeysManager, accessControlSecretUtils, cryptoStrategies, dataOwnerApi, cryptoPrimitives, !params.disableParentKeysInitialisation);
211
- const exchangeDataMapManager = new ExchangeDataMapManager_1.ExchangeDataMapManager(new IccExchangeDataMapApi_1.IccExchangeDataMapApi(host, params.headers, groupSpecificAuthenticationProvider, fetchImpl));
232
+ const exchangeDataMapManager = new ExchangeDataMapManager_1.ExchangeDataMapManager(new IccExchangeDataMapApi_1.IccExchangeDataMapApi(host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl));
212
233
  const secureDelegationsEncryption = new SecureDelegationsEncryption_1.SecureDelegationsEncryption(userEncryptionKeysManager, cryptoPrimitives);
213
- const xApiUtils = new ExtendedApisUtilsImpl_1.ExtendedApisUtilsImpl(cryptoPrimitives, dataOwnerApi, new LegacyDelegationSecurityMetadataDecryptor_1.LegacyDelegationSecurityMetadataDecryptor(exchangeKeysManager, cryptoPrimitives), new SecureDelegationsSecurityMetadataDecryptor_1.SecureDelegationsSecurityMetadataDecryptor(exchangeDataManager, exchangeDataMapManager, secureDelegationsEncryption, dataOwnerApi), new SecureDelegationsManager_1.SecureDelegationsManager(exchangeDataManager, exchangeDataMapManager, secureDelegationsEncryption, accessControlSecretUtils, userEncryptionKeysManager, cryptoPrimitives, dataOwnerApi, cryptoStrategies, cryptoStrategies.dataOwnerRequiresAnonymousDelegation(yield dataOwnerApi.getCurrentDataOwnerStub())), userApi, !params.disableParentKeysInitialisation);
234
+ const secureDelegationsSecurityMetadataEncryption = new SecureDelegationsSecurityMetadataDecryptor_1.SecureDelegationsSecurityMetadataDecryptor(exchangeDataManager, exchangeDataMapManager, secureDelegationsEncryption, dataOwnerApi);
235
+ const xApiUtils = new ExtendedApisUtilsImpl_1.ExtendedApisUtilsImpl(cryptoPrimitives, dataOwnerApi, new LegacyDelegationSecurityMetadataDecryptor_1.LegacyDelegationSecurityMetadataDecryptor(exchangeKeysManager, cryptoPrimitives), secureDelegationsSecurityMetadataEncryption, new SecureDelegationsManager_1.SecureDelegationsManager(exchangeDataManager, exchangeDataMapManager, secureDelegationsEncryption, accessControlSecretUtils, userEncryptionKeysManager, cryptoPrimitives, dataOwnerApi, cryptoStrategies, dataOwnerRequiresAnonymousDelegation), userApi, !params.disableParentKeysInitialisation);
214
236
  const shamirManager = new ShamirKeysManager_1.ShamirKeysManager(cryptoPrimitives, dataOwnerApi, userEncryptionKeysManager, exchangeDataManager);
215
237
  const confidentialEntitites = new ConfidentialEntities_1.ConfidentialEntities(xApiUtils, cryptoPrimitives, dataOwnerApi);
216
238
  yield (0, utils_1.ensureDelegationForSelf)(dataOwnerApi, xApiUtils, basePatientApi, cryptoPrimitives);
217
- const cryptoApi = new icc_crypto_x_api_1.IccCryptoXApi(exchangeKeysManager, cryptoPrimitives, userEncryptionKeysManager, dataOwnerApi, xApiUtils, shamirManager, params.storage, params.keyStorage, confidentialEntitites, exchangeDataManager, new AccessControlKeysHeadersProvider_1.AccessControlKeysHeadersProvider(exchangeDataManager));
218
- const maintenanceTaskApi = new icc_maintenance_task_x_api_1.IccMaintenanceTaskXApi(host, params.headers, cryptoApi, healthcarePartyApi, dataOwnerApi, userApi, authApi, (_a = params.encryptedFieldsConfig.maintenanceTask) !== null && _a !== void 0 ? _a : EncryptedFieldsConfig.Defaults.maintenanceTask, groupSpecificAuthenticationProvider, fetchImpl);
239
+ const accessControlKeysHeadersProvider = new AccessControlKeysHeadersProvider_1.AccessControlKeysHeadersProvider(exchangeDataManager);
240
+ const delegationsDeAnonymisation = new DelegationsDeAnonymization_1.DelegationsDeAnonymization(dataOwnerApi, secureDelegationsSecurityMetadataEncryption, xApiUtils, cryptoPrimitives, accessControlSecretUtils, host, updatedHeaders, groupSpecificAuthenticationProvider, fetchImpl, accessControlKeysHeadersProvider);
241
+ const cryptoApi = new icc_crypto_x_api_1.IccCryptoXApi(exchangeKeysManager, cryptoPrimitives, userEncryptionKeysManager, dataOwnerApi, xApiUtils, shamirManager, params.storage, params.keyStorage, confidentialEntitites, exchangeDataManager, accessControlKeysHeadersProvider, delegationsDeAnonymisation);
242
+ const maintenanceTaskApi = new icc_maintenance_task_x_api_1.IccMaintenanceTaskXApi(host, updatedHeaders, cryptoApi, healthcarePartyApi, dataOwnerApi, userApi, authApi, !dataOwnerRequiresAnonymousDelegation, (_a = params.encryptedFieldsConfig.maintenanceTask) !== null && _a !== void 0 ? _a : EncryptedFieldsConfig.Defaults.maintenanceTask, groupSpecificAuthenticationProvider, fetchImpl);
219
243
  const icureMaintenanceTaskApi = new icc_icure_maintenance_x_api_1.IccIcureMaintenanceXApi(cryptoApi, maintenanceTaskApi, dataOwnerApi, exchangeDataApi);
220
244
  if (newKey && params.createMaintenanceTasksOnNewKey) {
221
245
  yield icureMaintenanceTaskApi.createMaintenanceTasksForNewKeypair(yield userApi.getCurrentUser(), newKey.newKeyPair);
@@ -228,17 +252,18 @@ function initialiseCryptoWithProvider(host, fetchImpl, groupSpecificAuthenticati
228
252
  maintenanceTaskApi,
229
253
  dataOwnerApi,
230
254
  icureMaintenanceTaskApi,
255
+ headers: updatedHeaders,
256
+ dataOwnerRequiresAnonymousDelegation,
231
257
  };
232
258
  });
233
259
  }
234
260
  class IcureApiImpl {
235
- constructor(cryptoInitApis, host, groupSpecificAuthenticationProvider, fetch, grouplessUserApi, latestMatches, currentGroupInfo, params, cryptoStrategies) {
236
- this.cryptoInitApis = cryptoInitApis;
261
+ constructor(cryptoInitInfos, host, groupSpecificAuthenticationProvider, fetch, grouplessUserApi, latestMatches, currentGroupInfo, params, cryptoStrategies) {
262
+ this.cryptoInitInfos = cryptoInitInfos;
237
263
  this.host = host;
238
264
  this.groupSpecificAuthenticationProvider = groupSpecificAuthenticationProvider;
239
265
  this.fetch = fetch;
240
266
  this.grouplessUserApi = grouplessUserApi;
241
- this.latestMatches = latestMatches;
242
267
  this.currentGroupInfo = currentGroupInfo;
243
268
  this.params = params;
244
269
  this.cryptoStrategies = cryptoStrategies;
@@ -246,188 +271,192 @@ class IcureApiImpl {
246
271
  }
247
272
  get authApi() {
248
273
  var _a;
249
- return (_a = this._authApi) !== null && _a !== void 0 ? _a : (this._authApi = new icc_api_1.IccAuthApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
274
+ return ((_a = this._authApi) !== null && _a !== void 0 ? _a : (this._authApi = new icc_api_1.IccAuthApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
250
275
  }
251
276
  get codeApi() {
252
277
  var _a;
253
- return (_a = this._codeApi) !== null && _a !== void 0 ? _a : (this._codeApi = new icc_code_x_api_1.IccCodeXApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
278
+ return ((_a = this._codeApi) !== null && _a !== void 0 ? _a : (this._codeApi = new icc_code_x_api_1.IccCodeXApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
254
279
  }
255
280
  get calendarItemTypeApi() {
256
281
  var _a;
257
- return ((_a = this._calendarItemTypeApi) !== null && _a !== void 0 ? _a : (this._calendarItemTypeApi = new icc_api_1.IccCalendarItemTypeApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
282
+ return ((_a = this._calendarItemTypeApi) !== null && _a !== void 0 ? _a : (this._calendarItemTypeApi = new icc_api_1.IccCalendarItemTypeApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
258
283
  }
259
284
  get medicalLocationApi() {
260
285
  var _a;
261
- return ((_a = this._medicalLocationApi) !== null && _a !== void 0 ? _a : (this._medicalLocationApi = new icc_api_1.IccMedicallocationApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
286
+ return ((_a = this._medicalLocationApi) !== null && _a !== void 0 ? _a : (this._medicalLocationApi = new icc_api_1.IccMedicallocationApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
262
287
  }
263
288
  get entityReferenceApi() {
264
289
  var _a;
265
- return ((_a = this._entityReferenceApi) !== null && _a !== void 0 ? _a : (this._entityReferenceApi = new icc_api_1.IccEntityrefApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
290
+ return ((_a = this._entityReferenceApi) !== null && _a !== void 0 ? _a : (this._entityReferenceApi = new icc_api_1.IccEntityrefApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
266
291
  }
267
292
  get permissionApi() {
268
293
  var _a;
269
- return ((_a = this._permissionApi) !== null && _a !== void 0 ? _a : (this._permissionApi = new icc_api_1.IccPermissionApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
294
+ return ((_a = this._permissionApi) !== null && _a !== void 0 ? _a : (this._permissionApi = new icc_api_1.IccPermissionApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
270
295
  }
271
296
  get accessLogApi() {
272
297
  var _a, _b;
273
- return ((_a = this._accessLogApi) !== null && _a !== void 0 ? _a : (this._accessLogApi = new icc_accesslog_x_api_1.IccAccesslogXApi(this.host, this.params.headers, this.cryptoApi, this.dataOwnerApi, (_b = this.params.encryptedFieldsConfig.accessLog) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.accessLog, this.groupSpecificAuthenticationProvider, this.fetch)));
298
+ return ((_a = this._accessLogApi) !== null && _a !== void 0 ? _a : (this._accessLogApi = new icc_accesslog_x_api_1.IccAccesslogXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.dataOwnerApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, (_b = this.params.encryptedFieldsConfig.accessLog) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.accessLog, this.groupSpecificAuthenticationProvider, this.fetch)));
274
299
  }
275
300
  get agendaApi() {
276
301
  var _a;
277
- return ((_a = this._agendaApi) !== null && _a !== void 0 ? _a : (this._agendaApi = new icc_api_1.IccAgendaApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
302
+ return ((_a = this._agendaApi) !== null && _a !== void 0 ? _a : (this._agendaApi = new icc_api_1.IccAgendaApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
278
303
  }
279
304
  get contactApi() {
280
305
  var _a, _b, _c;
281
- return ((_a = this._contactApi) !== null && _a !== void 0 ? _a : (this._contactApi = new icc_contact_x_api_1.IccContactXApi(this.host, this.params.headers, this.cryptoApi, this.dataOwnerApi, this.userApi, this.authApi, this.groupSpecificAuthenticationProvider, this.fetch, (_b = this.params.encryptedFieldsConfig.contact) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.contact, (_c = this.params.encryptedFieldsConfig.service) !== null && _c !== void 0 ? _c : EncryptedFieldsConfig.Defaults.service)));
306
+ return ((_a = this._contactApi) !== null && _a !== void 0 ? _a : (this._contactApi = new icc_contact_x_api_1.IccContactXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.dataOwnerApi, this.userApi, this.authApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, this.groupSpecificAuthenticationProvider, this.fetch, (_b = this.params.encryptedFieldsConfig.contact) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.contact, (_c = this.params.encryptedFieldsConfig.service) !== null && _c !== void 0 ? _c : EncryptedFieldsConfig.Defaults.service)));
282
307
  }
283
308
  get formApi() {
284
309
  var _a;
285
- return ((_a = this._formApi) !== null && _a !== void 0 ? _a : (this._formApi = new icc_form_x_api_1.IccFormXApi(this.host, this.params.headers, this.cryptoApi, this.dataOwnerApi, this.groupSpecificAuthenticationProvider, this.fetch)));
310
+ return ((_a = this._formApi) !== null && _a !== void 0 ? _a : (this._formApi = new icc_form_x_api_1.IccFormXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.dataOwnerApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, this.groupSpecificAuthenticationProvider, this.fetch)));
286
311
  }
287
312
  get groupApi() {
288
313
  var _a;
289
- return (_a = this._groupApi) !== null && _a !== void 0 ? _a : (this._groupApi = new icc_api_1.IccGroupApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
314
+ return ((_a = this._groupApi) !== null && _a !== void 0 ? _a : (this._groupApi = new icc_api_1.IccGroupApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
290
315
  }
291
316
  get invoiceApi() {
292
317
  var _a;
293
- return ((_a = this._invoiceApi) !== null && _a !== void 0 ? _a : (this._invoiceApi = new icc_invoice_x_api_1.IccInvoiceXApi(this.host, this.params.headers, this.cryptoApi, this.entityReferenceApi, this.dataOwnerApi, this.groupSpecificAuthenticationProvider, this.fetch)));
318
+ return ((_a = this._invoiceApi) !== null && _a !== void 0 ? _a : (this._invoiceApi = new icc_invoice_x_api_1.IccInvoiceXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.entityReferenceApi, this.dataOwnerApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, this.groupSpecificAuthenticationProvider, this.fetch)));
294
319
  }
295
320
  get insuranceApi() {
296
321
  var _a;
297
- return ((_a = this._insuranceApi) !== null && _a !== void 0 ? _a : (this._insuranceApi = new icc_api_1.IccInsuranceApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
322
+ return ((_a = this._insuranceApi) !== null && _a !== void 0 ? _a : (this._insuranceApi = new icc_api_1.IccInsuranceApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
298
323
  }
299
324
  get documentApi() {
300
325
  var _a;
301
- return ((_a = this._documentApi) !== null && _a !== void 0 ? _a : (this._documentApi = new icc_document_x_api_1.IccDocumentXApi(this.host, this.params.headers, this.cryptoApi, this.authApi, this.dataOwnerApi, this.groupSpecificAuthenticationProvider, this.fetch)));
326
+ return ((_a = this._documentApi) !== null && _a !== void 0 ? _a : (this._documentApi = new icc_document_x_api_1.IccDocumentXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.authApi, this.dataOwnerApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, this.groupSpecificAuthenticationProvider, this.fetch)));
302
327
  }
303
328
  get healthcareElementApi() {
304
329
  var _a, _b;
305
- return ((_a = this._healthcareElementApi) !== null && _a !== void 0 ? _a : (this._healthcareElementApi = new icc_helement_x_api_1.IccHelementXApi(this.host, this.params.headers, this.cryptoApi, this.dataOwnerApi, this.userApi, this.authApi, (_b = this.params.encryptedFieldsConfig.healthElement) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.healthElement, this.groupSpecificAuthenticationProvider, this.fetch)));
330
+ return ((_a = this._healthcareElementApi) !== null && _a !== void 0 ? _a : (this._healthcareElementApi = new icc_helement_x_api_1.IccHelementXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.dataOwnerApi, this.userApi, this.authApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, (_b = this.params.encryptedFieldsConfig.healthElement) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.healthElement, this.groupSpecificAuthenticationProvider, this.fetch)));
306
331
  }
307
332
  get classificationApi() {
308
333
  var _a;
309
- return ((_a = this._classificationApi) !== null && _a !== void 0 ? _a : (this._classificationApi = new icc_classification_x_api_1.IccClassificationXApi(this.host, this.params.headers, this.cryptoApi, this.dataOwnerApi, this.groupSpecificAuthenticationProvider, this.fetch)));
334
+ return ((_a = this._classificationApi) !== null && _a !== void 0 ? _a : (this._classificationApi = new icc_classification_x_api_1.IccClassificationXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.dataOwnerApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, this.groupSpecificAuthenticationProvider, this.fetch)));
310
335
  }
311
336
  get calendarItemApi() {
312
337
  var _a, _b;
313
- return ((_a = this._calendarItemApi) !== null && _a !== void 0 ? _a : (this._calendarItemApi = new icc_calendar_item_x_api_1.IccCalendarItemXApi(this.host, this.params.headers, this.cryptoApi, this.dataOwnerApi, (_b = this.params.encryptedFieldsConfig.calendarItem) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.calendarItem, this.groupSpecificAuthenticationProvider, this.fetch)));
338
+ return ((_a = this._calendarItemApi) !== null && _a !== void 0 ? _a : (this._calendarItemApi = new icc_calendar_item_x_api_1.IccCalendarItemXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.dataOwnerApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, (_b = this.params.encryptedFieldsConfig.calendarItem) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.calendarItem, this.groupSpecificAuthenticationProvider, this.fetch)));
314
339
  }
315
340
  get receiptApi() {
316
341
  var _a;
317
- return ((_a = this._receiptApi) !== null && _a !== void 0 ? _a : (this._receiptApi = new icc_receipt_x_api_1.IccReceiptXApi(this.host, this.params.headers, this.cryptoApi, this.dataOwnerApi, this.groupSpecificAuthenticationProvider, this.fetch)));
342
+ return ((_a = this._receiptApi) !== null && _a !== void 0 ? _a : (this._receiptApi = new icc_receipt_x_api_1.IccReceiptXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.dataOwnerApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, this.groupSpecificAuthenticationProvider, this.fetch)));
318
343
  }
319
344
  get timetableApi() {
320
345
  var _a;
321
- return ((_a = this._timetableApi) !== null && _a !== void 0 ? _a : (this._timetableApi = new icc_time_table_x_api_1.IccTimeTableXApi(this.host, this.params.headers, this.cryptoApi, this.dataOwnerApi, this.groupSpecificAuthenticationProvider, this.fetch)));
346
+ return ((_a = this._timetableApi) !== null && _a !== void 0 ? _a : (this._timetableApi = new icc_time_table_x_api_1.IccTimeTableXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.dataOwnerApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, this.groupSpecificAuthenticationProvider, this.fetch)));
322
347
  }
323
348
  get patientApi() {
324
349
  var _a, _b;
325
- return ((_a = this._patientApi) !== null && _a !== void 0 ? _a : (this._patientApi = new icc_patient_x_api_1.IccPatientXApi(this.host, this.params.headers, this.cryptoApi, this.contactApi, this.formApi, this.healthcareElementApi, this.invoiceApi, this.documentApi, this.healthcarePartyApi, this.classificationApi, this.dataOwnerApi, this.calendarItemApi, this.userApi, this.authApi, (_b = this.params.encryptedFieldsConfig.patient) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.patient, this.groupSpecificAuthenticationProvider, this.fetch)));
350
+ return ((_a = this._patientApi) !== null && _a !== void 0 ? _a : (this._patientApi = new icc_patient_x_api_1.IccPatientXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.contactApi, this.formApi, this.healthcareElementApi, this.invoiceApi, this.documentApi, this.healthcarePartyApi, this.classificationApi, this.dataOwnerApi, this.calendarItemApi, this.userApi, this.authApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, (_b = this.params.encryptedFieldsConfig.patient) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.patient, this.groupSpecificAuthenticationProvider, this.fetch)));
326
351
  }
327
352
  get messageApi() {
328
- var _a;
329
- return ((_a = this._messageApi) !== null && _a !== void 0 ? _a : (this._messageApi = new icc_message_x_api_1.IccMessageXApi(this.host, this.params.headers, this.cryptoApi, this.dataOwnerApi, this.groupSpecificAuthenticationProvider, this.fetch)));
353
+ var _a, _b;
354
+ return ((_a = this._messageApi) !== null && _a !== void 0 ? _a : (this._messageApi = new icc_message_x_api_1.IccMessageXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.dataOwnerApi, this.authApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, this.groupSpecificAuthenticationProvider, (_b = this.params.encryptedFieldsConfig.message) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.message, this.fetch)));
355
+ }
356
+ get topicApi() {
357
+ var _a, _b;
358
+ return ((_a = this._topicApi) !== null && _a !== void 0 ? _a : (this._topicApi = new icc_topic_x_api_1.IccTopicXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.dataOwnerApi, this.authApi, !this.cryptoInitInfos.dataOwnerRequiresAnonymousDelegation, this.groupSpecificAuthenticationProvider, (_b = this.params.encryptedFieldsConfig.topic) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.topic, this.fetch)));
330
359
  }
331
360
  get anonymousAccessApi() {
332
361
  var _a;
333
- return ((_a = this._anonymousAccessApi) !== null && _a !== void 0 ? _a : (this._anonymousAccessApi = new icc_api_1.IccAnonymousAccessApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
362
+ return ((_a = this._anonymousAccessApi) !== null && _a !== void 0 ? _a : (this._anonymousAccessApi = new icc_api_1.IccAnonymousAccessApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
334
363
  }
335
364
  get applicationSettingsApi() {
336
365
  var _a;
337
- return ((_a = this._applicationSettingsApi) !== null && _a !== void 0 ? _a : (this._applicationSettingsApi = new icc_api_1.IccApplicationsettingsApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
366
+ return ((_a = this._applicationSettingsApi) !== null && _a !== void 0 ? _a : (this._applicationSettingsApi = new icc_api_1.IccApplicationsettingsApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
338
367
  }
339
368
  get articleApi() {
340
369
  var _a;
341
- return ((_a = this._articleApi) !== null && _a !== void 0 ? _a : (this._articleApi = new icc_api_1.IccArticleApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
370
+ return ((_a = this._articleApi) !== null && _a !== void 0 ? _a : (this._articleApi = new icc_api_1.IccArticleApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
342
371
  }
343
372
  get bekmehrApi() {
344
373
  var _a;
345
- return ((_a = this._bekmehrApi) !== null && _a !== void 0 ? _a : (this._bekmehrApi = new icc_bekmehr_x_api_1.IccBekmehrXApi(this.host, this.params.headers, this.authApi, this.contactApi, this.healthcareElementApi, this.documentApi, this.groupSpecificAuthenticationProvider, this.fetch)));
374
+ return ((_a = this._bekmehrApi) !== null && _a !== void 0 ? _a : (this._bekmehrApi = new icc_bekmehr_x_api_1.IccBekmehrXApi(this.host, this.cryptoInitInfos.headers, this.authApi, this.contactApi, this.healthcareElementApi, this.documentApi, this.groupSpecificAuthenticationProvider, this.fetch)));
346
375
  }
347
376
  get beefactApi() {
348
377
  var _a;
349
- return ((_a = this._beefactApi) !== null && _a !== void 0 ? _a : (this._beefactApi = new icc_api_1.IccBeefactApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
378
+ return ((_a = this._beefactApi) !== null && _a !== void 0 ? _a : (this._beefactApi = new icc_api_1.IccBeefactApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
350
379
  }
351
380
  get beresultexportApi() {
352
381
  var _a;
353
- return ((_a = this._beresultexportApi) !== null && _a !== void 0 ? _a : (this._beresultexportApi = new icc_api_1.IccBeresultexportApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
382
+ return ((_a = this._beresultexportApi) !== null && _a !== void 0 ? _a : (this._beresultexportApi = new icc_api_1.IccBeresultexportApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
354
383
  }
355
384
  get beresultimportApi() {
356
385
  var _a;
357
- return ((_a = this._beresultimportApi) !== null && _a !== void 0 ? _a : (this._beresultimportApi = new icc_api_1.IccBeresultimportApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
386
+ return ((_a = this._beresultimportApi) !== null && _a !== void 0 ? _a : (this._beresultimportApi = new icc_api_1.IccBeresultimportApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
358
387
  }
359
388
  get besamv2Api() {
360
389
  var _a;
361
- return ((_a = this._besamv2Api) !== null && _a !== void 0 ? _a : (this._besamv2Api = new icc_api_1.IccBesamv2Api(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
390
+ return ((_a = this._besamv2Api) !== null && _a !== void 0 ? _a : (this._besamv2Api = new icc_api_1.IccBesamv2Api(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
362
391
  }
363
392
  get classificationTemplateApi() {
364
393
  var _a;
365
- return ((_a = this._classificationTemplateApi) !== null && _a !== void 0 ? _a : (this._classificationTemplateApi = new icc_api_1.IccClassificationTemplateApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
394
+ return ((_a = this._classificationTemplateApi) !== null && _a !== void 0 ? _a : (this._classificationTemplateApi = new icc_api_1.IccClassificationTemplateApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
366
395
  }
367
396
  get doctemplateApi() {
368
397
  var _a;
369
- return ((_a = this._doctemplateApi) !== null && _a !== void 0 ? _a : (this._doctemplateApi = new icc_doctemplate_x_api_1.IccDoctemplateXApi(this.host, this.params.headers, this.cryptoApi, this.groupSpecificAuthenticationProvider, this.fetch)));
398
+ return ((_a = this._doctemplateApi) !== null && _a !== void 0 ? _a : (this._doctemplateApi = new icc_doctemplate_x_api_1.IccDoctemplateXApi(this.host, this.cryptoInitInfos.headers, this.cryptoApi, this.groupSpecificAuthenticationProvider, this.fetch)));
370
399
  }
371
400
  get entitytemplateApi() {
372
401
  var _a;
373
- return ((_a = this._entitytemplateApi) !== null && _a !== void 0 ? _a : (this._entitytemplateApi = new icc_api_1.IccEntitytemplateApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
402
+ return ((_a = this._entitytemplateApi) !== null && _a !== void 0 ? _a : (this._entitytemplateApi = new icc_api_1.IccEntitytemplateApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
374
403
  }
375
404
  get frontendmigrationApi() {
376
405
  var _a;
377
- return ((_a = this._frontendmigrationApi) !== null && _a !== void 0 ? _a : (this._frontendmigrationApi = new icc_api_1.IccFrontendmigrationApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
406
+ return ((_a = this._frontendmigrationApi) !== null && _a !== void 0 ? _a : (this._frontendmigrationApi = new icc_api_1.IccFrontendmigrationApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
378
407
  }
379
408
  get icureApi() {
380
409
  var _a;
381
- return (_a = this._icureApi) !== null && _a !== void 0 ? _a : (this._icureApi = new icc_api_1.IccIcureApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
410
+ return ((_a = this._icureApi) !== null && _a !== void 0 ? _a : (this._icureApi = new icc_api_1.IccIcureApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
382
411
  }
383
412
  get keywordApi() {
384
413
  var _a;
385
- return ((_a = this._keywordApi) !== null && _a !== void 0 ? _a : (this._keywordApi = new icc_api_1.IccKeywordApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
414
+ return ((_a = this._keywordApi) !== null && _a !== void 0 ? _a : (this._keywordApi = new icc_api_1.IccKeywordApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
386
415
  }
387
416
  get medexApi() {
388
417
  var _a;
389
- return (_a = this._medexApi) !== null && _a !== void 0 ? _a : (this._medexApi = new icc_api_1.IccMedexApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
418
+ return ((_a = this._medexApi) !== null && _a !== void 0 ? _a : (this._medexApi = new icc_api_1.IccMedexApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
390
419
  }
391
420
  get placeApi() {
392
421
  var _a;
393
- return (_a = this._placeApi) !== null && _a !== void 0 ? _a : (this._placeApi = new icc_api_1.IccPlaceApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
422
+ return ((_a = this._placeApi) !== null && _a !== void 0 ? _a : (this._placeApi = new icc_api_1.IccPlaceApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
394
423
  }
395
424
  get pubsubApi() {
396
425
  var _a;
397
- return ((_a = this._pubsubApi) !== null && _a !== void 0 ? _a : (this._pubsubApi = new icc_api_1.IccPubsubApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
426
+ return ((_a = this._pubsubApi) !== null && _a !== void 0 ? _a : (this._pubsubApi = new icc_api_1.IccPubsubApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
398
427
  }
399
428
  get replicationApi() {
400
429
  var _a;
401
- return ((_a = this._replicationApi) !== null && _a !== void 0 ? _a : (this._replicationApi = new icc_api_1.IccReplicationApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
430
+ return ((_a = this._replicationApi) !== null && _a !== void 0 ? _a : (this._replicationApi = new icc_api_1.IccReplicationApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
402
431
  }
403
432
  get tarificationApi() {
404
433
  var _a;
405
- return ((_a = this._tarificationApi) !== null && _a !== void 0 ? _a : (this._tarificationApi = new icc_api_1.IccTarificationApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
434
+ return ((_a = this._tarificationApi) !== null && _a !== void 0 ? _a : (this._tarificationApi = new icc_api_1.IccTarificationApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
406
435
  }
407
436
  get tmpApi() {
408
437
  var _a;
409
- return (_a = this._tmpApi) !== null && _a !== void 0 ? _a : (this._tmpApi = new icc_api_1.IccTmpApi(this.host, this.params.headers, this.groupSpecificAuthenticationProvider, this.fetch));
438
+ return ((_a = this._tmpApi) !== null && _a !== void 0 ? _a : (this._tmpApi = new icc_api_1.IccTmpApi(this.host, this.cryptoInitInfos.headers, this.groupSpecificAuthenticationProvider, this.fetch)));
410
439
  }
411
440
  get cryptoApi() {
412
- return this.cryptoInitApis.cryptoApi;
441
+ return this.cryptoInitInfos.cryptoApi;
413
442
  }
414
443
  get dataOwnerApi() {
415
- return this.cryptoInitApis.dataOwnerApi;
444
+ return this.cryptoInitInfos.dataOwnerApi;
416
445
  }
417
446
  get deviceApi() {
418
- return this.cryptoInitApis.deviceApi;
447
+ return this.cryptoInitInfos.deviceApi;
419
448
  }
420
449
  get healthcarePartyApi() {
421
- return this.cryptoInitApis.healthcarePartyApi;
450
+ return this.cryptoInitInfos.healthcarePartyApi;
422
451
  }
423
452
  get icureMaintenanceTaskApi() {
424
- return this.cryptoInitApis.icureMaintenanceTaskApi;
453
+ return this.cryptoInitInfos.icureMaintenanceTaskApi;
425
454
  }
426
455
  get maintenanceTaskApi() {
427
- return this.cryptoInitApis.maintenanceTaskApi;
456
+ return this.cryptoInitInfos.maintenanceTaskApi;
428
457
  }
429
458
  get userApi() {
430
- return this.cryptoInitApis.userApi;
459
+ return this.cryptoInitInfos.userApi;
431
460
  }
432
461
  getGroupsInfo() {
433
462
  return __awaiter(this, void 0, void 0, function* () {
@@ -439,8 +468,8 @@ class IcureApiImpl {
439
468
  return __awaiter(this, void 0, void 0, function* () {
440
469
  const availableGroups = yield this.latestGroupsRequest;
441
470
  const switchedProvider = yield this.groupSpecificAuthenticationProvider.switchGroup(newGroupId, availableGroups);
442
- const cryptoInitApis = yield initialiseCryptoWithProvider(this.host, this.fetch, switchedProvider, this.params, this.cryptoStrategies, this.cryptoApi.primitives.crypto);
443
- return new IcureApiImpl(cryptoInitApis, this.host, switchedProvider, this.fetch, this.grouplessUserApi, availableGroups, availableGroups.find((x) => x.groupId === newGroupId), this.params, this.cryptoStrategies);
471
+ const cryptoInitInfos = yield initialiseCryptoWithProvider(this.host, this.fetch, switchedProvider, this.params, this.cryptoStrategies, this.cryptoApi.primitives.crypto);
472
+ return new IcureApiImpl(cryptoInitInfos, this.host, switchedProvider, this.fetch, this.grouplessUserApi, availableGroups, availableGroups.find((x) => x.groupId === newGroupId), this.params, this.cryptoStrategies);
444
473
  });
445
474
  }
446
475
  }