@icure/api 7.0.0-beta.3 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/icc-api/api/IccAccesslogApi.js +2 -1
  2. package/icc-api/api/IccAccesslogApi.js.map +1 -1
  3. package/icc-api/api/IccAgendaApi.js +2 -1
  4. package/icc-api/api/IccAgendaApi.js.map +1 -1
  5. package/icc-api/api/IccAnonymousAccessApi.js +2 -1
  6. package/icc-api/api/IccAnonymousAccessApi.js.map +1 -1
  7. package/icc-api/api/IccApplicationsettingsApi.js +2 -1
  8. package/icc-api/api/IccApplicationsettingsApi.js.map +1 -1
  9. package/icc-api/api/IccArticleApi.js +2 -1
  10. package/icc-api/api/IccArticleApi.js.map +1 -1
  11. package/icc-api/api/IccAuthApi.d.ts +23 -0
  12. package/icc-api/api/IccAuthApi.js +59 -2
  13. package/icc-api/api/IccAuthApi.js.map +1 -1
  14. package/icc-api/api/IccBeefactApi.js +2 -1
  15. package/icc-api/api/IccBeefactApi.js.map +1 -1
  16. package/icc-api/api/IccBekmehrApi.js +2 -1
  17. package/icc-api/api/IccBekmehrApi.js.map +1 -1
  18. package/icc-api/api/IccBeresultexportApi.js +2 -1
  19. package/icc-api/api/IccBeresultexportApi.js.map +1 -1
  20. package/icc-api/api/IccBeresultimportApi.js +2 -1
  21. package/icc-api/api/IccBeresultimportApi.js.map +1 -1
  22. package/icc-api/api/IccBesamv2Api.d.ts +6 -0
  23. package/icc-api/api/IccBesamv2Api.js +15 -1
  24. package/icc-api/api/IccBesamv2Api.js.map +1 -1
  25. package/icc-api/api/IccCalendarItemApi.js +2 -1
  26. package/icc-api/api/IccCalendarItemApi.js.map +1 -1
  27. package/icc-api/api/IccCalendarItemTypeApi.js +2 -1
  28. package/icc-api/api/IccCalendarItemTypeApi.js.map +1 -1
  29. package/icc-api/api/IccClassificationApi.js +2 -1
  30. package/icc-api/api/IccClassificationApi.js.map +1 -1
  31. package/icc-api/api/IccClassificationTemplateApi.js +2 -1
  32. package/icc-api/api/IccClassificationTemplateApi.js.map +1 -1
  33. package/icc-api/api/IccCodeApi.js +2 -1
  34. package/icc-api/api/IccCodeApi.js.map +1 -1
  35. package/icc-api/api/IccContactApi.d.ts +6 -0
  36. package/icc-api/api/IccContactApi.js +26 -1
  37. package/icc-api/api/IccContactApi.js.map +1 -1
  38. package/icc-api/api/IccDataownerApi.js +2 -1
  39. package/icc-api/api/IccDataownerApi.js.map +1 -1
  40. package/icc-api/api/IccDeviceApi.js +2 -1
  41. package/icc-api/api/IccDeviceApi.js.map +1 -1
  42. package/icc-api/api/IccDoctemplateApi.js +2 -1
  43. package/icc-api/api/IccDoctemplateApi.js.map +1 -1
  44. package/icc-api/api/IccDocumentApi.d.ts +6 -4
  45. package/icc-api/api/IccDocumentApi.js +10 -6
  46. package/icc-api/api/IccDocumentApi.js.map +1 -1
  47. package/icc-api/api/IccDocumentTemplateApi.js +2 -1
  48. package/icc-api/api/IccDocumentTemplateApi.js.map +1 -1
  49. package/icc-api/api/IccEntityrefApi.js +2 -1
  50. package/icc-api/api/IccEntityrefApi.js.map +1 -1
  51. package/icc-api/api/IccEntitytemplateApi.js +2 -1
  52. package/icc-api/api/IccEntitytemplateApi.js.map +1 -1
  53. package/icc-api/api/IccFormApi.js +2 -1
  54. package/icc-api/api/IccFormApi.js.map +1 -1
  55. package/icc-api/api/IccFrontendmigrationApi.js +2 -1
  56. package/icc-api/api/IccFrontendmigrationApi.js.map +1 -1
  57. package/icc-api/api/IccGroupApi.d.ts +6 -0
  58. package/icc-api/api/IccGroupApi.js +15 -1
  59. package/icc-api/api/IccGroupApi.js.map +1 -1
  60. package/icc-api/api/IccHcpartyApi.js +2 -1
  61. package/icc-api/api/IccHcpartyApi.js.map +1 -1
  62. package/icc-api/api/IccHelementApi.js +2 -1
  63. package/icc-api/api/IccHelementApi.js.map +1 -1
  64. package/icc-api/api/IccIcureApi.js +2 -1
  65. package/icc-api/api/IccIcureApi.js.map +1 -1
  66. package/icc-api/api/IccInsuranceApi.js +2 -1
  67. package/icc-api/api/IccInsuranceApi.js.map +1 -1
  68. package/icc-api/api/IccInvoiceApi.js +2 -1
  69. package/icc-api/api/IccInvoiceApi.js.map +1 -1
  70. package/icc-api/api/IccKeywordApi.js +2 -1
  71. package/icc-api/api/IccKeywordApi.js.map +1 -1
  72. package/icc-api/api/IccMaintenanceTaskApi.js +2 -1
  73. package/icc-api/api/IccMaintenanceTaskApi.js.map +1 -1
  74. package/icc-api/api/IccMedexApi.js +2 -1
  75. package/icc-api/api/IccMedexApi.js.map +1 -1
  76. package/icc-api/api/IccMedicallocationApi.js +2 -1
  77. package/icc-api/api/IccMedicallocationApi.js.map +1 -1
  78. package/icc-api/api/IccMessageApi.js +2 -1
  79. package/icc-api/api/IccMessageApi.js.map +1 -1
  80. package/icc-api/api/IccPatientApi.js +2 -1
  81. package/icc-api/api/IccPatientApi.js.map +1 -1
  82. package/icc-api/api/IccPermissionApi.js +2 -1
  83. package/icc-api/api/IccPermissionApi.js.map +1 -1
  84. package/icc-api/api/IccPlaceApi.js +2 -1
  85. package/icc-api/api/IccPlaceApi.js.map +1 -1
  86. package/icc-api/api/IccPubsubApi.js +2 -1
  87. package/icc-api/api/IccPubsubApi.js.map +1 -1
  88. package/icc-api/api/IccReceiptApi.js +2 -1
  89. package/icc-api/api/IccReceiptApi.js.map +1 -1
  90. package/icc-api/api/IccReplicationApi.js +2 -1
  91. package/icc-api/api/IccReplicationApi.js.map +1 -1
  92. package/icc-api/api/IccRestApiPath.d.ts +1 -0
  93. package/icc-api/api/IccRestApiPath.js +10 -0
  94. package/icc-api/api/IccRestApiPath.js.map +1 -0
  95. package/icc-api/api/IccTarificationApi.js +2 -1
  96. package/icc-api/api/IccTarificationApi.js.map +1 -1
  97. package/icc-api/api/IccTimeTableApi.js +2 -1
  98. package/icc-api/api/IccTimeTableApi.js.map +1 -1
  99. package/icc-api/api/IccTmpApi.js +2 -1
  100. package/icc-api/api/IccTmpApi.js.map +1 -1
  101. package/icc-api/api/IccUserApi.js +2 -1
  102. package/icc-api/api/IccUserApi.js.map +1 -1
  103. package/icc-api/index.d.ts +0 -1
  104. package/icc-api/index.js +0 -1
  105. package/icc-api/index.js.map +1 -1
  106. package/icc-api/model/Address.d.ts +6 -0
  107. package/icc-api/model/Address.js.map +1 -1
  108. package/icc-api/model/Annotation.d.ts +18 -0
  109. package/icc-api/model/Annotation.js.map +1 -1
  110. package/icc-api/model/AuthenticationToken.d.ts +1 -0
  111. package/icc-api/model/AuthenticationToken.js.map +1 -1
  112. package/icc-api/model/Content.js +1 -1
  113. package/icc-api/model/Content.js.map +1 -1
  114. package/icc-api/model/CryptoActorStub.d.ts +5 -0
  115. package/icc-api/model/CryptoActorStub.js +1 -0
  116. package/icc-api/model/CryptoActorStub.js.map +1 -1
  117. package/icc-api/model/Delegation.d.ts +3 -0
  118. package/icc-api/model/Delegation.js.map +1 -1
  119. package/icc-api/model/FlatRateTarification.d.ts +4 -1
  120. package/icc-api/model/FlatRateTarification.js +3 -0
  121. package/icc-api/model/FlatRateTarification.js.map +1 -1
  122. package/icc-api/model/HealthElement.d.ts +6 -0
  123. package/icc-api/model/HealthElement.js.map +1 -1
  124. package/icc-api/model/HealthcareParty.js +1 -1
  125. package/icc-api/model/HealthcareParty.js.map +1 -1
  126. package/icc-api/model/ISO639_1.d.ts +8 -0
  127. package/icc-api/model/ISO639_1.js +3 -0
  128. package/icc-api/model/ISO639_1.js.map +1 -0
  129. package/icc-api/model/Patient.d.ts +7 -0
  130. package/icc-api/model/Patient.js +1 -1
  131. package/icc-api/model/Patient.js.map +1 -1
  132. package/icc-api/model/UserGroup.d.ts +1 -0
  133. package/icc-api/model/UserGroup.js.map +1 -1
  134. package/icc-api/model/models.d.ts +1 -0
  135. package/icc-api/model/models.js.map +1 -1
  136. package/icc-x-api/auth/AuthenticationProvider.d.ts +67 -6
  137. package/icc-x-api/auth/AuthenticationProvider.js +100 -7
  138. package/icc-x-api/auth/AuthenticationProvider.js.map +1 -1
  139. package/icc-x-api/auth/EnsembleAuthService.d.ts +7 -2
  140. package/icc-x-api/auth/EnsembleAuthService.js +9 -0
  141. package/icc-x-api/auth/EnsembleAuthService.js.map +1 -1
  142. package/icc-x-api/auth/JwtAuthService.d.ts +10 -5
  143. package/icc-x-api/auth/JwtAuthService.js +22 -26
  144. package/icc-x-api/auth/JwtAuthService.js.map +1 -1
  145. package/icc-x-api/auth/JwtBridgedAuthService.d.ts +27 -0
  146. package/icc-x-api/auth/JwtBridgedAuthService.js +131 -0
  147. package/icc-x-api/auth/JwtBridgedAuthService.js.map +1 -0
  148. package/icc-x-api/crypto/EntitiesEncryption.d.ts +5 -4
  149. package/icc-x-api/crypto/EntitiesEncryption.js +20 -16
  150. package/icc-x-api/crypto/EntitiesEncryption.js.map +1 -1
  151. package/icc-x-api/filters/ServiceByHcPartyTagCodeDateFilter.d.ts +1 -0
  152. package/icc-x-api/filters/ServiceByHcPartyTagCodeDateFilter.js.map +1 -1
  153. package/icc-x-api/filters/filters.d.ts +4 -0
  154. package/icc-x-api/filters/filters.js +4 -0
  155. package/icc-x-api/filters/filters.js.map +1 -1
  156. package/icc-x-api/icc-accesslog-x-api.d.ts +2 -2
  157. package/icc-x-api/icc-accesslog-x-api.js +17 -24
  158. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  159. package/icc-x-api/icc-calendar-item-x-api.d.ts +1 -1
  160. package/icc-x-api/icc-calendar-item-x-api.js +18 -22
  161. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  162. package/icc-x-api/icc-classification-x-api.js +13 -19
  163. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  164. package/icc-x-api/icc-contact-x-api.d.ts +17 -1
  165. package/icc-x-api/icc-contact-x-api.js +81 -99
  166. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  167. package/icc-x-api/icc-data-owner-x-api.d.ts +1 -1
  168. package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
  169. package/icc-x-api/icc-doctemplate-x-api.js +2 -13
  170. package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
  171. package/icc-x-api/icc-document-x-api.d.ts +12 -4
  172. package/icc-x-api/icc-document-x-api.js +29 -25
  173. package/icc-x-api/icc-document-x-api.js.map +1 -1
  174. package/icc-x-api/icc-form-x-api.js +13 -17
  175. package/icc-x-api/icc-form-x-api.js.map +1 -1
  176. package/icc-x-api/icc-helement-x-api.d.ts +1 -1
  177. package/icc-x-api/icc-helement-x-api.js +15 -20
  178. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  179. package/icc-x-api/icc-icure-maintenance-x-api.js +4 -4
  180. package/icc-x-api/icc-icure-maintenance-x-api.js.map +1 -1
  181. package/icc-x-api/icc-invoice-x-api.js +13 -19
  182. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  183. package/icc-x-api/icc-maintenance-task-x-api.d.ts +1 -1
  184. package/icc-x-api/icc-maintenance-task-x-api.js +13 -14
  185. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  186. package/icc-x-api/icc-message-x-api.js +13 -18
  187. package/icc-x-api/icc-message-x-api.js.map +1 -1
  188. package/icc-x-api/icc-patient-x-api.d.ts +5 -2
  189. package/icc-x-api/icc-patient-x-api.js +17 -24
  190. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  191. package/icc-x-api/icc-receipt-x-api.js +11 -16
  192. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  193. package/icc-x-api/icc-time-table-x-api.js +11 -16
  194. package/icc-x-api/icc-time-table-x-api.js.map +1 -1
  195. package/icc-x-api/index.d.ts +284 -35
  196. package/icc-x-api/index.js +303 -79
  197. package/icc-x-api/index.js.map +1 -1
  198. package/icc-x-api/maintenance/KeyPairUpdateRequest.d.ts +12 -9
  199. package/icc-x-api/maintenance/KeyPairUpdateRequest.js +11 -17
  200. package/icc-x-api/maintenance/KeyPairUpdateRequest.js.map +1 -1
  201. package/icc-x-api/utils/crypto-utils.d.ts +140 -11
  202. package/icc-x-api/utils/crypto-utils.js +285 -36
  203. package/icc-x-api/utils/crypto-utils.js.map +1 -1
  204. package/package.json +1 -1
  205. package/icc-api/api/IccBemikronoApi.d.ts +0 -81
  206. package/icc-api/api/IccBemikronoApi.js +0 -162
  207. package/icc-api/api/IccBemikronoApi.js.map +0 -1
