@icure/api 8.0.8 → 8.0.9
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/model/models.d.ts +1 -0
- package/icc-api/model/models.js +1 -0
- package/icc-api/model/models.js.map +1 -1
- package/icc-x-api/crypto/ExchangeDataManager.js +3 -2
- package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
- package/icc-x-api/crypto/KeyRecovery.js +5 -4
- package/icc-x-api/crypto/KeyRecovery.js.map +1 -1
- package/icc-x-api/crypto/RSA.d.ts +4 -1
- package/icc-x-api/crypto/RSA.js +6 -1
- package/icc-x-api/crypto/RSA.js.map +1 -1
- package/icc-x-api/crypto/SecureDelegationsManager.js +2 -1
- package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -1
- package/icc-x-api/crypto/TransferKeysManager.js +4 -3
- package/icc-x-api/crypto/TransferKeysManager.js.map +1 -1
- package/icc-x-api/crypto/UserEncryptionKeysManager.js +2 -1
- package/icc-x-api/crypto/UserEncryptionKeysManager.js.map +1 -1
- package/icc-x-api/crypto/utils.d.ts +1 -4
- package/icc-x-api/crypto/utils.js +6 -8
- package/icc-x-api/crypto/utils.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.js +16 -14
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +2 -2
- package/icc-x-api/icc-calendar-item-x-api.js +17 -17
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.js +12 -11
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +2 -2
- package/icc-x-api/icc-contact-x-api.js +23 -20
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.js +17 -16
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.js +13 -12
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.js +18 -16
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.js +12 -11
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.js +11 -11
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.js +14 -14
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.js +28 -27
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.js +11 -10
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-recovery-x-api.js +3 -2
- package/icc-x-api/icc-recovery-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.js +9 -8
- package/icc-x-api/icc-time-table-x-api.js.map +1 -1
- package/icc-x-api/icc-topic-x-api.js +13 -13
- package/icc-x-api/icc-topic-x-api.js.map +1 -1
- package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +17 -1
- package/icc-x-api/utils/EntityWithDelegationTypeName.js +33 -15
- package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -1
- package/package.json +1 -1
- package/test/icc-api/api/IccAnonymousAccessApi.d.ts +1 -0
- package/test/icc-api/api/IccAnonymousAccessApi.js +58 -0
- package/test/icc-api/api/IccAnonymousAccessApi.js.map +1 -0
- package/test/icc-api/api/IccDocumentApi.d.ts +1 -0
- package/test/icc-api/api/IccDocumentApi.js +208 -0
- package/test/icc-api/api/IccDocumentApi.js.map +1 -0
- package/test/icc-api/api/IccGroupApi.d.ts +1 -0
- package/test/icc-api/api/IccGroupApi.js +50 -0
- package/test/icc-api/api/IccGroupApi.js.map +1 -0
- package/test/icc-api/api/IccRecoveryDataApi.d.ts +1 -0
- package/test/icc-api/api/IccRecoveryDataApi.js +95 -0
- package/test/icc-api/api/IccRecoveryDataApi.js.map +1 -0
- package/test/icc-api/api/IccRoleApi.d.ts +1 -0
- package/test/icc-api/api/IccRoleApi.js +34 -0
- package/test/icc-api/api/IccRoleApi.js.map +1 -0
- package/test/icc-api/api/IccUserApi.d.ts +1 -0
- package/test/icc-api/api/IccUserApi.js +96 -0
- package/test/icc-api/api/IccUserApi.js.map +1 -0
- package/test/icc-api/e2e/IccCalendarItemApi.d.ts +1 -0
- package/test/icc-api/e2e/IccCalendarItemApi.js +46 -0
- package/test/icc-api/e2e/IccCalendarItemApi.js.map +1 -0
- package/test/icc-api/model/modelHelpersTest.d.ts +1 -0
- package/test/icc-api/model/modelHelpersTest.js +45 -0
- package/test/icc-api/model/modelHelpersTest.js.map +1 -0
- package/test/icc-x-api/auth/group-switch-test.d.ts +1 -0
- package/test/icc-x-api/auth/group-switch-test.js +81 -0
- package/test/icc-x-api/auth/group-switch-test.js.map +1 -0
- package/test/icc-x-api/auth/jwt-concurrency-test.d.ts +2 -0
- package/test/icc-x-api/auth/jwt-concurrency-test.js +113 -0
- package/test/icc-x-api/auth/jwt-concurrency-test.js.map +1 -0
- package/test/icc-x-api/auth/smart-auth-provider-test.d.ts +1 -0
- package/test/icc-x-api/auth/smart-auth-provider-test.js +224 -0
- package/test/icc-x-api/auth/smart-auth-provider-test.js.map +1 -0
- package/test/icc-x-api/autofix-anonymity-test.d.ts +1 -0
- package/test/icc-x-api/autofix-anonymity-test.js +108 -0
- package/test/icc-x-api/autofix-anonymity-test.js.map +1 -0
- package/test/icc-x-api/confidential-entities-test.d.ts +1 -0
- package/test/icc-x-api/confidential-entities-test.js +110 -0
- package/test/icc-x-api/confidential-entities-test.js.map +1 -0
- package/test/icc-x-api/crud/comprehensive-crud-test.d.ts +1 -0
- package/test/icc-x-api/crud/comprehensive-crud-test.js +276 -0
- package/test/icc-x-api/crud/comprehensive-crud-test.js.map +1 -0
- package/test/icc-x-api/crud/entities-crud-test-interface.d.ts +16 -0
- package/test/icc-x-api/crud/entities-crud-test-interface.js +422 -0
- package/test/icc-x-api/crud/entities-crud-test-interface.js.map +1 -0
- package/test/icc-x-api/crypto/anonymous-delegations-test.d.ts +1 -0
- package/test/icc-x-api/crypto/anonymous-delegations-test.js +588 -0
- package/test/icc-x-api/crypto/anonymous-delegations-test.js.map +1 -0
- package/test/icc-x-api/crypto/concurrency.d.ts +1 -0
- package/test/icc-x-api/crypto/concurrency.js +35 -0
- package/test/icc-x-api/crypto/concurrency.js.map +1 -0
- package/test/icc-x-api/crypto/crypto-utils.d.ts +1 -0
- package/test/icc-x-api/crypto/crypto-utils.js +80 -0
- package/test/icc-x-api/crypto/crypto-utils.js.map +1 -0
- package/test/icc-x-api/crypto/cryptoTest.d.ts +2 -0
- package/test/icc-x-api/crypto/cryptoTest.js +302 -0
- package/test/icc-x-api/crypto/cryptoTest.js.map +1 -0
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.d.ts +1 -0
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js +166 -0
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js.map +1 -0
- package/test/icc-x-api/crypto/exchange-data-manager-test.d.ts +1 -0
- package/test/icc-x-api/crypto/exchange-data-manager-test.js +690 -0
- package/test/icc-x-api/crypto/exchange-data-manager-test.js.map +1 -0
- package/test/icc-x-api/crypto/full-crypto-test.d.ts +1 -0
- package/test/icc-x-api/crypto/full-crypto-test.js +457 -0
- package/test/icc-x-api/crypto/full-crypto-test.js.map +1 -0
- package/test/icc-x-api/crypto/secure-delegations-manager-test.d.ts +1 -0
- package/test/icc-x-api/crypto/secure-delegations-manager-test.js +266 -0
- package/test/icc-x-api/crypto/secure-delegations-manager-test.js.map +1 -0
- package/test/icc-x-api/crypto/secure-delegations-metadata-decryptor-test.d.ts +1 -0
- package/test/icc-x-api/crypto/secure-delegations-metadata-decryptor-test.js +393 -0
- package/test/icc-x-api/crypto/secure-delegations-metadata-decryptor-test.js.map +1 -0
- package/test/icc-x-api/crypto/security-metadata-decryptor-chain-test.d.ts +1 -0
- package/test/icc-x-api/crypto/security-metadata-decryptor-chain-test.js +213 -0
- package/test/icc-x-api/crypto/security-metadata-decryptor-chain-test.js.map +1 -0
- package/test/icc-x-api/crypto/shamir.d.ts +2 -0
- package/test/icc-x-api/crypto/shamir.js +166 -0
- package/test/icc-x-api/crypto/shamir.js.map +1 -0
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.d.ts +1 -0
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js +71 -0
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js.map +1 -0
- package/test/icc-x-api/crypto/signature-keys-manager-test.d.ts +1 -0
- package/test/icc-x-api/crypto/signature-keys-manager-test.js +44 -0
- package/test/icc-x-api/crypto/signature-keys-manager-test.js.map +1 -0
- package/test/icc-x-api/crypto/user-encryption-keys-manager-test.d.ts +1 -0
- package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js +246 -0
- package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js.map +1 -0
- package/test/icc-x-api/entity-with-attachments-api-test.d.ts +1 -0
- package/test/icc-x-api/entity-with-attachments-api-test.js +142 -0
- package/test/icc-x-api/entity-with-attachments-api-test.js.map +1 -0
- package/test/icc-x-api/filters/filters.d.ts +1 -0
- package/test/icc-x-api/filters/filters.js +49 -0
- package/test/icc-x-api/filters/filters.js.map +1 -0
- package/test/icc-x-api/icc-accesslog-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-accesslog-x-api.js +106 -0
- package/test/icc-x-api/icc-accesslog-x-api.js.map +1 -0
- package/test/icc-x-api/icc-auth-api.d.ts +1 -0
- package/test/icc-x-api/icc-auth-api.js +47 -0
- package/test/icc-x-api/icc-auth-api.js.map +1 -0
- package/test/icc-x-api/icc-calendar-item-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-calendar-item-x-api.js +150 -0
- package/test/icc-x-api/icc-calendar-item-x-api.js.map +1 -0
- package/test/icc-x-api/icc-contact-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-contact-x-api.js +279 -0
- package/test/icc-x-api/icc-contact-x-api.js.map +1 -0
- package/test/icc-x-api/icc-form-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-form-x-api.js +98 -0
- package/test/icc-x-api/icc-form-x-api.js.map +1 -0
- package/test/icc-x-api/icc-helement-x-api-test.d.ts +1 -0
- package/test/icc-x-api/icc-helement-x-api-test.js +153 -0
- package/test/icc-x-api/icc-helement-x-api-test.js.map +1 -0
- package/test/icc-x-api/icc-invoice-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-invoice-x-api.js +99 -0
- package/test/icc-x-api/icc-invoice-x-api.js.map +1 -0
- package/test/icc-x-api/icc-maintenance-task-x-api-test.d.ts +1 -0
- package/test/icc-x-api/icc-maintenance-task-x-api-test.js +221 -0
- package/test/icc-x-api/icc-maintenance-task-x-api-test.js.map +1 -0
- package/test/icc-x-api/icc-message-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-message-x-api.js +328 -0
- package/test/icc-x-api/icc-message-x-api.js.map +1 -0
- package/test/icc-x-api/icc-patient-x-api-test.d.ts +1 -0
- package/test/icc-x-api/icc-patient-x-api-test.js +158 -0
- package/test/icc-x-api/icc-patient-x-api-test.js.map +1 -0
- package/test/icc-x-api/icc-recovery-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-recovery-x-api.js +170 -0
- package/test/icc-x-api/icc-recovery-x-api.js.map +1 -0
- package/test/icc-x-api/icc-time-table-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-time-table-x-api.js +100 -0
- package/test/icc-x-api/icc-time-table-x-api.js.map +1 -0
- package/test/icc-x-api/icc-topic-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-topic-x-api.js +269 -0
- package/test/icc-x-api/icc-topic-x-api.js.map +1 -0
- package/test/icc-x-api/icc-user-x-api-test.d.ts +1 -0
- package/test/icc-x-api/icc-user-x-api-test.js +99 -0
- package/test/icc-x-api/icc-user-x-api-test.js.map +1 -0
- package/test/icc-x-api/patient-user.d.ts +2 -0
- package/test/icc-x-api/patient-user.js +104 -0
- package/test/icc-x-api/patient-user.js.map +1 -0
- package/test/icc-x-api/storage/storage.d.ts +1 -0
- package/test/icc-x-api/storage/storage.js +48 -0
- package/test/icc-x-api/storage/storage.js.map +1 -0
- package/test/icc-x-api/test-api-no-parent.d.ts +1 -0
- package/test/icc-x-api/test-api-no-parent.js +79 -0
- package/test/icc-x-api/test-api-no-parent.js.map +1 -0
- package/test/icc-x-api/test-legacy-data-support.d.ts +1 -0
- package/test/icc-x-api/test-legacy-data-support.js +376 -0
- package/test/icc-x-api/test-legacy-data-support.js.map +1 -0
- package/test/icc-x-api/utils/graph-test.d.ts +1 -0
- package/test/icc-x-api/utils/graph-test.js +54 -0
- package/test/icc-x-api/utils/graph-test.js.map +1 -0
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.d.ts +1 -0
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.js +364 -0
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.js.map +1 -0
- package/test/support/CSM-185.d.ts +1 -0
- package/test/support/CSM-185.js +124 -0
- package/test/support/CSM-185.js.map +1 -0
- package/test/support/CSM-243.d.ts +1 -0
- package/test/support/CSM-243.js +120 -0
- package/test/support/CSM-243.js.map +1 -0
- package/test/support/CSM-87.d.ts +0 -0
- package/test/support/CSM-87.js +21 -0
- package/test/support/CSM-87.js.map +1 -0
- package/test/support/CSM-93.d.ts +1 -0
- package/test/support/CSM-93.js +112 -0
- package/test/support/CSM-93.js.map +1 -0
- package/test/utils/FakeDataOwnerApi.d.ts +32 -0
- package/test/utils/FakeDataOwnerApi.js +136 -0
- package/test/utils/FakeDataOwnerApi.js.map +1 -0
- package/test/utils/FakeEncryptionKeysManager.d.ts +35 -0
- package/test/utils/FakeEncryptionKeysManager.js +87 -0
- package/test/utils/FakeEncryptionKeysManager.js.map +1 -0
- package/test/utils/FakeExchangeDataApi.d.ts +30 -0
- package/test/utils/FakeExchangeDataApi.js +74 -0
- package/test/utils/FakeExchangeDataApi.js.map +1 -0
- package/test/utils/FakeExchangeDataManager.d.ts +40 -0
- package/test/utils/FakeExchangeDataManager.js +89 -0
- package/test/utils/FakeExchangeDataManager.js.map +1 -0
- package/test/utils/FakeExchangeDataMapManager.d.ts +12 -0
- package/test/utils/FakeExchangeDataMapManager.js +38 -0
- package/test/utils/FakeExchangeDataMapManager.js.map +1 -0
- package/test/utils/FakeGenericApi.d.ts +16 -0
- package/test/utils/FakeGenericApi.js +65 -0
- package/test/utils/FakeGenericApi.js.map +1 -0
- package/test/utils/FakeSignatureKeysManager.d.ts +16 -0
- package/test/utils/FakeSignatureKeysManager.js +54 -0
- package/test/utils/FakeSignatureKeysManager.js.map +1 -0
- package/test/utils/TestApi.d.ts +3 -0
- package/test/utils/TestApi.js +30 -0
- package/test/utils/TestApi.js.map +1 -0
- package/test/utils/TestCollectionUtils.d.ts +1 -0
- package/test/utils/TestCollectionUtils.js +109 -0
- package/test/utils/TestCollectionUtils.js.map +1 -0
- package/test/utils/TestCryptoStrategies.d.ts +42 -0
- package/test/utils/TestCryptoStrategies.js +80 -0
- package/test/utils/TestCryptoStrategies.js.map +1 -0
- package/test/utils/TestStorage.d.ts +23 -0
- package/test/utils/TestStorage.js +61 -0
- package/test/utils/TestStorage.js.map +1 -0
- package/test/utils/test_utils.d.ts +76 -0
- package/test/utils/test_utils.js +419 -0
- package/test/utils/test_utils.js.map +1 -0
|
@@ -18,6 +18,7 @@ const ModelHelper_1 = require("../icc-api/model/ModelHelper");
|
|
|
18
18
|
const person_util_1 = require("./utils/person-util");
|
|
19
19
|
const utils_1 = require("./utils");
|
|
20
20
|
const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
|
|
21
|
+
const EntityWithDelegationTypeName_1 = require("./utils/EntityWithDelegationTypeName");
|
|
21
22
|
const SecureDelegation_1 = require("../icc-api/model/SecureDelegation");
|
|
22
23
|
const EntityShareRequest_1 = require("../icc-api/model/requests/EntityShareRequest");
|
|
23
24
|
const ShareMetadataBehaviour_1 = require("./crypto/ShareMetadataBehaviour");
|
|
@@ -27,7 +28,7 @@ const Connection_1 = require("../icc-api/model/Connection");
|
|
|
27
28
|
// noinspection JSUnusedGlobalSymbols
|
|
28
29
|
class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
29
30
|
get headers() {
|
|
30
|
-
return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h,
|
|
31
|
+
return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient));
|
|
31
32
|
}
|
|
32
33
|
constructor(host, headers, crypto, contactApi, formApi, helementApi, invoiceApi, documentApi, hcpartyApi, classificationApi, dataOwnerApi, calendarItemApi, userApi, authApi, autofillAuthor, encryptedKeys = ['note'], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
|
|
33
34
|
? window.fetch
|
|
@@ -69,7 +70,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
69
70
|
if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
|
|
70
71
|
throw new Error('Can only initialise entities as current data owner.');
|
|
71
72
|
const extraDelegations = Object.assign(Object.assign({}, Object.fromEntries([...((_j = (_h = user.autoDelegations) === null || _h === void 0 ? void 0 : _h.all) !== null && _j !== void 0 ? _j : []), ...((_l = (_k = user.autoDelegations) === null || _k === void 0 ? void 0 : _k.medicalInformation) !== null && _l !== void 0 ? _l : [])].map((d) => [d, AccessLevelEnum.WRITE]))), ((_m = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _m !== void 0 ? _m : {}));
|
|
72
|
-
const initialisationInfo = yield this.crypto.xapi.entityWithInitialisedEncryptedMetadata(patient,
|
|
73
|
+
const initialisationInfo = yield this.crypto.xapi.entityWithInitialisedEncryptedMetadata(patient, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, undefined, undefined, true, true, extraDelegations);
|
|
73
74
|
return new models.Patient(initialisationInfo.updatedEntity);
|
|
74
75
|
});
|
|
75
76
|
}
|
|
@@ -123,7 +124,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
123
124
|
if (!updatedPatient)
|
|
124
125
|
throw new Error('Could not create patient');
|
|
125
126
|
}
|
|
126
|
-
const initialised = yield this.crypto.confidential.initialiseConfidentialSecretId(updatedPatient,
|
|
127
|
+
const initialised = yield this.crypto.confidential.initialiseConfidentialSecretId(updatedPatient, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, (x) => this.bulkSharePatients(x));
|
|
127
128
|
if (initialised) {
|
|
128
129
|
return initialised;
|
|
129
130
|
}
|
|
@@ -299,7 +300,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
299
300
|
return this.encryptAs(dataOwnerId, pats);
|
|
300
301
|
}
|
|
301
302
|
encryptAs(dataOwner, pats) {
|
|
302
|
-
return Promise.all(pats.map((p) => this.crypto.xapi.tryEncryptEntity(p,
|
|
303
|
+
return Promise.all(pats.map((p) => this.crypto.xapi.tryEncryptEntity(p, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, this.encryptedFields, true, false, (x) => new models.Patient(x))));
|
|
303
304
|
}
|
|
304
305
|
// If patient can't be decrypted returns patient with encrypted data.
|
|
305
306
|
decrypt(user, patients, fillDelegations = true) {
|
|
@@ -311,7 +312,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
311
312
|
tryDecryptOrReturnOriginal(patients) {
|
|
312
313
|
return Promise.all(patients.map((p) => __awaiter(this, void 0, void 0, function* () {
|
|
313
314
|
return yield this.crypto.xapi
|
|
314
|
-
.decryptEntity(p,
|
|
315
|
+
.decryptEntity(p, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, (x) => new models.Patient(x))
|
|
315
316
|
.then((p) => {
|
|
316
317
|
if (p.entity.picture && !(p.entity.picture instanceof ArrayBuffer)) {
|
|
317
318
|
return {
|
|
@@ -376,7 +377,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
376
377
|
const hcp = yield this.hcpartyApi.getHealthcareParty(ownerId);
|
|
377
378
|
const parentId = hcp.parentId;
|
|
378
379
|
let patient = yield (0, utils_1.retry)(() => this.getPatientWithUser(user, patId));
|
|
379
|
-
const patientWithInitialisedEncryption = yield this.crypto.xapi.ensureEncryptionKeysInitialised(patient,
|
|
380
|
+
const patientWithInitialisedEncryption = yield this.crypto.xapi.ensureEncryptionKeysInitialised(patient, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient);
|
|
380
381
|
if (patientWithInitialisedEncryption) {
|
|
381
382
|
patient = yield this.modifyPatientWithUser(user, patientWithInitialisedEncryption);
|
|
382
383
|
}
|
|
@@ -387,8 +388,8 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
387
388
|
};
|
|
388
389
|
return { patient: patient, statuses: status };
|
|
389
390
|
}
|
|
390
|
-
const delSfks = yield this.crypto.xapi.secretIdsOf({ entity: patient, type:
|
|
391
|
-
const ecKeys = yield this.crypto.xapi.encryptionKeysOf({ entity: patient, type:
|
|
391
|
+
const delSfks = yield this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, ownerId);
|
|
392
|
+
const ecKeys = yield this.crypto.xapi.encryptionKeysOf({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, ownerId);
|
|
392
393
|
if (delSfks.length) {
|
|
393
394
|
const retrievedHealthElements = yield (0, utils_1.retry)(() => (usingPost
|
|
394
395
|
? this.helementApi.findHealthElementsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(ownerId, _.uniq(delSfks))
|
|
@@ -473,12 +474,12 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
473
474
|
status.success = true;
|
|
474
475
|
}
|
|
475
476
|
});
|
|
476
|
-
yield doShareEntitiesAndUpdateStatus(retrievedHealthElements,
|
|
477
|
-
yield doShareEntitiesAndUpdateStatus(retrievedContacts,
|
|
478
|
-
yield doShareEntitiesAndUpdateStatus(retrievedInvoices,
|
|
479
|
-
yield doShareEntitiesAndUpdateStatus(retrievedClassifications,
|
|
480
|
-
yield doShareEntitiesAndUpdateStatus(retrievedCalendarItems,
|
|
481
|
-
yield doShareEntitiesAndUpdateStatus(retrievedForms,
|
|
477
|
+
yield doShareEntitiesAndUpdateStatus(retrievedHealthElements, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.HealthElement, status.healthElements, isMedicalInfoTags, (x) => this.helementApi.bulkShareHealthElementsMinimal(x));
|
|
478
|
+
yield doShareEntitiesAndUpdateStatus(retrievedContacts, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Contact, status.contacts, isMedicalInfoTags, (x) => this.contactApi.bulkShareContactsMinimal(x));
|
|
479
|
+
yield doShareEntitiesAndUpdateStatus(retrievedInvoices, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Invoice, status.invoices, isFinancialInfoTags, (x) => this.invoiceApi.bulkShareInvoicesMinimal(x));
|
|
480
|
+
yield doShareEntitiesAndUpdateStatus(retrievedClassifications, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Classification, status.classifications, isMedicalInfoTags, (x) => this.classificationApi.bulkShareClassificationsMinimal(x));
|
|
481
|
+
yield doShareEntitiesAndUpdateStatus(retrievedCalendarItems, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.CalendarItem, status.calendarItems, isMedicalInfoTags, (x) => this.calendarItemApi.bulkShareCalendarItemsMinimal(x));
|
|
482
|
+
yield doShareEntitiesAndUpdateStatus(retrievedForms, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Form, status.forms, isMedicalInfoTags, (x) => this.formApi.bulkShareFormsMinimal(x));
|
|
482
483
|
}
|
|
483
484
|
const sharePatientDataRequest = {
|
|
484
485
|
shareSecretIds: delSfks,
|
|
@@ -491,7 +492,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
491
492
|
dataForDelegates: Object.fromEntries(delegateIds.map((delegateId) => [delegateId, sharePatientDataRequest])),
|
|
492
493
|
};
|
|
493
494
|
return yield this.crypto.xapi
|
|
494
|
-
.bulkShareOrUpdateEncryptedEntityMetadata(
|
|
495
|
+
.bulkShareOrUpdateEncryptedEntityMetadata(EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, [sharePatientRequest], (x) => this.bulkSharePatients(x))
|
|
495
496
|
.then((shareResult) => {
|
|
496
497
|
var _a;
|
|
497
498
|
if (shareResult.updatedEntities.length && !shareResult.updateErrors.length) {
|
|
@@ -518,7 +519,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
518
519
|
const parentId = hcp.parentId;
|
|
519
520
|
return (0, utils_1.retry)(() => this.getPatientWithUser(user, patId))
|
|
520
521
|
.then((patient) => __awaiter(this, void 0, void 0, function* () {
|
|
521
|
-
const initialised = yield this.crypto.xapi.ensureEncryptionKeysInitialised(patient,
|
|
522
|
+
const initialised = yield this.crypto.xapi.ensureEncryptionKeysInitialised(patient, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient);
|
|
522
523
|
if (!initialised) {
|
|
523
524
|
return patient;
|
|
524
525
|
}
|
|
@@ -530,7 +531,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
530
531
|
if (!patient) {
|
|
531
532
|
return Promise.resolve({ id: patId });
|
|
532
533
|
}
|
|
533
|
-
const delSfks = yield this.crypto.xapi.secretIdsOf({ entity: patient, type:
|
|
534
|
+
const delSfks = yield this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, ownerId);
|
|
534
535
|
return delSfks.length
|
|
535
536
|
? Promise.all([
|
|
536
537
|
(0, utils_1.retry)(() => (usingPost
|
|
@@ -679,7 +680,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
679
680
|
*/
|
|
680
681
|
hasWriteAccess(patient) {
|
|
681
682
|
return __awaiter(this, void 0, void 0, function* () {
|
|
682
|
-
return this.crypto.xapi.hasWriteAccess({ entity: patient, type:
|
|
683
|
+
return this.crypto.xapi.hasWriteAccess({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient });
|
|
683
684
|
});
|
|
684
685
|
}
|
|
685
686
|
/**
|
|
@@ -740,10 +741,10 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
740
741
|
return __awaiter(this, void 0, void 0, function* () {
|
|
741
742
|
const self = yield this.dataOwnerApi.getCurrentDataOwnerId();
|
|
742
743
|
// All entities should have an encryption key.
|
|
743
|
-
const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(patient,
|
|
744
|
+
const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(patient, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient);
|
|
744
745
|
const updatedEntity = entityWithEncryptionKey ? yield this.modifyPatientAs(self, entityWithEncryptionKey) : patient;
|
|
745
746
|
return this.crypto.xapi
|
|
746
|
-
.simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type:
|
|
747
|
+
.simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, false, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
|
|
747
748
|
delegateId,
|
|
748
749
|
{
|
|
749
750
|
requestedPermissions: options.requestedPermissions,
|
|
@@ -761,7 +762,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
761
762
|
* patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.
|
|
762
763
|
*/
|
|
763
764
|
decryptSecretIdsOf(patient) {
|
|
764
|
-
return this.crypto.xapi.secretIdsOf({ entity: patient, type:
|
|
765
|
+
return this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, undefined);
|
|
765
766
|
}
|
|
766
767
|
/**
|
|
767
768
|
* @param patient a patient
|
|
@@ -769,7 +770,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
769
770
|
* patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.
|
|
770
771
|
*/
|
|
771
772
|
decryptConfidentialSecretIdsOf(patient) {
|
|
772
|
-
return this.crypto.confidential.getConfidentialSecretIds({ entity: patient, type:
|
|
773
|
+
return this.crypto.confidential.getConfidentialSecretIds({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, undefined);
|
|
773
774
|
}
|
|
774
775
|
/**
|
|
775
776
|
* @param patient a patient
|
|
@@ -777,13 +778,13 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
777
778
|
* patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.
|
|
778
779
|
*/
|
|
779
780
|
decryptNonConfidentialSecretIdsOf(patient) {
|
|
780
|
-
return this.crypto.confidential.getSecretIdsSharedWithParents({ entity: patient, type:
|
|
781
|
+
return this.crypto.confidential.getSecretIdsSharedWithParents({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient });
|
|
781
782
|
}
|
|
782
783
|
getDataOwnersWithAccessTo(entity) {
|
|
783
|
-
return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type:
|
|
784
|
+
return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient });
|
|
784
785
|
}
|
|
785
786
|
getEncryptionKeysOf(entity) {
|
|
786
|
-
return this.crypto.xapi.encryptionKeysOf({ entity, type:
|
|
787
|
+
return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, undefined);
|
|
787
788
|
}
|
|
788
789
|
/**
|
|
789
790
|
* Merge two patients into one. This method performs the following operations:
|
|
@@ -835,11 +836,11 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
835
836
|
subscribeToPatientEvents(eventTypes, filter, eventFired, options = {}) {
|
|
836
837
|
return __awaiter(this, void 0, void 0, function* () {
|
|
837
838
|
const currentUser = yield this.userApi.getCurrentUser();
|
|
838
|
-
return (0, utils_1.subscribeToEntityEvents)(this.host, this.authApi,
|
|
839
|
+
return (0, utils_1.subscribeToEntityEvents)(this.host, this.authApi, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decrypt(currentUser, [encrypted]))[0]; })).then((rs) => new Connection_1.ConnectionImpl(rs));
|
|
839
840
|
});
|
|
840
841
|
}
|
|
841
842
|
createDelegationDeAnonymizationMetadata(entity, delegates) {
|
|
842
|
-
return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type:
|
|
843
|
+
return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, delegates);
|
|
843
844
|
}
|
|
844
845
|
/**
|
|
845
846
|
* Initializes the exchange data towards a newly invited patient. This allows the doctor to share data with the
|