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