@@ -23,7 +23,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
23
23
  });
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.BasicApis = exports.Api = exports.KeyStorageImpl = exports.LocalStorageImpl = void 0;
26
+ exports.BasicApis = exports.IcureApi = exports.EncryptedFieldsConfig = exports.KeyStorageImpl = exports.LocalStorageImpl = void 0;
27
27
  const icc_api_1 = require("../icc-api");
28
28
  const icc_user_x_api_1 = require("./icc-user-x-api");
29
29
  const icc_crypto_x_api_1 = require("./icc-crypto-x-api");
@@ -40,7 +40,7 @@ const icc_message_x_api_1 = require("./icc-message-x-api");
40
40
  const icc_receipt_x_api_1 = require("./icc-receipt-x-api");
41
41
  const icc_accesslog_x_api_1 = require("./icc-accesslog-x-api");
42
42
  const icc_time_table_x_api_1 = require("./icc-time-table-x-api");
43
- const IccDeviceApi_1 = require("../icc-api/api/IccDeviceApi");
43
+ const icc_api_2 = require("../icc-api");
44
44
  const icc_code_x_api_1 = require("./icc-code-x-api");
45
45
  const icc_maintenance_task_x_api_1 = require("./icc-maintenance-task-x-api");
46
46
  const icc_data_owner_x_api_1 = require("./icc-data-owner-x-api");
