@icure/api 7.1.14 → 8.0.0-RC.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/icc-api/api/IccAccesslogApi.d.ts +12 -1
- package/icc-api/api/IccAccesslogApi.js +142 -98
- package/icc-api/api/IccAccesslogApi.js.map +1 -1
- package/icc-api/api/IccBemikronoApi.d.ts +81 -0
- package/icc-api/api/IccBemikronoApi.js +163 -0
- package/icc-api/api/IccBemikronoApi.js.map +1 -0
- package/icc-api/api/IccCalendarItemApi.d.ts +21 -1
- package/icc-api/api/IccCalendarItemApi.js +183 -117
- package/icc-api/api/IccCalendarItemApi.js.map +1 -1
- package/icc-api/api/IccClassificationApi.d.ts +21 -1
- package/icc-api/api/IccClassificationApi.js +119 -63
- package/icc-api/api/IccClassificationApi.js.map +1 -1
- package/icc-api/api/IccContactApi.d.ts +21 -1
- package/icc-api/api/IccContactApi.js +385 -294
- package/icc-api/api/IccContactApi.js.map +1 -1
- package/icc-api/api/IccDocumentApi.d.ts +32 -25
- package/icc-api/api/IccDocumentApi.js +264 -212
- package/icc-api/api/IccDocumentApi.js.map +1 -1
- package/icc-api/api/IccExchangeDataApi.d.ts +19 -0
- package/icc-api/api/IccExchangeDataApi.js +85 -0
- package/icc-api/api/IccExchangeDataApi.js.map +1 -0
- package/icc-api/api/IccExchangeDataMapApi.d.ts +18 -0
- package/icc-api/api/IccExchangeDataMapApi.js +65 -0
- package/icc-api/api/IccExchangeDataMapApi.js.map +1 -0
- package/icc-api/api/IccFormApi.d.ts +21 -1
- package/icc-api/api/IccFormApi.js +321 -229
- package/icc-api/api/IccFormApi.js.map +1 -1
- package/icc-api/api/IccHelementApi.d.ts +21 -1
- package/icc-api/api/IccHelementApi.js +207 -137
- package/icc-api/api/IccHelementApi.js.map +1 -1
- package/icc-api/api/IccInvoiceApi.d.ts +21 -1
- package/icc-api/api/IccInvoiceApi.js +404 -298
- package/icc-api/api/IccInvoiceApi.js.map +1 -1
- package/icc-api/api/IccMaintenanceTaskApi.d.ts +12 -1
- package/icc-api/api/IccMaintenanceTaskApi.js +79 -43
- package/icc-api/api/IccMaintenanceTaskApi.js.map +1 -1
- package/icc-api/api/IccMessageApi.d.ts +12 -1
- package/icc-api/api/IccMessageApi.js +257 -191
- package/icc-api/api/IccMessageApi.js.map +1 -1
- package/icc-api/api/IccPatientApi.d.ts +12 -1
- package/icc-api/api/IccPatientApi.js +447 -351
- package/icc-api/api/IccPatientApi.js.map +1 -1
- package/icc-api/api/IccReceiptApi.d.ts +22 -8
- package/icc-api/api/IccReceiptApi.js +121 -64
- package/icc-api/api/IccReceiptApi.js.map +1 -1
- package/icc-api/api/IccRestApiPath.js +1 -1
- package/icc-api/api/IccRestApiPath.js.map +1 -1
- package/icc-api/api/IccTimeTableApi.d.ts +12 -1
- package/icc-api/api/IccTimeTableApi.js +86 -48
- package/icc-api/api/IccTimeTableApi.js.map +1 -1
- package/icc-api/index.d.ts +1 -0
- package/icc-api/index.js +1 -0
- package/icc-api/index.js.map +1 -1
- package/icc-api/model/AccessLog.d.ts +4 -0
- package/icc-api/model/AccessLog.js +1 -0
- package/icc-api/model/AccessLog.js.map +1 -1
- package/icc-api/model/Article.d.ts +4 -0
- package/icc-api/model/Article.js +1 -0
- package/icc-api/model/Article.js.map +1 -1
- package/icc-api/model/CalendarItem.d.ts +4 -0
- package/icc-api/model/CalendarItem.js +1 -0
- package/icc-api/model/CalendarItem.js.map +1 -1
- package/icc-api/model/Classification.d.ts +4 -0
- package/icc-api/model/Classification.js +1 -0
- package/icc-api/model/Classification.js.map +1 -1
- package/icc-api/model/ClassificationTemplate.d.ts +2 -0
- package/icc-api/model/ClassificationTemplate.js.map +1 -1
- package/icc-api/model/Contact.d.ts +4 -0
- package/icc-api/model/Contact.js +1 -0
- package/icc-api/model/Contact.js.map +1 -1
- package/icc-api/model/Device.d.ts +4 -4
- package/icc-api/model/Device.js.map +1 -1
- package/icc-api/model/Document.d.ts +4 -0
- package/icc-api/model/Document.js +1 -0
- package/icc-api/model/Document.js.map +1 -1
- package/icc-api/model/ExchangeData.d.ts +61 -0
- package/icc-api/model/ExchangeData.js +12 -0
- package/icc-api/model/ExchangeData.js.map +1 -0
- package/icc-api/model/ExchangeDataMap.d.ts +21 -0
- package/icc-api/model/ExchangeDataMap.js +10 -0
- package/icc-api/model/ExchangeDataMap.js.map +1 -0
- package/icc-api/model/ExchangeDataMapCreationBatch.d.ts +13 -0
- package/icc-api/model/ExchangeDataMapCreationBatch.js +10 -0
- package/icc-api/model/ExchangeDataMapCreationBatch.js.map +1 -0
- package/icc-api/model/Form.d.ts +4 -0
- package/icc-api/model/Form.js +1 -0
- package/icc-api/model/Form.js.map +1 -1
- package/icc-api/model/HealthElement.d.ts +4 -0
- package/icc-api/model/HealthElement.js +1 -0
- package/icc-api/model/HealthElement.js.map +1 -1
- package/icc-api/model/HealthcareParty.d.ts +2 -2
- package/icc-api/model/HealthcareParty.js.map +1 -1
- package/icc-api/model/IcureStub.d.ts +2 -0
- package/icc-api/model/IcureStub.js.map +1 -1
- package/icc-api/model/Invoice.d.ts +4 -0
- package/icc-api/model/Invoice.js +1 -0
- package/icc-api/model/Invoice.js.map +1 -1
- package/icc-api/model/MaintenanceTask.d.ts +4 -0
- package/icc-api/model/MaintenanceTask.js +1 -0
- package/icc-api/model/MaintenanceTask.js.map +1 -1
- package/icc-api/model/Message.d.ts +4 -0
- package/icc-api/model/Message.js +1 -0
- package/icc-api/model/Message.js.map +1 -1
- package/icc-api/model/PaginatedListExchangeData.d.ts +9 -0
- package/icc-api/model/PaginatedListExchangeData.js +10 -0
- package/icc-api/model/PaginatedListExchangeData.js.map +1 -0
- package/icc-api/model/Patient.d.ts +6 -2
- package/icc-api/model/Patient.js +1 -0
- package/icc-api/model/Patient.js.map +1 -1
- package/icc-api/model/PatientByHcPartyGenderEducationProfession.d.ts +31 -0
- package/icc-api/model/PatientByHcPartyGenderEducationProfession.js +32 -0
- package/icc-api/model/PatientByHcPartyGenderEducationProfession.js.map +1 -0
- package/icc-api/model/Receipt.d.ts +4 -0
- package/icc-api/model/Receipt.js +1 -0
- package/icc-api/model/Receipt.js.map +1 -1
- package/icc-api/model/SecureDelegation.d.ts +52 -0
- package/icc-api/model/SecureDelegation.js +16 -0
- package/icc-api/model/SecureDelegation.js.map +1 -0
- package/icc-api/model/SecurityMetadata.d.ts +33 -0
- package/icc-api/model/SecurityMetadata.js +13 -0
- package/icc-api/model/SecurityMetadata.js.map +1 -0
- package/icc-api/model/Service.d.ts +2 -0
- package/icc-api/model/Service.js.map +1 -1
- package/icc-api/model/TimeTable.d.ts +4 -0
- package/icc-api/model/TimeTable.js +1 -0
- package/icc-api/model/TimeTable.js.map +1 -1
- package/icc-api/model/models.d.ts +20 -39
- package/icc-api/model/models.js +15 -37
- package/icc-api/model/models.js.map +1 -1
- package/icc-api/model/requests/EntityBulkShareResult.d.ts +28 -0
- package/icc-api/model/requests/EntityBulkShareResult.js +16 -0
- package/icc-api/model/requests/EntityBulkShareResult.js.map +1 -0
- package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.d.ts +10 -0
- package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js +17 -0
- package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js.map +1 -0
- package/icc-api/model/requests/EntityShareRequest.d.ts +110 -0
- package/icc-api/model/requests/EntityShareRequest.js +63 -0
- package/icc-api/model/requests/EntityShareRequest.js.map +1 -0
- package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.d.ts +54 -0
- package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js +24 -0
- package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js.map +1 -0
- package/icc-api/model/requests/MinimalEntityBulkShareResult.d.ts +23 -0
- package/icc-api/model/requests/MinimalEntityBulkShareResult.js +13 -0
- package/icc-api/model/requests/MinimalEntityBulkShareResult.js.map +1 -0
- package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.d.ts +21 -0
- package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.js +14 -0
- package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.js.map +1 -0
- package/icc-x-api/basexapi/EncryptedEntityXApi.d.ts +3 -2
- package/icc-x-api/basexapi/EncryptedEntityXApi.js.map +1 -1
- package/icc-x-api/crypto/AES.js +1 -1
- package/icc-x-api/crypto/AES.js.map +1 -1
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.d.ts +16 -0
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js +41 -0
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js.map +1 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.d.ts +42 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.js +86 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.js.map +1 -0
- package/icc-x-api/crypto/BaseExchangeDataManager.d.ts +146 -0
- package/icc-x-api/crypto/BaseExchangeDataManager.js +342 -0
- package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -0
- package/icc-x-api/crypto/BaseExchangeKeysManager.d.ts +0 -18
- package/icc-x-api/crypto/BaseExchangeKeysManager.js +11 -85
- package/icc-x-api/crypto/BaseExchangeKeysManager.js.map +1 -1
- package/icc-x-api/crypto/ConfidentialEntities.d.ts +26 -16
- package/icc-x-api/crypto/ConfidentialEntities.js +30 -17
- package/icc-x-api/crypto/ConfidentialEntities.js.map +1 -1
- package/icc-x-api/crypto/CryptoStrategies.d.ts +8 -1
- package/icc-x-api/crypto/CryptoStrategies.js.map +1 -1
- package/icc-x-api/crypto/ExchangeDataManager.d.ts +95 -0
- package/icc-x-api/crypto/ExchangeDataManager.js +493 -0
- package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -0
- package/icc-x-api/crypto/ExchangeDataMapManager.d.ts +32 -0
- package/icc-x-api/crypto/ExchangeDataMapManager.js +70 -0
- package/icc-x-api/crypto/ExchangeDataMapManager.js.map +1 -0
- package/icc-x-api/crypto/ExchangeKeysManager.d.ts +4 -16
- package/icc-x-api/crypto/ExchangeKeysManager.js +4 -62
- package/icc-x-api/crypto/ExchangeKeysManager.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtils.d.ts +336 -0
- package/icc-x-api/crypto/ExtendedApisUtils.js +3 -0
- package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -0
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +181 -0
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +562 -0
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -0
- package/icc-x-api/crypto/KeyRecovery.d.ts +5 -2
- package/icc-x-api/crypto/KeyRecovery.js +59 -29
- package/icc-x-api/crypto/KeyRecovery.js.map +1 -1
- package/icc-x-api/crypto/LegacyCryptoStrategies.d.ts +7 -2
- package/icc-x-api/crypto/LegacyCryptoStrategies.js +8 -1
- package/icc-x-api/crypto/LegacyCryptoStrategies.js.map +1 -1
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.d.ts +39 -0
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js +150 -0
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js.map +1 -0
- package/icc-x-api/crypto/RSA.d.ts +34 -8
- package/icc-x-api/crypto/RSA.js +80 -13
- package/icc-x-api/crypto/RSA.js.map +1 -1
- package/icc-x-api/crypto/SecureDelegationsEncryption.d.ts +54 -0
- package/icc-x-api/crypto/SecureDelegationsEncryption.js +178 -0
- package/icc-x-api/crypto/SecureDelegationsEncryption.js.map +1 -0
- package/icc-x-api/crypto/SecureDelegationsManager.d.ts +66 -0
- package/icc-x-api/crypto/SecureDelegationsManager.js +261 -0
- package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -0
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.d.ts +37 -0
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js +294 -0
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js.map +1 -0
- package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +114 -0
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js +98 -0
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js.map +1 -0
- package/icc-x-api/crypto/ShamirKeysManager.d.ts +5 -5
- package/icc-x-api/crypto/ShamirKeysManager.js +6 -9
- package/icc-x-api/crypto/ShamirKeysManager.js.map +1 -1
- package/icc-x-api/crypto/TransferKeysManager.d.ts +8 -6
- package/icc-x-api/crypto/TransferKeysManager.js +75 -52
- package/icc-x-api/crypto/TransferKeysManager.js.map +1 -1
- package/icc-x-api/crypto/{KeyManager.d.ts → UserEncryptionKeysManager.d.ts} +4 -6
- package/icc-x-api/crypto/{KeyManager.js → UserEncryptionKeysManager.js} +43 -23
- package/icc-x-api/crypto/UserEncryptionKeysManager.js.map +1 -0
- package/icc-x-api/crypto/UserSignatureKeysManager.d.ts +26 -0
- package/icc-x-api/crypto/UserSignatureKeysManager.js +74 -0
- package/icc-x-api/crypto/UserSignatureKeysManager.js.map +1 -0
- package/icc-x-api/crypto/utils.d.ts +61 -11
- package/icc-x-api/crypto/utils.js +113 -44
- package/icc-x-api/crypto/utils.js.map +1 -1
- package/icc-x-api/filters/filters.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.d.ts +46 -11
- package/icc-x-api/icc-accesslog-x-api.js +75 -42
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +50 -14
- package/icc-x-api/icc-calendar-item-x-api.js +99 -49
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.d.ts +44 -9
- package/icc-x-api/icc-classification-x-api.js +56 -31
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +56 -32
- package/icc-x-api/icc-contact-x-api.js +95 -64
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +28 -334
- package/icc-x-api/icc-crypto-x-api.js +41 -765
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-data-owner-x-api.d.ts +20 -8
- package/icc-x-api/icc-data-owner-x-api.js +31 -10
- package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +48 -11
- package/icc-x-api/icc-document-x-api.js +111 -64
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +45 -10
- package/icc-x-api/icc-form-x-api.js +65 -35
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-hcparty-x-api.d.ts +2 -2
- package/icc-x-api/icc-hcparty-x-api.js +3 -3
- package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +55 -18
- package/icc-x-api/icc-helement-x-api.js +76 -41
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-icure-maintenance-x-api.d.ts +7 -2
- package/icc-x-api/icc-icure-maintenance-x-api.js +38 -27
- package/icc-x-api/icc-icure-maintenance-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.d.ts +50 -15
- package/icc-x-api/icc-invoice-x-api.js +63 -33
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.d.ts +53 -21
- package/icc-x-api/icc-maintenance-task-x-api.js +72 -35
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.d.ts +53 -15
- package/icc-x-api/icc-message-x-api.js +65 -36
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +84 -29
- package/icc-x-api/icc-patient-x-api.js +313 -378
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +44 -12
- package/icc-x-api/icc-receipt-x-api.js +67 -35
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.d.ts +43 -12
- package/icc-x-api/icc-time-table-x-api.js +56 -26
- package/icc-x-api/icc-time-table-x-api.js.map +1 -1
- package/icc-x-api/icc-user-x-api.d.ts +2 -2
- package/icc-x-api/icc-user-x-api.js +3 -3
- package/icc-x-api/icc-user-x-api.js.map +1 -1
- package/icc-x-api/index.d.ts +4 -2
- package/icc-x-api/index.js +154 -135
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/storage/DefaultStorageEntryKeysFactory.d.ts +2 -0
- package/icc-x-api/storage/DefaultStorageEntryKeysFactory.js +9 -2
- package/icc-x-api/storage/DefaultStorageEntryKeysFactory.js.map +1 -1
- package/icc-x-api/storage/IcureStorageFacade.d.ts +23 -2
- package/icc-x-api/storage/IcureStorageFacade.js +36 -2
- package/icc-x-api/storage/IcureStorageFacade.js.map +1 -1
- package/icc-x-api/storage/KeyStorageFacade.d.ts +12 -0
- package/icc-x-api/storage/KeyStorageFacade.js.map +1 -1
- package/icc-x-api/storage/KeyStorageImpl.d.ts +2 -0
- package/icc-x-api/storage/KeyStorageImpl.js +10 -0
- package/icc-x-api/storage/KeyStorageImpl.js.map +1 -1
- package/icc-x-api/storage/StorageEntryKeysFactory.d.ts +14 -1
- package/icc-x-api/storage/StorageEntryKeysFactory.js.map +1 -1
- package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +32 -0
- package/icc-x-api/utils/EntityWithDelegationTypeName.js +75 -0
- package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -0
- package/icc-x-api/utils/ShareResult.d.ts +74 -0
- package/icc-x-api/utils/ShareResult.js +61 -0
- package/icc-x-api/utils/ShareResult.js.map +1 -0
- package/icc-x-api/utils/binary-utils.d.ts +1 -0
- package/icc-x-api/utils/binary-utils.js +8 -1
- package/icc-x-api/utils/binary-utils.js.map +1 -1
- package/icc-x-api/utils/collection-utils.d.ts +5 -0
- package/icc-x-api/utils/collection-utils.js +26 -1
- package/icc-x-api/utils/collection-utils.js.map +1 -1
- package/icc-x-api/utils/crypto-utils.d.ts +4 -3
- package/icc-x-api/utils/crypto-utils.js +5 -4
- package/icc-x-api/utils/crypto-utils.js.map +1 -1
- package/icc-x-api/utils/lru-temporised-async-cache.d.ts +26 -3
- package/icc-x-api/utils/lru-temporised-async-cache.js +75 -15
- package/icc-x-api/utils/lru-temporised-async-cache.js.map +1 -1
- package/icc-x-api/utils/websocket.d.ts +10 -10
- package/icc-x-api/utils/websocket.js +18 -9
- package/icc-x-api/utils/websocket.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +2 -3
- package/icc-x-api/crypto/EntitiesEncryption.d.ts +0 -275
- package/icc-x-api/crypto/EntitiesEncryption.js +0 -734
- package/icc-x-api/crypto/EntitiesEncryption.js.map +0 -1
- package/icc-x-api/crypto/KeyManager.js.map +0 -1
|
@@ -6,32 +6,27 @@ import { PaginatedListContact } from '../icc-api/model/PaginatedListContact';
|
|
|
6
6
|
import { IccDataOwnerXApi } from './icc-data-owner-x-api';
|
|
7
7
|
import { SubscriptionOptions } from './utils';
|
|
8
8
|
import { AuthenticationProvider } from './auth/AuthenticationProvider';
|
|
9
|
+
import { SecureDelegation } from '../icc-api/model/SecureDelegation';
|
|
10
|
+
import AccessLevelEnum = SecureDelegation.AccessLevelEnum;
|
|
9
11
|
import { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour';
|
|
12
|
+
import { ShareResult } from './utils/ShareResult';
|
|
13
|
+
import { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest';
|
|
14
|
+
import RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum;
|
|
15
|
+
import { XHR } from '../icc-api/api/XHR';
|
|
16
|
+
import { IccUserXApi } from './icc-user-x-api';
|
|
10
17
|
import { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi';
|
|
11
|
-
import { AbstractFilter } from
|
|
12
|
-
import {
|
|
13
|
-
import { Connection } from "../icc-api/model/Connection";
|
|
18
|
+
import { AbstractFilter } from './filters/filters';
|
|
19
|
+
import { Connection } from '../icc-api/model/Connection';
|
|
14
20
|
export declare class IccContactXApi extends IccContactApi implements EncryptedEntityXApi<models.Contact> {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
dataOwnerApi: IccDataOwnerXApi;
|
|
21
|
+
private readonly crypto;
|
|
22
|
+
private readonly dataOwnerApi;
|
|
18
23
|
private readonly userApi;
|
|
19
24
|
private readonly authApi;
|
|
25
|
+
i18n: any;
|
|
20
26
|
private readonly contactEncryptedFields;
|
|
21
27
|
private readonly serviceEncryptedFieldsNoContent;
|
|
22
28
|
private readonly serviceEncryptedFieldsWithContent;
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
* @param host
|
|
26
|
-
* @param headers
|
|
27
|
-
* @param crypto
|
|
28
|
-
* @param dataOwnerApi
|
|
29
|
-
* @param authenticationProvider
|
|
30
|
-
* @param fetchImpl
|
|
31
|
-
* @param contactEncryptedKeys custom encrypted fields for Contact. Note that to customise the encryption of contained services (`services` field),
|
|
32
|
-
* you need to use the serviceEncryptedKeys parameter.
|
|
33
|
-
* @param serviceEncryptedKeys custom encrypted fields for Service. Note that you can't customise encryption of the `content` field
|
|
34
|
-
*/
|
|
29
|
+
get headers(): Promise<Array<XHR.Header>>;
|
|
35
30
|
constructor(host: string, headers: {
|
|
36
31
|
[key: string]: string;
|
|
37
32
|
}, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, userApi: IccUserXApi, authApi: IccAuthApi, authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, contactEncryptedKeys?: string[], serviceEncryptedKeys?: string[]);
|
|
@@ -44,17 +39,17 @@ export declare class IccContactXApi extends IccContactApi implements EncryptedEn
|
|
|
44
39
|
* @param options optional parameters:
|
|
45
40
|
* - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
|
|
46
41
|
* auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with
|
|
47
|
-
* auto-delegations, in such case the access level specified here will be used.
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
42
|
+
* auto-delegations, in such case the access level specified here will be used.
|
|
43
|
+
* - preferredSfk: secret id of the patient to use as the secret foreign key to use for the contact. The default value will be a
|
|
44
|
+
* secret id of patient known by the topmost parent in the current data owner hierarchy if the confidential is set to false, else a secret id that
|
|
45
|
+
* the data owner did not share with any of his parents.
|
|
51
46
|
* - confidential: if true, the entity will be created as confidential. Confidential entities are not shared with auto-delegations, and the default
|
|
52
47
|
* foreign key used is any key that is not shared with any of the data owner parents. By default entities are created as non-confidential.
|
|
53
48
|
* @return a new instance of contact.
|
|
54
49
|
*/
|
|
55
50
|
newInstance(user: models.User, patient: models.Patient, c: any, options?: {
|
|
56
51
|
additionalDelegates?: {
|
|
57
|
-
[dataOwnerId: string]:
|
|
52
|
+
[dataOwnerId: string]: AccessLevelEnum;
|
|
58
53
|
};
|
|
59
54
|
preferredSfk?: string;
|
|
60
55
|
confidential?: boolean;
|
|
@@ -98,7 +93,7 @@ export declare class IccContactXApi extends IccContactApi implements EncryptedEn
|
|
|
98
93
|
getContactWithUser(user: models.User, contactId: string): Promise<models.Contact>;
|
|
99
94
|
getContactsWithUser(user: models.User, body?: models.ListOfIds): Promise<Array<models.Contact> | any>;
|
|
100
95
|
modifyContactWithUser(user: models.User, body?: models.Contact): Promise<models.Contact | any>;
|
|
101
|
-
private
|
|
96
|
+
private modifyContactAs;
|
|
102
97
|
modifyContactsWithUser(user: models.User, bodies?: Array<models.Contact>): Promise<models.Contact[] | any>;
|
|
103
98
|
createContactWithUser(user: models.User, body?: models.Contact): Promise<models.Contact | null>;
|
|
104
99
|
createContactsWithUser(user: models.User, bodies?: Array<models.Contact>): Promise<models.Contact[] | null>;
|
|
@@ -170,9 +165,13 @@ export declare class IccContactXApi extends IccContactApi implements EncryptedEn
|
|
|
170
165
|
* in the returned array, but in case of entity merges there could be multiple values.
|
|
171
166
|
*/
|
|
172
167
|
decryptPatientIdOf(contact: models.Contact): Promise<string[]>;
|
|
168
|
+
/**
|
|
169
|
+
* @return if the logged data owner has write access to the content of the given contact
|
|
170
|
+
*/
|
|
171
|
+
hasWriteAccess(contact: models.Contact): Promise<boolean>;
|
|
173
172
|
/**
|
|
174
173
|
* Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also
|
|
175
|
-
* the encrypted content.
|
|
174
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
176
175
|
* @param delegateId the id of the data owner which will be granted access to the contact.
|
|
177
176
|
* @param contact the contact to share.
|
|
178
177
|
* @param options optional parameters to customize the sharing behaviour:
|
|
@@ -181,37 +180,62 @@ export declare class IccContactXApi extends IccContactApi implements EncryptedEn
|
|
|
181
180
|
* contact does not have encrypted content.
|
|
182
181
|
* - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to
|
|
183
182
|
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
184
|
-
*
|
|
183
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
184
|
+
* @return the updated entity
|
|
185
185
|
*/
|
|
186
186
|
shareWith(delegateId: string, contact: models.Contact, options?: {
|
|
187
|
+
requestedPermissions?: RequestedPermissionEnum;
|
|
187
188
|
shareEncryptionKey?: ShareMetadataBehaviour;
|
|
188
189
|
sharePatientId?: ShareMetadataBehaviour;
|
|
189
190
|
}): Promise<models.Contact>;
|
|
190
191
|
/**
|
|
191
192
|
* Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also
|
|
192
|
-
* the encrypted content.
|
|
193
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
193
194
|
* @param contact the contact to share.
|
|
194
|
-
* @param delegates
|
|
195
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
195
196
|
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
196
197
|
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
197
198
|
* contact does not have encrypted content.
|
|
198
199
|
* - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to
|
|
199
200
|
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
200
|
-
*
|
|
201
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
202
|
+
* @return the updated entity
|
|
201
203
|
*/
|
|
202
204
|
shareWithMany(contact: models.Contact, delegates: {
|
|
203
205
|
[delegateId: string]: {
|
|
206
|
+
requestedPermissions?: RequestedPermissionEnum;
|
|
204
207
|
shareEncryptionKey?: ShareMetadataBehaviour;
|
|
205
208
|
sharePatientId?: ShareMetadataBehaviour;
|
|
206
209
|
};
|
|
207
210
|
}): Promise<models.Contact>;
|
|
208
|
-
|
|
211
|
+
/**
|
|
212
|
+
* Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also
|
|
213
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
214
|
+
* @param contact the contact to share.
|
|
215
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
216
|
+
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
217
|
+
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
218
|
+
* contact does not have encrypted content.
|
|
219
|
+
* - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to
|
|
220
|
+
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
221
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
222
|
+
* @return a promise which will contain the result of the operation: the updated entity if the operation was successful or details of the error if
|
|
223
|
+
* the operation failed.
|
|
224
|
+
*/
|
|
225
|
+
tryShareWithMany(contact: models.Contact, delegates: {
|
|
226
|
+
[delegateId: string]: {
|
|
227
|
+
requestedPermissions?: RequestedPermissionEnum;
|
|
228
|
+
shareEncryptionKey?: ShareMetadataBehaviour;
|
|
229
|
+
sharePatientId?: ShareMetadataBehaviour;
|
|
230
|
+
};
|
|
231
|
+
}): Promise<ShareResult<models.Contact>>;
|
|
232
|
+
getDataOwnersWithAccessTo(entity: models.Contact): Promise<{
|
|
209
233
|
permissionsByDataOwnerId: {
|
|
210
|
-
[p: string]:
|
|
234
|
+
[p: string]: AccessLevelEnum;
|
|
211
235
|
};
|
|
212
236
|
hasUnknownAnonymousDataOwners: boolean;
|
|
213
237
|
}>;
|
|
214
|
-
getEncryptionKeysOf(entity: Contact): Promise<string[]>;
|
|
238
|
+
getEncryptionKeysOf(entity: models.Contact): Promise<string[]>;
|
|
215
239
|
subscribeToServiceEvents(eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[], filter: AbstractFilter<Service> | undefined, eventFired: (dataSample: Service) => Promise<void>, options?: SubscriptionOptions): Promise<Connection>;
|
|
216
240
|
subscribeToContactEvents(eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[], filter: AbstractFilter<Contact> | undefined, eventFired: (dataSample: Contact) => Promise<void>, options?: SubscriptionOptions): Promise<Connection>;
|
|
217
241
|
}
|
|
@@ -20,27 +20,23 @@ const binary_utils_1 = require("./utils/binary-utils");
|
|
|
20
20
|
const ServiceByIdsFilter_1 = require("./filters/ServiceByIdsFilter");
|
|
21
21
|
const utils_1 = require("./utils");
|
|
22
22
|
const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
|
|
23
|
-
const
|
|
23
|
+
const SecureDelegation_1 = require("../icc-api/model/SecureDelegation");
|
|
24
|
+
var AccessLevelEnum = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
|
|
24
25
|
const Connection_1 = require("../icc-api/model/Connection");
|
|
25
26
|
class IccContactXApi extends icc_api_1.IccContactApi {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
* @param headers
|
|
30
|
-
* @param crypto
|
|
31
|
-
* @param dataOwnerApi
|
|
32
|
-
* @param authenticationProvider
|
|
33
|
-
* @param fetchImpl
|
|
34
|
-
* @param contactEncryptedKeys custom encrypted fields for Contact. Note that to customise the encryption of contained services (`services` field),
|
|
35
|
-
* you need to use the serviceEncryptedKeys parameter.
|
|
36
|
-
* @param serviceEncryptedKeys custom encrypted fields for Service. Note that you can't customise encryption of the `content` field
|
|
37
|
-
*/
|
|
27
|
+
get headers() {
|
|
28
|
+
return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'Contact'));
|
|
29
|
+
}
|
|
38
30
|
constructor(host, headers, crypto, dataOwnerApi, userApi, authApi, authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
|
|
39
31
|
? window.fetch
|
|
40
32
|
: typeof self !== 'undefined'
|
|
41
33
|
? self.fetch
|
|
42
34
|
: fetch, contactEncryptedKeys = ['descr'], serviceEncryptedKeys = []) {
|
|
43
35
|
super(host, headers, authenticationProvider, fetchImpl);
|
|
36
|
+
this.crypto = crypto;
|
|
37
|
+
this.dataOwnerApi = dataOwnerApi;
|
|
38
|
+
this.userApi = userApi;
|
|
39
|
+
this.authApi = authApi;
|
|
44
40
|
this.i18n = contact_i18n_1.default;
|
|
45
41
|
if (contactEncryptedKeys.some((key) => key.startsWith('services'))) {
|
|
46
42
|
throw new Error("You can't customise encryption of the `services` field of Contact. Use the serviceEncryptedKeys parameter instead.");
|
|
@@ -68,31 +64,30 @@ class IccContactXApi extends icc_api_1.IccContactApi {
|
|
|
68
64
|
* @param options optional parameters:
|
|
69
65
|
* - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
|
|
70
66
|
* auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with
|
|
71
|
-
* auto-delegations, in such case the access level specified here will be used.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
67
|
+
* auto-delegations, in such case the access level specified here will be used.
|
|
68
|
+
* - preferredSfk: secret id of the patient to use as the secret foreign key to use for the contact. The default value will be a
|
|
69
|
+
* secret id of patient known by the topmost parent in the current data owner hierarchy if the confidential is set to false, else a secret id that
|
|
70
|
+
* the data owner did not share with any of his parents.
|
|
75
71
|
* - confidential: if true, the entity will be created as confidential. Confidential entities are not shared with auto-delegations, and the default
|
|
76
72
|
* foreign key used is any key that is not shared with any of the data owner parents. By default entities are created as non-confidential.
|
|
77
73
|
* @return a new instance of contact.
|
|
78
74
|
*/
|
|
79
75
|
newInstance(user, patient, c, options = {}) {
|
|
80
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
76
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
81
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
78
|
const contact = new models.Contact(Object.assign(Object.assign({}, (c !== null && c !== void 0 ? c : {})), { _type: 'org.taktik.icure.entities.Contact', id: (_a = c === null || c === void 0 ? void 0 : c.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = c === null || c === void 0 ? void 0 : c.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = c === null || c === void 0 ? void 0 : c.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), responsible: (_d = c === null || c === void 0 ? void 0 : c.responsible) !== null && _d !== void 0 ? _d : this.dataOwnerApi.getDataOwnerIdOf(user), author: (_e = c === null || c === void 0 ? void 0 : c.author) !== null && _e !== void 0 ? _e : user.id, codes: (_f = c === null || c === void 0 ? void 0 : c.codes) !== null && _f !== void 0 ? _f : [], tags: (_g = c === null || c === void 0 ? void 0 : c.tags) !== null && _g !== void 0 ? _g : [], groupId: (_h = c === null || c === void 0 ? void 0 : c.groupId) !== null && _h !== void 0 ? _h : this.crypto.primitives.randomUuid(), subContacts: (_j = c === null || c === void 0 ? void 0 : c.subContacts) !== null && _j !== void 0 ? _j : [], services: (_k = c === null || c === void 0 ? void 0 : c.services) !== null && _k !== void 0 ? _k : [], openingDate: (_l = c === null || c === void 0 ? void 0 : c.openingDate) !== null && _l !== void 0 ? _l : parseInt(moment().format('YYYYMMDDHHmmss')) }));
|
|
83
79
|
const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
84
80
|
if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
|
|
85
81
|
throw new Error('Can only initialise entities as current data owner.');
|
|
86
|
-
const sfk = (_m = options.preferredSfk) !== null && _m !== void 0 ? _m : (
|
|
87
|
-
? yield this.crypto.confidential.getConfidentialSecretId(patient)
|
|
88
|
-
: yield this.crypto.confidential.getAnySecretIdSharedWithParents(patient));
|
|
82
|
+
const sfk = (_m = options.preferredSfk) !== null && _m !== void 0 ? _m : ((options === null || options === void 0 ? void 0 : options.confidential)
|
|
83
|
+
? yield this.crypto.confidential.getConfidentialSecretId({ entity: patient, type: 'Patient' })
|
|
84
|
+
: yield this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: patient, type: 'Patient' }));
|
|
89
85
|
if (!sfk)
|
|
90
|
-
throw new Error(`Couldn't find any sfk of parent patient ${patient.id} for confidential=${
|
|
91
|
-
const extraDelegations =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const initialisationInfo = yield this.crypto.entities.entityWithInitialisedEncryptedMetadata(contact, patient.id, sfk, true, extraDelegations);
|
|
86
|
+
throw new Error(`Couldn't find any sfk of parent patient ${patient.id} for confidential=${(_o = options.confidential) !== null && _o !== void 0 ? _o : false}`);
|
|
87
|
+
const extraDelegations = Object.assign(Object.assign({}, (options.confidential
|
|
88
|
+
? {}
|
|
89
|
+
: Object.fromEntries([...((_q = (_p = user.autoDelegations) === null || _p === void 0 ? void 0 : _p.all) !== null && _q !== void 0 ? _q : []), ...((_s = (_r = user.autoDelegations) === null || _r === void 0 ? void 0 : _r.medicalInformation) !== null && _s !== void 0 ? _s : [])].map((d) => [d, AccessLevelEnum.WRITE])))), ((_t = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _t !== void 0 ? _t : {}));
|
|
90
|
+
const initialisationInfo = yield this.crypto.xapi.entityWithInitialisedEncryptedMetadata(contact, 'Contact', patient.id, sfk, true, false, extraDelegations);
|
|
96
91
|
return new models.Contact(initialisationInfo.updatedEntity);
|
|
97
92
|
});
|
|
98
93
|
}
|
|
@@ -114,7 +109,7 @@ class IccContactXApi extends icc_api_1.IccContactApi {
|
|
|
114
109
|
*/
|
|
115
110
|
findBy(hcpartyId, patient, usingPost = false) {
|
|
116
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
return yield this.crypto.
|
|
112
|
+
return yield this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: 'Patient' }).then((keysHierarchy) => keysHierarchy && keysHierarchy.length > 0
|
|
118
113
|
? Promise.all(keysHierarchy
|
|
119
114
|
.reduce((acc, level) => {
|
|
120
115
|
return acc.concat([
|
|
@@ -136,7 +131,7 @@ class IccContactXApi extends icc_api_1.IccContactApi {
|
|
|
136
131
|
const perHcpId = {};
|
|
137
132
|
for (const patient of patients) {
|
|
138
133
|
;
|
|
139
|
-
(yield this.crypto.
|
|
134
|
+
(yield this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: 'Patient' }))
|
|
140
135
|
.reduce((acc, level) => {
|
|
141
136
|
return acc.concat([
|
|
142
137
|
{
|
|
@@ -235,11 +230,11 @@ class IccContactXApi extends icc_api_1.IccContactApi {
|
|
|
235
230
|
}
|
|
236
231
|
modifyContactWithUser(user, body) {
|
|
237
232
|
return __awaiter(this, void 0, void 0, function* () {
|
|
238
|
-
return body ? this.
|
|
233
|
+
return body ? this.modifyContactAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : null;
|
|
239
234
|
});
|
|
240
235
|
}
|
|
241
|
-
|
|
242
|
-
return this.encryptAs(dataOwner, [_.cloneDeep(
|
|
236
|
+
modifyContactAs(dataOwner, body) {
|
|
237
|
+
return this.encryptAs(dataOwner, [_.cloneDeep(body)])
|
|
243
238
|
.then((ctcs) => super.modifyContact(ctcs[0]))
|
|
244
239
|
.then((ctc) => this.decrypt(dataOwner, [ctc]))
|
|
245
240
|
.then((ctcs) => ctcs[0]);
|
|
@@ -322,11 +317,14 @@ class IccContactXApi extends icc_api_1.IccContactApi {
|
|
|
322
317
|
encryptAs(hcpartyId, ctcs) {
|
|
323
318
|
const bypassEncryption = false; //Used for debug
|
|
324
319
|
return Promise.all(ctcs.map((ctc) => __awaiter(this, void 0, void 0, function* () {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
320
|
+
let initialisedCtc = ctc;
|
|
321
|
+
if (!bypassEncryption) {
|
|
322
|
+
const contactWithKeys = yield this.crypto.xapi.ensureEncryptionKeysInitialised(ctc, 'Contact');
|
|
323
|
+
if (contactWithKeys) {
|
|
324
|
+
initialisedCtc = contactWithKeys;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
const encryptionKey = yield this.crypto.xapi.decryptAndImportAnyEncryptionKey({ entity: initialisedCtc, type: 'Contact' });
|
|
330
328
|
return new models_1.Contact(yield (0, utils_1.encryptObject)(Object.assign(Object.assign({}, initialisedCtc), { services: initialisedCtc.services ? yield this.encryptServices(encryptionKey.key, encryptionKey.raw, initialisedCtc.services) : [] }), (obj) => {
|
|
331
329
|
return this.crypto.primitives.AES.encrypt(encryptionKey.key, (0, binary_utils_1.utf8_2ua)(JSON.stringify(obj)), encryptionKey.raw);
|
|
332
330
|
}, this.contactEncryptedFields, 'contact'));
|
|
@@ -334,25 +332,31 @@ class IccContactXApi extends icc_api_1.IccContactApi {
|
|
|
334
332
|
}
|
|
335
333
|
decrypt(hcpartyId, ctcs) {
|
|
336
334
|
return Promise.all(ctcs.map((ctc) => __awaiter(this, void 0, void 0, function* () {
|
|
337
|
-
const keys = yield this.crypto.
|
|
335
|
+
const keys = yield this.crypto.xapi.decryptAndImportAllDecryptionKeys({ entity: ctc, type: 'Contact' });
|
|
338
336
|
if (!keys || !keys.length) {
|
|
339
337
|
console.log('Cannot decrypt contact', ctc.id);
|
|
340
338
|
return ctc;
|
|
341
339
|
}
|
|
342
340
|
return new models_1.Contact(yield (0, utils_1.decryptObject)(ctc, (encrypted) => __awaiter(this, void 0, void 0, function* () {
|
|
343
341
|
var _a;
|
|
344
|
-
return (_a = (yield this.crypto.
|
|
342
|
+
return (_a = (yield this.crypto.xapi.tryDecryptJson(keys, encrypted, false))) !== null && _a !== void 0 ? _a : {};
|
|
345
343
|
})));
|
|
346
344
|
})));
|
|
347
345
|
}
|
|
348
346
|
decryptServices(hcpartyId, svcs, keys) {
|
|
347
|
+
const contactKeysCache = {};
|
|
349
348
|
return Promise.all(svcs.map((svc) => __awaiter(this, void 0, void 0, function* () {
|
|
350
|
-
|
|
351
|
-
|
|
349
|
+
let currentKeys = keys !== null && keys !== void 0 ? keys : (svc.contactId ? contactKeysCache[svc.contactId] : undefined);
|
|
350
|
+
if (!currentKeys) {
|
|
351
|
+
const decryptedKeys = yield this.crypto.xapi.decryptAndImportAllDecryptionKeys({ entity: svc, type: 'Contact' });
|
|
352
|
+
if (svc.contactId) {
|
|
353
|
+
contactKeysCache[svc.contactId] = decryptedKeys;
|
|
354
|
+
}
|
|
355
|
+
currentKeys = decryptedKeys;
|
|
352
356
|
}
|
|
353
357
|
return new models_1.Service(yield (0, utils_1.decryptObject)(svc, (encrypted) => __awaiter(this, void 0, void 0, function* () {
|
|
354
358
|
var _a;
|
|
355
|
-
return (_a = (yield this.crypto.
|
|
359
|
+
return (_a = (yield this.crypto.xapi.tryDecryptJson(keys, encrypted, false))) !== null && _a !== void 0 ? _a : {};
|
|
356
360
|
})));
|
|
357
361
|
})));
|
|
358
362
|
}
|
|
@@ -718,12 +722,20 @@ class IccContactXApi extends icc_api_1.IccContactApi {
|
|
|
718
722
|
*/
|
|
719
723
|
decryptPatientIdOf(contact) {
|
|
720
724
|
return __awaiter(this, void 0, void 0, function* () {
|
|
721
|
-
return this.crypto.
|
|
725
|
+
return this.crypto.xapi.owningEntityIdsOf({ entity: contact, type: 'Contact' }, undefined);
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* @return if the logged data owner has write access to the content of the given contact
|
|
730
|
+
*/
|
|
731
|
+
hasWriteAccess(contact) {
|
|
732
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
733
|
+
return this.crypto.xapi.hasWriteAccess({ entity: contact, type: 'Contact' });
|
|
722
734
|
});
|
|
723
735
|
}
|
|
724
736
|
/**
|
|
725
737
|
* Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also
|
|
726
|
-
* the encrypted content.
|
|
738
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
727
739
|
* @param delegateId the id of the data owner which will be granted access to the contact.
|
|
728
740
|
* @param contact the contact to share.
|
|
729
741
|
* @param options optional parameters to customize the sharing behaviour:
|
|
@@ -732,7 +744,8 @@ class IccContactXApi extends icc_api_1.IccContactApi {
|
|
|
732
744
|
* contact does not have encrypted content.
|
|
733
745
|
* - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to
|
|
734
746
|
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
735
|
-
*
|
|
747
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
748
|
+
* @return the updated entity
|
|
736
749
|
*/
|
|
737
750
|
shareWith(delegateId, contact, options = {}) {
|
|
738
751
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -741,53 +754,71 @@ class IccContactXApi extends icc_api_1.IccContactApi {
|
|
|
741
754
|
}
|
|
742
755
|
/**
|
|
743
756
|
* Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also
|
|
744
|
-
* the encrypted content.
|
|
757
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
745
758
|
* @param contact the contact to share.
|
|
746
|
-
* @param delegates
|
|
759
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
747
760
|
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
748
761
|
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
749
762
|
* contact does not have encrypted content.
|
|
750
763
|
* - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to
|
|
751
764
|
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
752
|
-
*
|
|
765
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
766
|
+
* @return the updated entity
|
|
753
767
|
*/
|
|
754
768
|
shareWithMany(contact, delegates) {
|
|
769
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
770
|
+
return (yield this.tryShareWithMany(contact, delegates)).updatedEntityOrThrow;
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also
|
|
775
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
776
|
+
* @param contact the contact to share.
|
|
777
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
778
|
+
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
779
|
+
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
780
|
+
* contact does not have encrypted content.
|
|
781
|
+
* - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to
|
|
782
|
+
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
783
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
784
|
+
* @return a promise which will contain the result of the operation: the updated entity if the operation was successful or details of the error if
|
|
785
|
+
* the operation failed.
|
|
786
|
+
*/
|
|
787
|
+
tryShareWithMany(contact, delegates) {
|
|
755
788
|
return __awaiter(this, void 0, void 0, function* () {
|
|
756
789
|
const self = yield this.dataOwnerApi.getCurrentDataOwnerId();
|
|
757
|
-
|
|
790
|
+
// All entities should have an encryption key.
|
|
791
|
+
const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(contact, 'Contact');
|
|
792
|
+
const updatedEntity = entityWithEncryptionKey ? yield this.modifyContactAs(self, entityWithEncryptionKey) : contact;
|
|
793
|
+
return this.crypto.xapi
|
|
794
|
+
.simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type: 'Contact' }, true, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
|
|
758
795
|
delegateId,
|
|
759
796
|
{
|
|
760
|
-
|
|
797
|
+
requestedPermissions: options.requestedPermissions,
|
|
798
|
+
shareEncryptionKeys: options.shareEncryptionKey,
|
|
761
799
|
shareOwningEntityIds: options.sharePatientId,
|
|
800
|
+
shareSecretIds: undefined,
|
|
762
801
|
},
|
|
763
|
-
])))
|
|
764
|
-
|
|
765
|
-
return yield this.modifyAs(self, extended);
|
|
766
|
-
}
|
|
767
|
-
else
|
|
768
|
-
return contact;
|
|
802
|
+
])), (x) => this.bulkShareContacts(x))
|
|
803
|
+
.then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])));
|
|
769
804
|
});
|
|
770
805
|
}
|
|
771
806
|
getDataOwnersWithAccessTo(entity) {
|
|
772
|
-
return
|
|
773
|
-
return yield this.crypto.entities.getDataOwnersWithAccessTo(entity);
|
|
774
|
-
});
|
|
807
|
+
return this.crypto.xapi.getDataOwnersWithAccessTo({ entity, type: 'Contact' });
|
|
775
808
|
}
|
|
776
809
|
getEncryptionKeysOf(entity) {
|
|
777
|
-
return
|
|
778
|
-
return yield this.crypto.entities.encryptionKeysOf(entity);
|
|
779
|
-
});
|
|
810
|
+
return this.crypto.xapi.encryptionKeysOf({ entity, type: 'Contact' }, undefined);
|
|
780
811
|
}
|
|
781
812
|
subscribeToServiceEvents(eventTypes, filter, eventFired, options = {}) {
|
|
782
813
|
return __awaiter(this, void 0, void 0, function* () {
|
|
783
814
|
const currentUser = yield this.userApi.getCurrentUser();
|
|
784
|
-
return (0,
|
|
815
|
+
return (0, utils_1.subscribeToEntityEvents)(this.host, this.authApi, 'Service', eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decryptServices(currentUser.healthcarePartyId, [encrypted]))[0]; })).then((ws) => new Connection_1.ConnectionImpl(ws));
|
|
785
816
|
});
|
|
786
817
|
}
|
|
787
818
|
subscribeToContactEvents(eventTypes, filter, eventFired, options = {}) {
|
|
788
819
|
return __awaiter(this, void 0, void 0, function* () {
|
|
789
820
|
const currentUser = yield this.userApi.getCurrentUser();
|
|
790
|
-
return (0,
|
|
821
|
+
return (0, utils_1.subscribeToEntityEvents)(this.host, this.authApi, 'Contact', eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decrypt(currentUser.healthcarePartyId, [encrypted]))[0]; })).then((ws) => new Connection_1.ConnectionImpl(ws));
|
|
791
822
|
});
|
|
792
823
|
}
|
|
793
824
|
}
|