@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
|
@@ -12,14 +12,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.IccMaintenanceTaskXApi = void 0;
|
|
13
13
|
const IccMaintenanceTaskApi_1 = require("../icc-api/api/IccMaintenanceTaskApi");
|
|
14
14
|
const models = require("../icc-api/model/models");
|
|
15
|
-
const models_1 = require("../icc-api/model/models");
|
|
16
15
|
const _ = require("lodash");
|
|
16
|
+
const models_1 = require("../icc-api/model/models");
|
|
17
17
|
const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
|
|
18
|
+
const SecureDelegation_1 = require("../icc-api/model/SecureDelegation");
|
|
19
|
+
var AccessLevelEnum = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
|
|
20
|
+
const ShareMetadataBehaviour_1 = require("./crypto/ShareMetadataBehaviour");
|
|
18
21
|
const utils_1 = require("./utils");
|
|
19
22
|
const Connection_1 = require("../icc-api/model/Connection");
|
|
20
|
-
const websocket_1 = require("./utils/websocket");
|
|
21
23
|
class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi_1.IccMaintenanceTaskApi {
|
|
22
|
-
|
|
24
|
+
get headers() {
|
|
25
|
+
return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'MaintenanceTask'));
|
|
26
|
+
}
|
|
27
|
+
constructor(host, headers, crypto, hcPartyApi, dataOwnerApi, userApi, authApi, encryptedKeys = [], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
|
|
23
28
|
? window.fetch
|
|
24
29
|
: typeof self !== 'undefined'
|
|
25
30
|
? self.fetch
|
|
@@ -28,9 +33,9 @@ class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi_1.IccMaintenanceTaskA
|
|
|
28
33
|
this.crypto = crypto;
|
|
29
34
|
this.hcPartyApi = hcPartyApi;
|
|
30
35
|
this.dataOwnerApi = dataOwnerApi;
|
|
31
|
-
this.encryptedFields = (0, utils_1.parseEncryptedFields)(encryptedKeys, 'MaintenanceTask.');
|
|
32
36
|
this.userApi = userApi;
|
|
33
37
|
this.authApi = authApi;
|
|
38
|
+
this.encryptedFields = (0, utils_1.parseEncryptedFields)(encryptedKeys, 'MaintenanceTask.');
|
|
34
39
|
}
|
|
35
40
|
/**
|
|
36
41
|
* Creates a new instance of maintenance task with initialised encryption metadata (not in the database).
|
|
@@ -40,8 +45,7 @@ class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi_1.IccMaintenanceTaskA
|
|
|
40
45
|
* @param options optional parameters:
|
|
41
46
|
* - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
|
|
42
47
|
* 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
|
|
43
|
-
* auto-delegations, in such case the access level specified here will be used.
|
|
44
|
-
* access will be possible.
|
|
48
|
+
* auto-delegations, in such case the access level specified here will be used.
|
|
45
49
|
* @return a new instance of maintenance task.
|
|
46
50
|
*/
|
|
47
51
|
newInstance(user, m, options = {}) {
|
|
@@ -49,9 +53,9 @@ class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi_1.IccMaintenanceTaskA
|
|
|
49
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
54
|
const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
51
55
|
const maintenanceTask = Object.assign(Object.assign({}, (m !== null && m !== void 0 ? m : {})), { _type: 'org.taktik.icure.entities.MaintenanceTask', id: (_a = m === null || m === void 0 ? void 0 : m.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = m === null || m === void 0 ? void 0 : m.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = m === null || m === void 0 ? void 0 : m.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), responsible: (_d = m === null || m === void 0 ? void 0 : m.responsible) !== null && _d !== void 0 ? _d : dataOwnerId, author: (_e = m === null || m === void 0 ? void 0 : m.author) !== null && _e !== void 0 ? _e : user.id });
|
|
52
|
-
const extraDelegations =
|
|
53
|
-
return new models.MaintenanceTask(yield this.crypto.
|
|
54
|
-
.entityWithInitialisedEncryptedMetadata(maintenanceTask, undefined, undefined, true, extraDelegations)
|
|
56
|
+
const extraDelegations = Object.assign(Object.assign({}, Object.fromEntries(((_g = (_f = user.autoDelegations) === null || _f === void 0 ? void 0 : _f.all) !== null && _g !== void 0 ? _g : []).map((d) => [d, AccessLevelEnum.WRITE]))), ((_h = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _h !== void 0 ? _h : {}));
|
|
57
|
+
return new models.MaintenanceTask(yield this.crypto.xapi
|
|
58
|
+
.entityWithInitialisedEncryptedMetadata(maintenanceTask, 'MaintenanceTask', undefined, undefined, true, false, extraDelegations)
|
|
55
59
|
.then((x) => x.updatedEntity));
|
|
56
60
|
});
|
|
57
61
|
}
|
|
@@ -93,36 +97,47 @@ class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi_1.IccMaintenanceTaskA
|
|
|
93
97
|
throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption');
|
|
94
98
|
}
|
|
95
99
|
modifyMaintenanceTaskWithUser(user, body) {
|
|
96
|
-
return body ? this.
|
|
100
|
+
return body ? this.modifyMaintenanceTaskAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : Promise.resolve(null);
|
|
97
101
|
}
|
|
98
|
-
|
|
102
|
+
modifyMaintenanceTaskAs(dataOwner, body) {
|
|
99
103
|
return this.encryptAs(dataOwner, [_.cloneDeep(body)])
|
|
100
104
|
.then((encTasks) => super.modifyMaintenanceTask(encTasks[0]))
|
|
101
105
|
.then((mt) => this.decryptAs(dataOwner, [mt]))
|
|
102
106
|
.then((mts) => mts[0]);
|
|
103
107
|
}
|
|
104
108
|
encrypt(user, maintenanceTasks) {
|
|
105
|
-
|
|
109
|
+
const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
110
|
+
return this.encryptAs(dataOwnerId, maintenanceTasks);
|
|
106
111
|
}
|
|
107
|
-
encryptAs(
|
|
108
|
-
return Promise.all(maintenanceTasks.map((m) => this.crypto.
|
|
112
|
+
encryptAs(dataOwner, maintenanceTasks) {
|
|
113
|
+
return Promise.all(maintenanceTasks.map((m) => this.crypto.xapi.tryEncryptEntity(m, 'MaintenanceTask', this.encryptedFields, true, false, (x) => new models.MaintenanceTask(x))));
|
|
109
114
|
}
|
|
110
115
|
decrypt(user, maintenanceTasks) {
|
|
111
|
-
|
|
116
|
+
const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
117
|
+
return this.decryptAs(dataOwnerId, maintenanceTasks);
|
|
118
|
+
}
|
|
119
|
+
decryptAs(dataOwner, maintenanceTasks) {
|
|
120
|
+
return Promise.all(maintenanceTasks.map((mT) => __awaiter(this, void 0, void 0, function* () { return this.crypto.xapi.decryptEntity(mT, 'MaintenanceTask', (x) => new models_1.MaintenanceTask(x)).then(({ entity }) => entity); })));
|
|
112
121
|
}
|
|
113
|
-
|
|
114
|
-
|
|
122
|
+
/**
|
|
123
|
+
* @return if the logged data owner has write access to the content of the given maintenance task
|
|
124
|
+
*/
|
|
125
|
+
hasWriteAccess(maintenanceTask) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
return this.crypto.xapi.hasWriteAccess({ entity: maintenanceTask, type: 'MaintenanceTask' });
|
|
128
|
+
});
|
|
115
129
|
}
|
|
116
130
|
/**
|
|
117
131
|
* Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also
|
|
118
|
-
* the encrypted content.
|
|
132
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
119
133
|
* @param delegateId the id of the data owner which will be granted access to the maintenance task.
|
|
120
134
|
* @param maintenanceTask the maintenance task to share.
|
|
121
135
|
* @param options optional parameters to customize the sharing behaviour:
|
|
122
136
|
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
123
137
|
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
124
138
|
* maintenance task does not have encrypted content.
|
|
125
|
-
*
|
|
139
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
140
|
+
* @return the updated entity
|
|
126
141
|
*/
|
|
127
142
|
shareWith(delegateId, maintenanceTask, options = {}) {
|
|
128
143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -131,39 +146,61 @@ class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi_1.IccMaintenanceTaskA
|
|
|
131
146
|
}
|
|
132
147
|
/**
|
|
133
148
|
* Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also
|
|
134
|
-
* the encrypted content.
|
|
149
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
135
150
|
* @param maintenanceTask the maintenance task to share.
|
|
136
|
-
* @param delegates
|
|
151
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
137
152
|
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
138
153
|
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
139
154
|
* maintenance task does not have encrypted content.
|
|
140
|
-
*
|
|
155
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
156
|
+
* @return the updated entity.
|
|
141
157
|
*/
|
|
142
158
|
shareWithMany(maintenanceTask, delegates) {
|
|
143
159
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
|
|
145
|
-
const extended = yield this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(maintenanceTask, true, delegates);
|
|
146
|
-
if (!!extended) {
|
|
147
|
-
return yield this.modifyAs(self, extended);
|
|
148
|
-
}
|
|
149
|
-
else
|
|
150
|
-
return maintenanceTask;
|
|
160
|
+
return (yield this.tryShareWithMany(maintenanceTask, delegates)).updatedEntityOrThrow;
|
|
151
161
|
});
|
|
152
162
|
}
|
|
153
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also
|
|
165
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
166
|
+
* @param maintenanceTask the maintenance task to share.
|
|
167
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
168
|
+
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
169
|
+
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
170
|
+
* maintenance task does not have encrypted content.
|
|
171
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
172
|
+
* @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
|
|
173
|
+
* the operation failed.
|
|
174
|
+
*/
|
|
175
|
+
tryShareWithMany(maintenanceTask, delegates) {
|
|
154
176
|
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
-
|
|
177
|
+
const self = yield this.dataOwnerApi.getCurrentDataOwnerId();
|
|
178
|
+
// All entities should have an encryption key.
|
|
179
|
+
const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(maintenanceTask, 'MaintenanceTask');
|
|
180
|
+
const updatedEntity = entityWithEncryptionKey ? yield this.modifyMaintenanceTaskAs(self, entityWithEncryptionKey) : maintenanceTask;
|
|
181
|
+
return this.crypto.xapi
|
|
182
|
+
.simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type: 'MaintenanceTask' }, true, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
|
|
183
|
+
delegateId,
|
|
184
|
+
{
|
|
185
|
+
requestedPermissions: options.requestedPermissions,
|
|
186
|
+
shareEncryptionKeys: options.shareEncryptionKey,
|
|
187
|
+
shareOwningEntityIds: ShareMetadataBehaviour_1.ShareMetadataBehaviour.NEVER,
|
|
188
|
+
shareSecretIds: undefined,
|
|
189
|
+
},
|
|
190
|
+
])), (x) => this.bulkShareMaintenanceTask(x))
|
|
191
|
+
.then((r) => r.mapSuccessAsync((e) => this.decryptAs(self, [e]).then((es) => es[0])));
|
|
156
192
|
});
|
|
157
193
|
}
|
|
194
|
+
getDataOwnersWithAccessTo(entity) {
|
|
195
|
+
return this.crypto.xapi.getDataOwnersWithAccessTo({ entity, type: 'MaintenanceTask' });
|
|
196
|
+
}
|
|
158
197
|
getEncryptionKeysOf(entity) {
|
|
159
|
-
return
|
|
160
|
-
return yield this.crypto.entities.encryptionKeysOf(entity);
|
|
161
|
-
});
|
|
198
|
+
return this.crypto.xapi.encryptionKeysOf({ entity, type: 'MaintenanceTask' }, undefined);
|
|
162
199
|
}
|
|
163
200
|
subscribeToMaintenanceTaskEvents(eventTypes, filter, eventFired, options = {}) {
|
|
164
201
|
return __awaiter(this, void 0, void 0, function* () {
|
|
165
202
|
const currentUser = yield this.userApi.getCurrentUser();
|
|
166
|
-
return (0,
|
|
203
|
+
return (0, utils_1.subscribeToEntityEvents)(this.host, this.authApi, 'MaintenanceTask', 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));
|
|
167
204
|
});
|
|
168
205
|
}
|
|
169
206
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-maintenance-task-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-maintenance-task-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gFAA4E;AAE5E,kDAAiD;AACjD,oDAAwE;AACxE,4BAA2B;AAG3B,0EAAgG;AAGhG,mCAA0F;AAE1F,4DAAsE;AACtE,iDAAyD;AAIzD,MAAa,sBAAuB,SAAQ,6CAAqB;IAS/D,YACE,IAAY,EACZ,OAAkC,EAClC,MAAqB,EACrB,UAA0B,EAC1B,YAA8B,EAC9B,OAAoB,EACpB,OAAmB,EACnB,gBAA+B,CAAC,YAAY,CAAC,EAC7C,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,KAAK;QAET,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAA;QACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAChC,IAAI,CAAC,eAAe,GAAG,IAAA,4BAAoB,EAAC,aAAa,EAAE,kBAAkB,CAAC,CAAA;QAC9E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;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AAA,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,GAAA,CACvE,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,2BAAc,CAAC,EAAE,CAAC,CAAC,CAAA;QACxC,CAAC;KAAA;CACF;AAzOD,wDAyOC","sourcesContent":["import { IccMaintenanceTaskApi } from '../icc-api/api/IccMaintenanceTaskApi'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport * as models from '../icc-api/model/models'\nimport { DocIdentifier, MaintenanceTask } from '../icc-api/model/models'\nimport * as _ from 'lodash'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport {EncryptedFieldsManifest, parseEncryptedFields, SubscriptionOptions} from './utils'\nimport {AbstractFilter} from \"./filters/filters\"\nimport {Connection, ConnectionImpl} from \"../icc-api/model/Connection\"\nimport {subscribeToEntityEvents} from \"./utils/websocket\"\nimport {IccUserXApi} from \"./icc-user-x-api\"\nimport {IccAuthApi} from \"../icc-api\"\n\nexport class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi implements EncryptedEntityXApi<models.MaintenanceTask> {\n crypto: IccCryptoXApi\n hcPartyApi: IccHcpartyXApi\n dataOwnerApi: IccDataOwnerXApi\n private readonly userApi: IccUserXApi\n private readonly authApi: IccAuthApi\n\n private readonly encryptedFields: EncryptedFieldsManifest\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n hcPartyApi: IccHcpartyXApi,\n dataOwnerApi: IccDataOwnerXApi,\n userApi: IccUserXApi,\n authApi: IccAuthApi,\n encryptedKeys: Array<string> = ['properties'],\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.crypto = crypto\n this.hcPartyApi = hcPartyApi\n this.dataOwnerApi = dataOwnerApi\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'MaintenanceTask.')\n this.userApi = userApi\n this.authApi = authApi\n }\n\n /**\n * Creates a new instance of maintenance task with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param m initialised data for the maintenance task. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * 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\n * auto-delegations, in such case the access level specified here will be used. Currently only WRITE access is supported, but in future also read\n * access will be possible.\n * @return a new instance of maintenance task.\n */\n async newInstance(\n user: models.User,\n m: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: 'WRITE' }\n } = {}\n ) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n const maintenanceTask = {\n ...(m ?? {}),\n _type: 'org.taktik.icure.entities.MaintenanceTask',\n id: m?.id ?? this.crypto.primitives.randomUuid(),\n created: m?.created ?? new Date().getTime(),\n modified: m?.modified ?? new Date().getTime(),\n responsible: m?.responsible ?? dataOwnerId,\n author: m?.author ?? user.id,\n }\n\n const extraDelegations = [...Object.keys(options.additionalDelegates ?? {}), ...(user.autoDelegations?.all ?? [])]\n return new models.MaintenanceTask(\n await this.crypto.entities\n .entityWithInitialisedEncryptedMetadata(maintenanceTask, undefined, undefined, true, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n createMaintenanceTask(body?: models.MaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n createMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | null> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((tasks) => super.createMaintenanceTask(tasks[0]))\n .then((mt) => this.decrypt(user, [mt]))\n .then((tasks) => tasks[0])\n : Promise.resolve(null)\n }\n\n filterMaintenanceTasksBy(startDocumentId?: string, limit?: number, body?: models.FilterChainMaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n deleteMaintenanceTask(_maintenanceTaskIds: string): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n deleteMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<Array<DocIdentifier>> | never {\n return super.deleteMaintenanceTask(maintenanceTaskId)\n }\n\n filterMaintenanceTasksByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainMaintenanceTask\n ): Promise<models.PaginatedListMaintenanceTask> {\n return super\n .filterMaintenanceTasksBy(startDocumentId, limit, body)\n .then((pl) => this.decrypt(user, pl.rows!).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n getMaintenanceTask(maintenanceTaskId: string): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n getMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<models.MaintenanceTask | any> {\n return super\n .getMaintenanceTask(maintenanceTaskId)\n .then((mt) => this.decrypt(user, [mt]))\n .then((mts) => mts[0])\n }\n\n modifyMaintenanceTask(body?: models.MaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n modifyMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | any> {\n return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : Promise.resolve(null)\n }\n\n private modifyAs(dataOwner: string, body: models.MaintenanceTask): Promise<models.MaintenanceTask | any> {\n return this.encryptAs(dataOwner, [_.cloneDeep(body)])\n .then((encTasks) => super.modifyMaintenanceTask(encTasks[0]))\n .then((mt) => this.decryptAs(dataOwner, [mt]))\n .then((mts) => mts[0])\n }\n\n encrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n return this.encryptAs(this.dataOwnerApi.getDataOwnerIdOf(user), maintenanceTasks)\n }\n\n private encryptAs(dataOwnerId: string, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n return Promise.all(\n maintenanceTasks.map((m) =>\n this.crypto.entities.tryEncryptEntity(m, dataOwnerId, this.encryptedFields, true, true, (x) => new models.MaintenanceTask(x))\n )\n )\n }\n\n decrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n return this.decryptAs(this.dataOwnerApi.getDataOwnerIdOf(user), maintenanceTasks)\n }\n\n private decryptAs(dataOwnerId: string, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n return Promise.all(\n maintenanceTasks.map(async (mT) =>\n this.crypto.entities.decryptEntity(mT, dataOwnerId, (x) => new MaintenanceTask(x)).then(({ entity }) => entity)\n )\n )\n }\n\n /**\n * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also\n * the encrypted content.\n * @param delegateId the id of the data owner which will be granted access to the maintenance task.\n * @param maintenanceTask the maintenance task to share.\n * @param options optional parameters to customize the sharing behaviour:\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * maintenance task does not have encrypted content.\n * @return a promise which will contain the updated maintenance task\n */\n async shareWith(\n delegateId: string,\n maintenanceTask: models.MaintenanceTask,\n options: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.MaintenanceTask> {\n return this.shareWithMany(maintenanceTask, { [delegateId]: options })\n }\n\n /**\n * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also\n * the encrypted content.\n * @param maintenanceTask the maintenance task to share.\n * @param delegates sharing options for each delegate.\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * maintenance task does not have encrypted content.\n * @return a promise which will contain the updated maintenance task\n */\n async shareWithMany(\n maintenanceTask: models.MaintenanceTask,\n delegates: {\n [delegateId: string]: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.MaintenanceTask> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n const extended = await this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(maintenanceTask, true, delegates)\n if (!!extended) {\n return await this.modifyAs(self, extended)\n } else return maintenanceTask\n }\n\n async getDataOwnersWithAccessTo(\n entity: MaintenanceTask\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: 'WRITE' }; hasUnknownAnonymousDataOwners: boolean }> {\n return await this.crypto.entities.getDataOwnersWithAccessTo(entity)\n }\n\n async getEncryptionKeysOf(entity: MaintenanceTask): Promise<string[]> {\n return await this.crypto.entities.encryptionKeysOf(entity)\n }\n\n async subscribeToMaintenanceTaskEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<MaintenanceTask>,\n eventFired: (dataSample: MaintenanceTask) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n const currentUser = await this.userApi.getCurrentUser()\n\n return subscribeToEntityEvents(\n this.host,\n this.authApi,\n 'MaintenanceTask',\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted) => (await this.decrypt(currentUser, [encrypted]))[0]\n ).then((rs) => new ConnectionImpl(rs))\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"icc-maintenance-task-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-maintenance-task-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gFAA4E;AAE5E,kDAAiD;AACjD,4BAA2B;AAE3B,oDAAwE;AAExE,0EAAgG;AAChG,wEAAoE;AACpE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AACzD,4EAAwE;AAKxE,mCAAqH;AAKrH,4DAAwE;AAExE,MAAa,sBAAuB,SAAQ,6CAAqB;IAG/D,IAAI,OAAO;QACT,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,2BAA2B,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAA;IAC1H,CAAC;IAED,YACE,IAAY,EACZ,OAAkC,EACjB,MAAqB,EACrB,UAA0B,EAC1B,YAA8B,EAC9B,OAAoB,EACpB,OAAmB,EACpC,gBAA+B,EAAE,EACjC,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,KAAK;QAET,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAA;QAbtC,WAAM,GAAN,MAAM,CAAe;QACrB,eAAU,GAAV,UAAU,CAAgB;QAC1B,iBAAY,GAAZ,YAAY,CAAkB;QAC9B,YAAO,GAAP,OAAO,CAAa;QACpB,YAAO,GAAP,OAAO,CAAY;QAUpC,IAAI,CAAC,eAAe,GAAG,IAAA,4BAAoB,EAAC,aAAa,EAAE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,CAAC,cAAc,EAAE,CAAA;YAEvD,OAAO,IAAA,+BAAuB,EAC5B,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ,iBAAiB,EACjB,UAAU,EACV,MAAM,EACN,UAAU,EACV,OAAO,EACP,CAAO,SAAS,EAAE,EAAE,gDAAC,OAAA,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,GAAA,CACvE,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,2BAAc,CAAC,EAAE,CAAC,CAAC,CAAA;QACxC,CAAC;KAAA;CACF;AA1RD,wDA0RC","sourcesContent":["import { IccMaintenanceTaskApi } from '../icc-api/api/IccMaintenanceTaskApi'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport * as models from '../icc-api/model/models'\nimport * as _ from 'lodash'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { DocIdentifier, MaintenanceTask } from '../icc-api/model/models'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { ShareResult } from './utils/ShareResult'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedFieldsManifest, parseEncryptedFields, subscribeToEntityEvents, SubscriptionOptions } from './utils'\nimport { IccUserXApi } from '@icure/apiV6'\nimport { IccAuthApi } from '../icc-api'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { AbstractFilter } from './filters/filters'\nimport { Connection, ConnectionImpl } from '../icc-api/model/Connection'\n\nexport class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi implements EncryptedEntityXApi<models.MaintenanceTask> {\n private readonly encryptedFields: EncryptedFieldsManifest\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'MaintenanceTask'))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private readonly crypto: IccCryptoXApi,\n private readonly hcPartyApi: IccHcpartyXApi,\n private readonly dataOwnerApi: IccDataOwnerXApi,\n private readonly userApi: IccUserXApi,\n private readonly authApi: IccAuthApi,\n encryptedKeys: Array<string> = [],\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'MaintenanceTask.')\n }\n\n /**\n * Creates a new instance of maintenance task with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param m initialised data for the maintenance task. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * 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\n * auto-delegations, in such case the access level specified here will be used.\n * @return a new instance of maintenance task.\n */\n async newInstance(\n user: models.User,\n m: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n } = {}\n ) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n const maintenanceTask = {\n ...(m ?? {}),\n _type: 'org.taktik.icure.entities.MaintenanceTask',\n id: m?.id ?? this.crypto.primitives.randomUuid(),\n created: m?.created ?? new Date().getTime(),\n modified: m?.modified ?? new Date().getTime(),\n responsible: m?.responsible ?? dataOwnerId,\n author: m?.author ?? user.id,\n }\n\n const extraDelegations = {\n ...Object.fromEntries((user.autoDelegations?.all ?? []).map((d) => [d, AccessLevelEnum.WRITE])),\n ...(options?.additionalDelegates ?? {}),\n }\n return new models.MaintenanceTask(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(maintenanceTask, 'MaintenanceTask', undefined, undefined, true, false, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n createMaintenanceTask(body?: models.MaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n createMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | null> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((tasks) => super.createMaintenanceTask(tasks[0]))\n .then((mt) => this.decrypt(user, [mt]))\n .then((tasks) => tasks[0])\n : Promise.resolve(null)\n }\n\n filterMaintenanceTasksBy(startDocumentId?: string, limit?: number, body?: models.FilterChainMaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n deleteMaintenanceTask(_maintenanceTaskIds: string): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n deleteMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<Array<DocIdentifier>> | never {\n return super.deleteMaintenanceTask(maintenanceTaskId)\n }\n\n filterMaintenanceTasksByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainMaintenanceTask\n ): Promise<models.PaginatedListMaintenanceTask> {\n return super\n .filterMaintenanceTasksBy(startDocumentId, limit, body)\n .then((pl) => this.decrypt(user, pl.rows!).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n getMaintenanceTask(maintenanceTaskId: string): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n getMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<models.MaintenanceTask | any> {\n return super\n .getMaintenanceTask(maintenanceTaskId)\n .then((mt) => this.decrypt(user, [mt]))\n .then((mts) => mts[0])\n }\n\n modifyMaintenanceTask(body?: models.MaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n modifyMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | any> {\n return body ? this.modifyMaintenanceTaskAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : Promise.resolve(null)\n }\n\n private modifyMaintenanceTaskAs(dataOwner: string, body: models.MaintenanceTask): Promise<models.MaintenanceTask> {\n return this.encryptAs(dataOwner, [_.cloneDeep(body)])\n .then((encTasks) => super.modifyMaintenanceTask(encTasks[0]))\n .then((mt) => this.decryptAs(dataOwner, [mt]))\n .then((mts) => mts[0])\n }\n\n encrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n return this.encryptAs(dataOwnerId, maintenanceTasks)\n }\n\n private encryptAs(dataOwner: string, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n return Promise.all(\n maintenanceTasks.map((m) =>\n this.crypto.xapi.tryEncryptEntity(m, 'MaintenanceTask', this.encryptedFields, true, false, (x) => new models.MaintenanceTask(x))\n )\n )\n }\n\n decrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n return this.decryptAs(dataOwnerId, maintenanceTasks)\n }\n\n private decryptAs(dataOwner: string, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n return Promise.all(\n maintenanceTasks.map(async (mT) =>\n this.crypto.xapi.decryptEntity(mT, 'MaintenanceTask', (x) => new MaintenanceTask(x)).then(({ entity }) => entity)\n )\n )\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given maintenance task\n */\n async hasWriteAccess(maintenanceTask: models.MaintenanceTask): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: maintenanceTask, type: 'MaintenanceTask' })\n }\n\n /**\n * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param delegateId the id of the data owner which will be granted access to the maintenance task.\n * @param maintenanceTask the maintenance task to share.\n * @param options optional parameters to customize the sharing behaviour:\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * maintenance task does not have encrypted content.\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWith(\n delegateId: string,\n maintenanceTask: models.MaintenanceTask,\n options: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.MaintenanceTask> {\n return this.shareWithMany(maintenanceTask, { [delegateId]: options })\n }\n\n /**\n * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param maintenanceTask the maintenance task to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * maintenance task does not have encrypted content.\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity.\n */\n async shareWithMany(\n maintenanceTask: models.MaintenanceTask,\n delegates: {\n [delegateId: string]: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.MaintenanceTask> {\n return (await this.tryShareWithMany(maintenanceTask, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing maintenance task with other data owners, allowing them to access the non-encrypted data of the maintenance task and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param maintenanceTask the maintenance task to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * maintenance task does not have encrypted content.\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @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\n * the operation failed.\n */\n async tryShareWithMany(\n maintenanceTask: models.MaintenanceTask,\n delegates: {\n [delegateId: string]: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.MaintenanceTask>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(maintenanceTask, 'MaintenanceTask')\n const updatedEntity = entityWithEncryptionKey ? await this.modifyMaintenanceTaskAs(self, entityWithEncryptionKey) : maintenanceTask\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n { entity: updatedEntity, type: 'MaintenanceTask' },\n true,\n Object.fromEntries(\n Object.entries(delegates).map(([delegateId, options]) => [\n delegateId,\n {\n requestedPermissions: options.requestedPermissions,\n shareEncryptionKeys: options.shareEncryptionKey,\n shareOwningEntityIds: ShareMetadataBehaviour.NEVER,\n shareSecretIds: undefined,\n },\n ])\n ),\n (x) => this.bulkShareMaintenanceTask(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decryptAs(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: models.MaintenanceTask\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.xapi.getDataOwnersWithAccessTo({ entity, type: 'MaintenanceTask' })\n }\n\n getEncryptionKeysOf(entity: models.MaintenanceTask): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: 'MaintenanceTask' }, undefined)\n }\n\n async subscribeToMaintenanceTaskEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<MaintenanceTask>,\n eventFired: (dataSample: MaintenanceTask) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n const currentUser = await this.userApi.getCurrentUser()\n\n return subscribeToEntityEvents(\n this.host,\n this.authApi,\n 'MaintenanceTask',\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted) => (await this.decrypt(currentUser, [encrypted]))[0]\n ).then((rs) => new ConnectionImpl(rs))\n }\n}\n"]}
|
|
@@ -4,11 +4,18 @@ import { Patient, User } from '../icc-api/model/models';
|
|
|
4
4
|
import { IccDataOwnerXApi } from './icc-data-owner-x-api';
|
|
5
5
|
import { AuthenticationProvider } from './auth/AuthenticationProvider';
|
|
6
6
|
import * as models from '../icc-api/model/models';
|
|
7
|
+
import { SecureDelegation } from '../icc-api/model/SecureDelegation';
|
|
8
|
+
import AccessLevelEnum = SecureDelegation.AccessLevelEnum;
|
|
7
9
|
import { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour';
|
|
10
|
+
import { ShareResult } from './utils/ShareResult';
|
|
11
|
+
import { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest';
|
|
12
|
+
import RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum;
|
|
13
|
+
import { XHR } from '../icc-api/api/XHR';
|
|
8
14
|
import { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi';
|
|
9
15
|
export declare class IccMessageXApi extends IccMessageApi implements EncryptedEntityXApi<models.Message> {
|
|
10
|
-
private crypto;
|
|
11
|
-
dataOwnerApi
|
|
16
|
+
private readonly crypto;
|
|
17
|
+
private readonly dataOwnerApi;
|
|
18
|
+
get headers(): Promise<Array<XHR.Header>>;
|
|
12
19
|
constructor(host: string, headers: {
|
|
13
20
|
[key: string]: string;
|
|
14
21
|
}, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
|
|
@@ -22,15 +29,14 @@ export declare class IccMessageXApi extends IccMessageApi implements EncryptedEn
|
|
|
22
29
|
* @param options optional parameters:
|
|
23
30
|
* - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
|
|
24
31
|
* 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
|
|
25
|
-
* auto-delegations, in such case the access level specified here will be used.
|
|
26
|
-
*
|
|
27
|
-
* - preferredSfk: secret id of the patient to use as the secret foreign key to use for the classification. The default value will be a
|
|
32
|
+
* auto-delegations, in such case the access level specified here will be used.
|
|
33
|
+
* - preferredSfk: secret id of the patient to use as the secret foreign key to use for the message. The default value will be a
|
|
28
34
|
* secret id of patient known by the topmost parent in the current data owner hierarchy.
|
|
29
35
|
* @return a new instance of message.
|
|
30
36
|
*/
|
|
31
37
|
newInstanceWithPatient(user: User, patient: Patient | null, m?: any, options?: {
|
|
32
38
|
additionalDelegates?: {
|
|
33
|
-
[dataOwnerId: string]:
|
|
39
|
+
[dataOwnerId: string]: AccessLevelEnum;
|
|
34
40
|
};
|
|
35
41
|
preferredSfk?: string;
|
|
36
42
|
}): Promise<models.Message>;
|
|
@@ -40,9 +46,13 @@ export declare class IccMessageXApi extends IccMessageApi implements EncryptedEn
|
|
|
40
46
|
* in the returned array, but in case of entity merges there could be multiple values.
|
|
41
47
|
*/
|
|
42
48
|
decryptPatientIdOf(message: models.Message): Promise<string[]>;
|
|
49
|
+
/**
|
|
50
|
+
* @return if the logged data owner has write access to the content of the given message
|
|
51
|
+
*/
|
|
52
|
+
hasWriteAccess(message: models.Message): Promise<boolean>;
|
|
43
53
|
/**
|
|
44
54
|
* Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also
|
|
45
|
-
* the encrypted content.
|
|
55
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
46
56
|
* @param delegateId the id of the data owner which will be granted access to the message.
|
|
47
57
|
* @param message the message to share.
|
|
48
58
|
* @param shareSecretIds the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the
|
|
@@ -53,33 +63,61 @@ export declare class IccMessageXApi extends IccMessageApi implements EncryptedEn
|
|
|
53
63
|
* message does not have encrypted content.
|
|
54
64
|
* - sharePatientId: specifies if the id of the patient that this message refers to should be shared with the delegate (defaults to
|
|
55
65
|
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
56
|
-
*
|
|
66
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
67
|
+
* @return the updated entity
|
|
57
68
|
*/
|
|
58
69
|
shareWith(delegateId: string, message: models.Message, shareSecretIds: string[], options?: {
|
|
70
|
+
requestedPermissions?: RequestedPermissionEnum;
|
|
59
71
|
shareEncryptionKey?: ShareMetadataBehaviour;
|
|
60
72
|
sharePatientId?: ShareMetadataBehaviour;
|
|
61
73
|
}): Promise<models.Message>;
|
|
62
74
|
/**
|
|
63
75
|
* Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also
|
|
64
|
-
* the encrypted content.
|
|
76
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
65
77
|
* @param message the message to share.
|
|
66
|
-
* @param delegates
|
|
78
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
79
|
+
* - shareSecretIds the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the
|
|
80
|
+
* shared Message is the owning entity id. Mandatory.
|
|
67
81
|
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
68
82
|
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
69
83
|
* message does not have encrypted content.
|
|
70
84
|
* - sharePatientId: specifies if the id of the patient that this message refers to should be shared with the delegate (defaults to
|
|
71
85
|
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
72
|
-
* -
|
|
73
|
-
*
|
|
74
|
-
* @return a promise which will contain the updated message
|
|
86
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
87
|
+
* @return the updated entity
|
|
75
88
|
*/
|
|
76
|
-
shareWithMany(message: models.Message, delegates
|
|
89
|
+
shareWithMany(message: models.Message, delegates: {
|
|
77
90
|
[delegateId: string]: {
|
|
78
91
|
shareSecretIds: string[];
|
|
92
|
+
requestedPermissions?: RequestedPermissionEnum;
|
|
79
93
|
shareEncryptionKey?: ShareMetadataBehaviour;
|
|
80
94
|
sharePatientId?: ShareMetadataBehaviour;
|
|
81
95
|
};
|
|
82
96
|
}): Promise<models.Message>;
|
|
97
|
+
/**
|
|
98
|
+
* Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also
|
|
99
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
100
|
+
* @param message the message to share.
|
|
101
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
102
|
+
* - shareSecretIds the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the
|
|
103
|
+
* shared Message is the owning entity id. Mandatory.
|
|
104
|
+
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
105
|
+
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
106
|
+
* message does not have encrypted content.
|
|
107
|
+
* - sharePatientId: specifies if the id of the patient that this message refers to should be shared with the delegate (defaults to
|
|
108
|
+
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
109
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
110
|
+
* @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
|
|
111
|
+
* the operation failed.
|
|
112
|
+
*/
|
|
113
|
+
tryShareWithMany(message: models.Message, delegates: {
|
|
114
|
+
[delegateId: string]: {
|
|
115
|
+
shareSecretIds: string[];
|
|
116
|
+
requestedPermissions?: RequestedPermissionEnum;
|
|
117
|
+
shareEncryptionKey?: ShareMetadataBehaviour;
|
|
118
|
+
sharePatientId?: ShareMetadataBehaviour;
|
|
119
|
+
};
|
|
120
|
+
}): Promise<ShareResult<models.Message>>;
|
|
83
121
|
/**
|
|
84
122
|
* @param message a message
|
|
85
123
|
* @return the secret ids of the message, retrieved from the encrypted metadata. The result may be used to find entities where the message is
|
|
@@ -88,7 +126,7 @@ export declare class IccMessageXApi extends IccMessageApi implements EncryptedEn
|
|
|
88
126
|
decryptSecretIdsOf(message: models.Message): Promise<string[]>;
|
|
89
127
|
getDataOwnersWithAccessTo(entity: models.Message): Promise<{
|
|
90
128
|
permissionsByDataOwnerId: {
|
|
91
|
-
[p: string]:
|
|
129
|
+
[p: string]: AccessLevelEnum;
|
|
92
130
|
};
|
|
93
131
|
hasUnknownAnonymousDataOwners: boolean;
|
|
94
132
|
}>;
|
|
@@ -13,7 +13,12 @@ exports.IccMessageXApi = void 0;
|
|
|
13
13
|
const icc_api_1 = require("../icc-api");
|
|
14
14
|
const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
|
|
15
15
|
const models = require("../icc-api/model/models");
|
|
16
|
+
const SecureDelegation_1 = require("../icc-api/model/SecureDelegation");
|
|
17
|
+
var AccessLevelEnum = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
|
|
16
18
|
class IccMessageXApi extends icc_api_1.IccMessageApi {
|
|
19
|
+
get headers() {
|
|
20
|
+
return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'Message'));
|
|
21
|
+
}
|
|
17
22
|
constructor(host, headers, crypto, dataOwnerApi, authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
|
|
18
23
|
? window.fetch
|
|
19
24
|
: typeof self !== 'undefined'
|
|
@@ -21,6 +26,7 @@ class IccMessageXApi extends icc_api_1.IccMessageApi {
|
|
|
21
26
|
: fetch) {
|
|
22
27
|
super(host, headers, authenticationProvider, fetchImpl);
|
|
23
28
|
this.crypto = crypto;
|
|
29
|
+
this.dataOwnerApi = dataOwnerApi;
|
|
24
30
|
this.crypto = crypto;
|
|
25
31
|
this.dataOwnerApi = dataOwnerApi;
|
|
26
32
|
}
|
|
@@ -37,9 +43,8 @@ class IccMessageXApi extends icc_api_1.IccMessageApi {
|
|
|
37
43
|
* @param options optional parameters:
|
|
38
44
|
* - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
|
|
39
45
|
* 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
|
|
40
|
-
* auto-delegations, in such case the access level specified here will be used.
|
|
41
|
-
*
|
|
42
|
-
* - preferredSfk: secret id of the patient to use as the secret foreign key to use for the classification. The default value will be a
|
|
46
|
+
* auto-delegations, in such case the access level specified here will be used.
|
|
47
|
+
* - preferredSfk: secret id of the patient to use as the secret foreign key to use for the message. The default value will be a
|
|
43
48
|
* secret id of patient known by the topmost parent in the current data owner hierarchy.
|
|
44
49
|
* @return a new instance of message.
|
|
45
50
|
*/
|
|
@@ -52,16 +57,14 @@ class IccMessageXApi extends icc_api_1.IccMessageApi {
|
|
|
52
57
|
const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
53
58
|
if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
|
|
54
59
|
throw new Error('Can only initialise entities as current data owner.');
|
|
55
|
-
const sfk = patient
|
|
60
|
+
const sfk = patient
|
|
61
|
+
? (_h = options.preferredSfk) !== null && _h !== void 0 ? _h : (yield this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: patient, type: 'Patient' }))
|
|
62
|
+
: undefined;
|
|
56
63
|
if (patient && !sfk)
|
|
57
64
|
throw new Error(`Couldn't find any sfk of parent patient ${patient.id}`);
|
|
58
|
-
const extraDelegations = [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
...((_o = (_m = user.autoDelegations) === null || _m === void 0 ? void 0 : _m.medicalInformation) !== null && _o !== void 0 ? _o : []),
|
|
62
|
-
];
|
|
63
|
-
return new models.Message(yield this.crypto.entities
|
|
64
|
-
.entityWithInitialisedEncryptedMetadata(message, patient === null || patient === void 0 ? void 0 : patient.id, sfk, true, extraDelegations)
|
|
65
|
+
const extraDelegations = Object.assign(Object.assign({}, Object.fromEntries([...((_k = (_j = user.autoDelegations) === null || _j === void 0 ? void 0 : _j.all) !== null && _k !== void 0 ? _k : []), ...((_m = (_l = user.autoDelegations) === null || _l === void 0 ? void 0 : _l.medicalInformation) !== null && _m !== void 0 ? _m : [])].map((d) => [d, AccessLevelEnum.WRITE]))), ((_o = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _o !== void 0 ? _o : {}));
|
|
66
|
+
return new models.Message(yield this.crypto.xapi
|
|
67
|
+
.entityWithInitialisedEncryptedMetadata(message, 'Message', patient === null || patient === void 0 ? void 0 : patient.id, sfk, true, true, extraDelegations)
|
|
65
68
|
.then((x) => x.updatedEntity));
|
|
66
69
|
});
|
|
67
70
|
}
|
|
@@ -72,12 +75,20 @@ class IccMessageXApi extends icc_api_1.IccMessageApi {
|
|
|
72
75
|
*/
|
|
73
76
|
decryptPatientIdOf(message) {
|
|
74
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
return this.crypto.
|
|
78
|
+
return this.crypto.xapi.owningEntityIdsOf({ entity: message, type: 'Message' }, undefined);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @return if the logged data owner has write access to the content of the given message
|
|
83
|
+
*/
|
|
84
|
+
hasWriteAccess(message) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
return this.crypto.xapi.hasWriteAccess({ entity: message, type: 'Message' });
|
|
76
87
|
});
|
|
77
88
|
}
|
|
78
89
|
/**
|
|
79
90
|
* Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also
|
|
80
|
-
* the encrypted content.
|
|
91
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
81
92
|
* @param delegateId the id of the data owner which will be granted access to the message.
|
|
82
93
|
* @param message the message to share.
|
|
83
94
|
* @param shareSecretIds the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the
|
|
@@ -88,42 +99,64 @@ class IccMessageXApi extends icc_api_1.IccMessageApi {
|
|
|
88
99
|
* message does not have encrypted content.
|
|
89
100
|
* - sharePatientId: specifies if the id of the patient that this message refers to should be shared with the delegate (defaults to
|
|
90
101
|
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
91
|
-
*
|
|
102
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
103
|
+
* @return the updated entity
|
|
92
104
|
*/
|
|
93
105
|
shareWith(delegateId, message, shareSecretIds, options = {}) {
|
|
94
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
return this.shareWithMany(message, { [delegateId]: Object.assign({
|
|
107
|
+
return this.shareWithMany(message, { [delegateId]: Object.assign(Object.assign({}, options), { shareSecretIds }) });
|
|
96
108
|
});
|
|
97
109
|
}
|
|
98
110
|
/**
|
|
99
111
|
* Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also
|
|
100
|
-
* the encrypted content.
|
|
112
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
101
113
|
* @param message the message to share.
|
|
102
|
-
* @param delegates
|
|
114
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
115
|
+
* - shareSecretIds the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the
|
|
116
|
+
* shared Message is the owning entity id. Mandatory.
|
|
103
117
|
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
104
118
|
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
105
119
|
* message does not have encrypted content.
|
|
106
120
|
* - sharePatientId: specifies if the id of the patient that this message refers to should be shared with the delegate (defaults to
|
|
107
121
|
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
122
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
123
|
+
* @return the updated entity
|
|
124
|
+
*/
|
|
125
|
+
shareWithMany(message, delegates) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
return (yield this.tryShareWithMany(message, delegates)).updatedEntityOrThrow;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also
|
|
132
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
133
|
+
* @param message the message to share.
|
|
134
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
108
135
|
* - shareSecretIds the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the
|
|
109
|
-
* shared Message is the owning entity id.
|
|
110
|
-
*
|
|
136
|
+
* shared Message is the owning entity id. Mandatory.
|
|
137
|
+
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
138
|
+
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
139
|
+
* message does not have encrypted content.
|
|
140
|
+
* - sharePatientId: specifies if the id of the patient that this message refers to should be shared with the delegate (defaults to
|
|
141
|
+
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
142
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
143
|
+
* @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
|
|
144
|
+
* the operation failed.
|
|
111
145
|
*/
|
|
112
|
-
|
|
146
|
+
tryShareWithMany(message, delegates) {
|
|
113
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
-
|
|
148
|
+
// All entities should have an encryption key.
|
|
149
|
+
const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(message, 'Message');
|
|
150
|
+
const updatedEntity = entityWithEncryptionKey ? yield this.modifyMessage(entityWithEncryptionKey) : message;
|
|
151
|
+
return this.crypto.xapi.simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type: 'Message' }, false, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
|
|
115
152
|
delegateId,
|
|
116
153
|
{
|
|
117
|
-
|
|
118
|
-
|
|
154
|
+
requestedPermissions: options.requestedPermissions,
|
|
155
|
+
shareEncryptionKeys: options.shareEncryptionKey,
|
|
119
156
|
shareOwningEntityIds: options.sharePatientId,
|
|
157
|
+
shareSecretIds: options.shareSecretIds,
|
|
120
158
|
},
|
|
121
|
-
])));
|
|
122
|
-
if (!!extended) {
|
|
123
|
-
return yield this.modifyMessage(extended);
|
|
124
|
-
}
|
|
125
|
-
else
|
|
126
|
-
return message;
|
|
159
|
+
])), (x) => this.bulkShareMessages(x));
|
|
127
160
|
});
|
|
128
161
|
}
|
|
129
162
|
/**
|
|
@@ -132,17 +165,13 @@ class IccMessageXApi extends icc_api_1.IccMessageApi {
|
|
|
132
165
|
* the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.
|
|
133
166
|
*/
|
|
134
167
|
decryptSecretIdsOf(message) {
|
|
135
|
-
return this.crypto.
|
|
168
|
+
return this.crypto.xapi.secretIdsOf({ entity: message, type: 'Message' }, undefined);
|
|
136
169
|
}
|
|
137
170
|
getDataOwnersWithAccessTo(entity) {
|
|
138
|
-
return
|
|
139
|
-
return yield this.crypto.entities.getDataOwnersWithAccessTo(entity);
|
|
140
|
-
});
|
|
171
|
+
return this.crypto.xapi.getDataOwnersWithAccessTo({ entity, type: 'Message' });
|
|
141
172
|
}
|
|
142
173
|
getEncryptionKeysOf(entity) {
|
|
143
|
-
return
|
|
144
|
-
return yield this.crypto.entities.encryptionKeysOf(entity);
|
|
145
|
-
});
|
|
174
|
+
return this.crypto.xapi.encryptionKeysOf({ entity, type: 'Message' }, undefined);
|
|
146
175
|
}
|
|
147
176
|
}
|
|
148
177
|
exports.IccMessageXApi = IccMessageXApi;
|