@@ -61,6 +61,8 @@ const EntitiesEncryption_1 = require("./crypto/EntitiesEncryption");
61
61
  const ConfidentialEntities_1 = require("./crypto/ConfidentialEntities");
62
62
  const utils_1 = require("./crypto/utils");
63
63
  const CryptoActorStub_1 = require("../icc-api/model/CryptoActorStub");
64
+ const icc_bekmehr_x_api_1 = require("./icc-bekmehr-x-api");
65
+ const icc_doctemplate_x_api_1 = require("./icc-doctemplate-x-api");
64
66
  __exportStar(require("./icc-accesslog-x-api"), exports);
65
67
  __exportStar(require("./icc-bekmehr-x-api"), exports);
66
68
  __exportStar(require("./icc-calendar-item-x-api"), exports);
@@ -84,42 +86,83 @@ var LocalStorageImpl_2 = require("./storage/LocalStorageImpl");
84
86
  Object.defineProperty(exports, "LocalStorageImpl", { enumerable: true, get: function () { return LocalStorageImpl_2.LocalStorageImpl; } });
85
87
  var KeyStorageImpl_2 = require("./storage/KeyStorageImpl");
86
88
  Object.defineProperty(exports, "KeyStorageImpl", { enumerable: true, get: function () { return KeyStorageImpl_2.KeyStorageImpl; } });
87
- class NamedApiParametersWithDefault {
88
- constructor(custom) {
89
- var _a, _b, _c, _d, _e;
90
- this.entryKeysFactory = (_a = custom.entryKeysFactory) !== null && _a !== void 0 ? _a : new DefaultStorageEntryKeysFactory_1.DefaultStorageEntryKeysFactory();
91
- this.createMaintenanceTasksOnNewKey = (_b = custom.createMaintenanceTasksOnNewKey) !== null && _b !== void 0 ? _b : false;
92
- this.storage = (_c = custom.storage) !== null && _c !== void 0 ? _c : new LocalStorageImpl_1.LocalStorageImpl();
93
- this.keyStorage = (_d = custom.keyStorage) !== null && _d !== void 0 ? _d : new KeyStorageImpl_1.KeyStorageImpl(this.storage);
94
- this.headers = (_e = custom.headers) !== null && _e !== void 0 ? _e : {};
89
+ var IcureApiOptions;
90
+ (function (IcureApiOptions) {
91
+ let Defaults;
92
+ (function (Defaults) {
93
+ Defaults.entryKeysFactory = new DefaultStorageEntryKeysFactory_1.DefaultStorageEntryKeysFactory();
94
+ Defaults.createMaintenanceTasksOnNewKey = true;
95
+ Defaults.headers = {};
96
+ })(Defaults = IcureApiOptions.Defaults || (IcureApiOptions.Defaults = {}));
97
+ class WithDefaults {
98
+ constructor(custom) {
99
+ var _a, _b, _c, _d, _e, _f, _g;
100
+ this.entryKeysFactory = (_a = custom.entryKeysFactory) !== null && _a !== void 0 ? _a : Defaults.entryKeysFactory;
101
+ this.createMaintenanceTasksOnNewKey = (_b = custom.createMaintenanceTasksOnNewKey) !== null && _b !== void 0 ? _b : Defaults.createMaintenanceTasksOnNewKey;
102
+ this.storage = (_c = custom.storage) !== null && _c !== void 0 ? _c : new LocalStorageImpl_1.LocalStorageImpl();
103
+ this.keyStorage = (_d = custom.keyStorage) !== null && _d !== void 0 ? _d : new KeyStorageImpl_1.KeyStorageImpl(this.storage);
104
+ this.headers = (_e = custom.headers) !== null && _e !== void 0 ? _e : Defaults.headers;
105
+ this.encryptedFieldsConfig = (_f = custom.encryptedFieldsConfig) !== null && _f !== void 0 ? _f : EncryptedFieldsConfig.Defaults;
106
+ this.groupSelector = (_g = custom.groupSelector) !== null && _g !== void 0 ? _g : ((groups) => Promise.resolve(groups[0].groupId));
107
+ }
95
108
  }
96
- }
97
- const Api = function (host, authenticationOptions, cryptoStrategies, crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : {}, fetchImpl = typeof window !== 'undefined'
98
- ? window.fetch
99
- : typeof self !== 'undefined'
100
- ? self.fetch
101
- : fetch, options = {}) {
109
+ IcureApiOptions.WithDefaults = WithDefaults;
110
+ })(IcureApiOptions || (IcureApiOptions = {}));
111
+ var EncryptedFieldsConfig;
112
+ (function (EncryptedFieldsConfig) {
113
+ EncryptedFieldsConfig.Defaults = {
114
+ accessLog: ['detail', 'objectId'],
115
+ calendarItem: ['details', 'title', 'patientId'],
116
+ contact: ['descr'],
117
+ service: ['notes[].markdown'],
118
+ healthElement: ['descr', 'note', 'notes[].markdown'],
119
+ maintenanceTask: ['properties'],
120
+ patient: ['note', 'notes[].markdown'],
121
+ };
122
+ })(EncryptedFieldsConfig = exports.EncryptedFieldsConfig || (exports.EncryptedFieldsConfig = {}));
123
+ var IcureApi;
124
+ (function (IcureApi) {
125
+ /**
126
+ * Initialises a new instance of the iCure API.
127
+ */
128
+ function initialise(host, authenticationOptions, cryptoStrategies, crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : {}, fetchImpl = typeof window !== 'undefined'
129
+ ? window.fetch
130
+ : typeof self !== 'undefined'
131
+ ? self.fetch
132
+ : fetch, options = {}) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ const params = new IcureApiOptions.WithDefaults(options);
135
+ let grouplessAuthenticationProvider;
136
+ if ('username' in authenticationOptions && 'password' in authenticationOptions) {
137
+ grouplessAuthenticationProvider = new AuthenticationProvider_1.EnsembleAuthenticationProvider(new icc_api_1.IccAuthApi(host, params.headers, new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl), authenticationOptions.username, authenticationOptions.password, 3600, undefined, undefined, authenticationOptions.thirdPartyTokens);
138
+ }
139
+ else if ('icureTokens' in authenticationOptions) {
140
+ grouplessAuthenticationProvider = new AuthenticationProvider_1.JwtAuthenticationProvider(new icc_api_1.IccAuthApi(host, {}, new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl), undefined, undefined, undefined, authenticationOptions.icureTokens);
141
+ }
142
+ else {
143
+ grouplessAuthenticationProvider = authenticationOptions;
144
+ }
145
+ const grouplessUserApi = new icc_user_x_api_1.IccUserXApi(host, params.headers, grouplessAuthenticationProvider, fetchImpl);
146
+ const matches = yield grouplessUserApi.getMatchingUsers();
147
+ const chosenGroupId = matches.length > 1 ? yield params.groupSelector(matches) : matches[0].groupId;
148
+ /*TODO
149
+ * On new very new users switching the authentication provider to a specific group may fail and block the user for too many requests. This is
150
+ * probably linked to replication of the user in the fallback database.
151
+ */
152
+ const groupSpecificAuthenticationProvider = matches.length > 1 ? yield grouplessAuthenticationProvider.switchGroup(chosenGroupId, matches) : grouplessAuthenticationProvider;
153
+ const cryptoApis = yield initialiseCryptoWithProvider(host, fetchImpl, groupSpecificAuthenticationProvider, params, cryptoStrategies, crypto);
154
+ return new IcureApiImpl(cryptoApis, host, groupSpecificAuthenticationProvider, fetch, grouplessUserApi, matches, matches.find((match) => match.groupId === chosenGroupId), params, cryptoStrategies);
155
+ });
156
+ }
157
+ IcureApi.initialise = initialise;
158
+ })(IcureApi = exports.IcureApi || (exports.IcureApi = {}));
159
+ function initialiseCryptoWithProvider(host, fetchImpl, groupSpecificAuthenticationProvider, params, cryptoStrategies, crypto) {
160
+ var _a, _b;
102
161
  return __awaiter(this, void 0, void 0, function* () {
103
- const params = new NamedApiParametersWithDefault(options);
104
- let authenticationProvider;
105
- if ('username' in authenticationOptions && 'password' in authenticationOptions) {
106
- authenticationProvider = authenticationOptions.forceBasic
107
- ? new AuthenticationProvider_1.BasicAuthenticationProvider(authenticationOptions.username, authenticationOptions.password)
108
- : new AuthenticationProvider_1.EnsembleAuthenticationProvider(new icc_api_1.IccAuthApi(host, params.headers, new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl), authenticationOptions.username, authenticationOptions.password);
109
- }
110
- else {
111
- authenticationProvider = authenticationOptions;
112
- }
113
- // Here I instantiate a separate instance of the AuthApi that can call also login-protected methods (logout)
114
- const authApi = new icc_api_1.IccAuthApi(host, params.headers, authenticationProvider, fetchImpl);
115
- const codeApi = new icc_code_x_api_1.IccCodeXApi(host, params.headers, authenticationProvider, fetchImpl);
116
- const entityReferenceApi = new icc_api_1.IccEntityrefApi(host, params.headers, authenticationProvider, fetchImpl);
117
- const userApi = new icc_user_x_api_1.IccUserXApi(host, params.headers, authenticationProvider, fetchImpl);
118
- const permissionApi = new icc_api_1.IccPermissionApi(host, params.headers, authenticationProvider, fetchImpl);
119
- const healthcarePartyApi = new icc_hcparty_x_api_1.IccHcpartyXApi(host, params.headers, authenticationProvider, fetchImpl);
120
- const deviceApi = new IccDeviceApi_1.IccDeviceApi(host, params.headers, authenticationProvider, fetchImpl);
121
- const basePatientApi = new icc_api_1.IccPatientApi(host, params.headers, authenticationProvider, fetchImpl);
122
- const dataOwnerApi = new icc_data_owner_x_api_1.IccDataOwnerXApi(host, params.headers, authenticationProvider, fetchImpl);
162
+ const healthcarePartyApi = new icc_hcparty_x_api_1.IccHcpartyXApi(host, params.headers, groupSpecificAuthenticationProvider, fetchImpl);
163
+ const deviceApi = new icc_api_2.IccDeviceApi(host, params.headers, groupSpecificAuthenticationProvider, fetchImpl);
164
+ const basePatientApi = new icc_api_1.IccPatientApi(host, params.headers, groupSpecificAuthenticationProvider, fetchImpl);
165
+ const dataOwnerApi = new icc_data_owner_x_api_1.IccDataOwnerXApi(host, params.headers, groupSpecificAuthenticationProvider, fetchImpl);
123
166
  // Crypto initialisation
124
167
  const icureStorage = new IcureStorageFacade_1.IcureStorageFacade(params.keyStorage, params.storage, params.entryKeysFactory);
125
168
  const cryptoPrimitives = new CryptoPrimitives_1.CryptoPrimitives(crypto);
@@ -135,61 +178,240 @@ const Api = function (host, authenticationOptions, cryptoStrategies, crypto = ty
135
178
  const confidentialEntitites = new ConfidentialEntities_1.ConfidentialEntities(entitiesEncryption, cryptoPrimitives, dataOwnerApi);
136
179
  yield (0, utils_1.ensureDelegationForSelf)(dataOwnerApi, entitiesEncryption, cryptoPrimitives, basePatientApi);
137
180
  const cryptoApi = new icc_crypto_x_api_1.IccCryptoXApi(exchangeKeysManager, cryptoPrimitives, keyManager, dataOwnerApi, entitiesEncryption, shamirManager, params.storage, params.keyStorage, icureStorage, healthcarePartyApi, confidentialEntitites);
138
- const accessLogApi = new icc_accesslog_x_api_1.IccAccesslogXApi(host, params.headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl);
139
- const agendaApi = new icc_api_1.IccAgendaApi(host, params.headers, authenticationProvider, fetchImpl);
140
- const contactApi = new icc_contact_x_api_1.IccContactXApi(host, params.headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl);
141
- const formApi = new icc_form_x_api_1.IccFormXApi(host, params.headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl);
142
- const groupApi = new icc_api_1.IccGroupApi(host, params.headers, authenticationProvider);
143
- const medicalLocationApi = new icc_api_1.IccMedicallocationApi(host, params.headers, authenticationProvider);
144
- const calendarItemTypeApi = new icc_api_1.IccCalendarItemTypeApi(host, params.headers, authenticationProvider);
145
- const invoiceApi = new icc_invoice_x_api_1.IccInvoiceXApi(host, params.headers, cryptoApi, entityReferenceApi, dataOwnerApi, authenticationProvider, fetchImpl);
146
- const insuranceApi = new icc_api_1.IccInsuranceApi(host, params.headers, authenticationProvider, fetchImpl);
147
- const documentApi = new icc_document_x_api_1.IccDocumentXApi(host, params.headers, cryptoApi, authApi, dataOwnerApi, authenticationProvider, fetchImpl);
148
- const healthcareElementApi = new icc_helement_x_api_1.IccHelementXApi(host, params.headers, cryptoApi, dataOwnerApi, ['descr', 'note'], authenticationProvider, fetchImpl);
149
- const classificationApi = new icc_classification_x_api_1.IccClassificationXApi(host, params.headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl);
150
- const calendarItemApi = new icc_calendar_item_x_api_1.IccCalendarItemXApi(host, params.headers, cryptoApi, dataOwnerApi, ['details', 'title', 'patientId'], authenticationProvider, fetchImpl);
151
- const receiptApi = new icc_receipt_x_api_1.IccReceiptXApi(host, params.headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl);
152
- const timetableApi = new icc_time_table_x_api_1.IccTimeTableXApi(host, params.headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl);
153
- const patientApi = new icc_patient_x_api_1.IccPatientXApi(host, params.headers, cryptoApi, contactApi, formApi, healthcareElementApi, invoiceApi, documentApi, healthcarePartyApi, classificationApi, dataOwnerApi, calendarItemApi, ['note'], authenticationProvider, fetchImpl);
154
- const messageApi = new icc_message_x_api_1.IccMessageXApi(host, params.headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl);
155
- const maintenanceTaskApi = new icc_maintenance_task_x_api_1.IccMaintenanceTaskXApi(host, params.headers, cryptoApi, healthcarePartyApi, dataOwnerApi, ['properties'], authenticationProvider, fetchImpl);
181
+ const maintenanceTaskApi = new icc_maintenance_task_x_api_1.IccMaintenanceTaskXApi(host, params.headers, cryptoApi, healthcarePartyApi, dataOwnerApi, (_b = (_a = params.encryptedFieldsConfig) === null || _a === void 0 ? void 0 : _a.maintenanceTask) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.maintenanceTask, groupSpecificAuthenticationProvider, fetchImpl);
156
182
  const icureMaintenanceTaskApi = new icc_icure_maintenance_x_api_1.IccIcureMaintenanceXApi(cryptoApi, maintenanceTaskApi, dataOwnerApi);
183
+ const userApi = new icc_user_x_api_1.IccUserXApi(host, params.headers, groupSpecificAuthenticationProvider, fetchImpl);
157
184
  if (newKey && params.createMaintenanceTasksOnNewKey) {
158
185
  yield icureMaintenanceTaskApi.createMaintenanceTasksForNewKeypair(yield userApi.getCurrentUser(), newKey.newKeyPair);
159
186
  }
160
187
  return {
161
188
  cryptoApi,
162
- authApi,
163
- codeApi,
164
- calendarItemTypeApi,
165
- medicalLocationApi,
166
- userApi,
167
- permissionApi,
168
- patientApi,
169
189
  healthcarePartyApi,
170
190
  deviceApi,
171
- accessLogApi,
172
- contactApi,
173
- healthcareElementApi,
174
- documentApi,
175
- formApi,
176
- invoiceApi,
177
- insuranceApi,
178
- messageApi,
179
- entityReferenceApi,
180
- receiptApi,
181
- agendaApi,
182
- calendarItemApi,
183
- classificationApi,
184
- timetableApi,
185
- groupApi,
186
- maintenanceTaskApi,
187
191
  dataOwnerApi,
192
+ userApi,
188
193
  icureMaintenanceTaskApi,
194
+ maintenanceTaskApi,
189
195
  };
190
196
  });
191
- };
192
- exports.Api = Api;
197
+ }
198
+ class IcureApiImpl {
199
+ get cryptoApi() {
200
+ return this.cryptoInitApis.cryptoApi;
201
+ }
202
+ get dataOwnerApi() {
203
+ return this.cryptoInitApis.dataOwnerApi;
204
+ }
205
+ get accessLogApi() {
206
+ var _a, _b;
207
+ 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)));
208
+ }
209
+ get agendaApi() {
210
+ var _a;
211
+ 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)));
212
+ }
213
+ get anonymousAccessApi() {
214
+ var _a;
215
+ 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)));
216
+ }
217
+ get applicationSettingsApi() {
218
+ var _a;
219
+ 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)));
220
+ }
221
+ get articleApi() {
222
+ var _a;
223
+ 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)));
224
+ }
225
+ get authApi() {
226
+ var _a;
227
+ 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));
228
+ }
229
+ get beefactApi() {
230
+ var _a;
231
+ 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)));
232
+ }
233
+ get bekmehrApi() {
234
+ var _a;
235
+ 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)));
236
+ }
237
+ get beresultexportApi() {
238
+ var _a;
239
+ 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)));
240
+ }
241
+ get beresultimportApi() {
242
+ var _a;
243
+ 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)));
244
+ }
245
+ get besamv2Api() {
246
+ var _a;
247
+ 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)));
248
+ }
249
+ get calendarItemApi() {
250
+ var _a, _b;
251
+ 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)));
252
+ }
253
+ get calendarItemTypeApi() {
254
+ var _a;
255
+ 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)));
256
+ }
257
+ get classificationApi() {
258
+ var _a;
259
+ 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)));
260
+ }
261
+ get classificationTemplateApi() {
262
+ var _a;
263
+ 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)));
264
+ }
265
+ get codeApi() {
266
+ var _a;
267
+ 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));
268
+ }
269
+ get contactApi() {
270
+ var _a, _b, _c;
271
+ 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.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)));
272
+ }
273
+ get deviceApi() {
274
+ return this.cryptoInitApis.deviceApi;
275
+ }
276
+ get doctemplateApi() {
277
+ var _a;
278
+ 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)));
279
+ }
280
+ get documentApi() {
281
+ var _a;
282
+ 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)));
283
+ }
284
+ get entityReferenceApi() {
285
+ var _a;
286
+ 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)));
287
+ }
288
+ get entitytemplateApi() {
289
+ var _a;
290
+ 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)));
291
+ }
292
+ get formApi() {
293
+ var _a;
294
+ 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)));
295
+ }
296
+ get frontendmigrationApi() {
297
+ var _a;
298
+ 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)));
299
+ }
300
+ get groupApi() {
301
+ var _a;
302
+ 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));
303
+ }
304
+ get healthcareElementApi() {
305
+ var _a, _b;
306
+ 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, (_b = this.params.encryptedFieldsConfig.healthElement) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.healthElement, this.groupSpecificAuthenticationProvider, this.fetch)));
307
+ }
308
+ get healthcarePartyApi() {
309
+ return this.cryptoInitApis.healthcarePartyApi;
310
+ }
311
+ get icureApi() {
312
+ var _a;
313
+ 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));
314
+ }
315
+ get icureMaintenanceTaskApi() {
316
+ return this.cryptoInitApis.icureMaintenanceTaskApi;
317
+ }
318
+ get insuranceApi() {
319
+ var _a;
320
+ 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)));
321
+ }
322
+ get invoiceApi() {
323
+ var _a;
324
+ 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)));
325
+ }
326
+ get keywordApi() {
327
+ var _a;
328
+ 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)));
329
+ }
330
+ get maintenanceTaskApi() {
331
+ return this.cryptoInitApis.maintenanceTaskApi;
332
+ }
333
+ get medexApi() {
334
+ var _a;
335
+ 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));
336
+ }
337
+ get medicalLocationApi() {
338
+ var _a;
339
+ 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)));
340
+ }
341
+ get messageApi() {
342
+ var _a;
343
+ 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)));
344
+ }
345
+ get patientApi() {
346
+ var _a, _b;
347
+ 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, (_b = this.params.encryptedFieldsConfig.patient) !== null && _b !== void 0 ? _b : EncryptedFieldsConfig.Defaults.patient, this.groupSpecificAuthenticationProvider, this.fetch)));
348
+ }
349
+ get permissionApi() {
350
+ var _a;
351
+ 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)));
352
+ }
353
+ get placeApi() {
354
+ var _a;
355
+ 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));
356
+ }
357
+ get pubsubApi() {
358
+ var _a;
359
+ 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)));
360
+ }
361
+ get receiptApi() {
362
+ var _a;
363
+ 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)));
364
+ }
365
+ get replicationApi() {
366
+ var _a;
367
+ 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)));
368
+ }
369
+ get tarificationApi() {
370
+ var _a;
371
+ 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)));
372
+ }
373
+ get timetableApi() {
374
+ var _a;
375
+ 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)));
376
+ }
377
+ get tmpApi() {
378
+ var _a;
379
+ 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));
380
+ }
381
+ get userApi() {
382
+ return this.cryptoInitApis.userApi;
383
+ }
384
+ constructor(cryptoInitApis, host, groupSpecificAuthenticationProvider, fetch, grouplessUserApi, latestMatches, currentGroupInfo, params, cryptoStrategies) {
385
+ this.cryptoInitApis = cryptoInitApis;
386
+ this.host = host;
387
+ this.groupSpecificAuthenticationProvider = groupSpecificAuthenticationProvider;
388
+ this.fetch = fetch;
389
+ this.grouplessUserApi = grouplessUserApi;
390
+ this.latestMatches = latestMatches;
391
+ this.currentGroupInfo = currentGroupInfo;
392
+ this.params = params;
393
+ this.cryptoStrategies = cryptoStrategies;
394
+ this.latestGroupsRequest = Promise.resolve(latestMatches);
395
+ }
396
+ getGroupsInfo() {
397
+ return __awaiter(this, void 0, void 0, function* () {
398
+ this.latestGroupsRequest = this.grouplessUserApi.getMatchingUsers();
399
+ return { currentGroup: this.currentGroupInfo, availableGroups: yield this.latestGroupsRequest };
400
+ });
401
+ }
402
+ switchGroup(newGroupId) {
403
+ return __awaiter(this, void 0, void 0, function* () {
404
+ const availableGroups = yield this.latestGroupsRequest;
405
+ const switchedProvider = yield this.groupSpecificAuthenticationProvider.switchGroup(newGroupId, availableGroups);
406
+ const cryptoInitApis = yield initialiseCryptoWithProvider(this.host, this.fetch, switchedProvider, this.params, this.cryptoStrategies, this.cryptoApi.primitives.crypto);
407
+ return new IcureApiImpl(cryptoInitApis, this.host, switchedProvider, this.fetch, this.grouplessUserApi, availableGroups, availableGroups.find((x) => x.groupId === newGroupId), this.params, this.cryptoStrategies);
408
+ });
409
+ }
410
+ }
411
+ /**
412
+ * @experimental This function still needs development and will be changed
413
+ * Build apis which do not need crypto and can be used by non-data-owner users
414
+ */
193
415
  const BasicApis = function (host, username, password, crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : {}, fetchImpl = typeof window !== 'undefined'
194
416
  ? window.fetch
195
417
  : typeof self !== 'undefined'
@@ -208,6 +430,7 @@ const BasicApis = function (host, username, password, crypto = typeof window !==
208
430
  const agendaApi = new icc_api_1.IccAgendaApi(host, headers, authenticationProvider, fetchImpl);
209
431
  const groupApi = new icc_api_1.IccGroupApi(host, headers, authenticationProvider);
210
432
  const insuranceApi = new icc_api_1.IccInsuranceApi(host, headers, authenticationProvider, fetchImpl);
433
+ const healthcarePartyApi = new icc_hcparty_x_api_1.IccHcpartyXApi(host, headers, authenticationProvider, fetchImpl);
211
434
  return {
212
435
  authApi,
213
436
  codeApi,
@@ -217,6 +440,7 @@ const BasicApis = function (host, username, password, crypto = typeof window !==
217
440
  entityReferenceApi,
218
441
  agendaApi,
219
442
  groupApi,
443
+ healthcarePartyApi,
220
444
  };
221
445
  });
222
446
  };