@icure/api 8.0.0-RC.1 → 8.0.0-RC.3
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 -4
- package/icc-api/api/IccAccesslogApi.js +23 -18
- package/icc-api/api/IccAccesslogApi.js.map +1 -1
- package/icc-api/api/IccAgendaApi.d.ts +13 -4
- package/icc-api/api/IccAgendaApi.js +42 -19
- package/icc-api/api/IccAgendaApi.js.map +1 -1
- package/icc-api/api/IccApplicationsettingsApi.d.ts +1 -1
- package/icc-api/api/IccApplicationsettingsApi.js +2 -2
- package/icc-api/api/IccApplicationsettingsApi.js.map +1 -1
- package/icc-api/api/IccArticleApi.d.ts +13 -4
- package/icc-api/api/IccArticleApi.js +50 -26
- package/icc-api/api/IccArticleApi.js.map +1 -1
- package/icc-api/api/IccAuthApi.d.ts +1 -1
- package/icc-api/api/IccAuthApi.js +2 -2
- package/icc-api/api/IccAuthApi.js.map +1 -1
- package/icc-api/api/IccCalendarItemApi.d.ts +8 -4
- package/icc-api/api/IccCalendarItemApi.js +15 -22
- package/icc-api/api/IccCalendarItemApi.js.map +1 -1
- package/icc-api/api/IccCalendarItemTypeApi.d.ts +6 -4
- package/icc-api/api/IccCalendarItemTypeApi.js +60 -45
- package/icc-api/api/IccCalendarItemTypeApi.js.map +1 -1
- package/icc-api/api/IccClassificationApi.d.ts +14 -5
- package/icc-api/api/IccClassificationApi.js +22 -12
- package/icc-api/api/IccClassificationApi.js.map +1 -1
- package/icc-api/api/IccClassificationTemplateApi.d.ts +14 -5
- package/icc-api/api/IccClassificationTemplateApi.js +102 -70
- package/icc-api/api/IccClassificationTemplateApi.js.map +1 -1
- package/icc-api/api/IccCodeApi.d.ts +1 -1
- package/icc-api/api/IccCodeApi.js +2 -2
- package/icc-api/api/IccCodeApi.js.map +1 -1
- package/icc-api/api/IccContactApi.d.ts +11 -4
- package/icc-api/api/IccContactApi.js +20 -13
- package/icc-api/api/IccContactApi.js.map +1 -1
- package/icc-api/api/IccDataownerApi.d.ts +1 -1
- package/icc-api/api/IccDataownerApi.js +44 -27
- package/icc-api/api/IccDataownerApi.js.map +1 -1
- package/icc-api/api/IccDeviceApi.d.ts +1 -1
- package/icc-api/api/IccDeviceApi.js +43 -32
- package/icc-api/api/IccDeviceApi.js.map +1 -1
- package/icc-api/api/IccDoctemplateApi.d.ts +10 -8
- package/icc-api/api/IccDoctemplateApi.js +121 -101
- package/icc-api/api/IccDoctemplateApi.js.map +1 -1
- package/icc-api/api/IccDocumentApi.d.ts +19 -5
- package/icc-api/api/IccDocumentApi.js +38 -13
- package/icc-api/api/IccDocumentApi.js.map +1 -1
- package/icc-api/api/IccEntityrefApi.d.ts +1 -1
- package/icc-api/api/IccEntityrefApi.js +27 -16
- package/icc-api/api/IccEntityrefApi.js.map +1 -1
- package/icc-api/api/IccEntitytemplateApi.d.ts +6 -4
- package/icc-api/api/IccEntitytemplateApi.js +118 -97
- package/icc-api/api/IccEntitytemplateApi.js.map +1 -1
- package/icc-api/api/IccExchangeDataApi.d.ts +2 -2
- package/icc-api/api/IccExchangeDataApi.js +73 -52
- package/icc-api/api/IccExchangeDataApi.js.map +1 -1
- package/icc-api/api/IccExchangeDataMapApi.d.ts +2 -2
- package/icc-api/api/IccExchangeDataMapApi.js +53 -34
- package/icc-api/api/IccExchangeDataMapApi.js.map +1 -1
- package/icc-api/api/IccFormApi.d.ts +13 -5
- package/icc-api/api/IccFormApi.js +24 -18
- package/icc-api/api/IccFormApi.js.map +1 -1
- package/icc-api/api/IccFrontendmigrationApi.d.ts +1 -1
- package/icc-api/api/IccFrontendmigrationApi.js +19 -10
- package/icc-api/api/IccFrontendmigrationApi.js.map +1 -1
- package/icc-api/api/IccGroupApi.d.ts +16 -2
- package/icc-api/api/IccGroupApi.js +29 -3
- package/icc-api/api/IccGroupApi.js.map +1 -1
- package/icc-api/api/IccHcpartyApi.d.ts +25 -10
- package/icc-api/api/IccHcpartyApi.js +84 -53
- package/icc-api/api/IccHcpartyApi.js.map +1 -1
- package/icc-api/api/IccHelementApi.d.ts +13 -5
- package/icc-api/api/IccHelementApi.js +25 -21
- package/icc-api/api/IccHelementApi.js.map +1 -1
- package/icc-api/api/IccIcureApi.d.ts +1 -1
- package/icc-api/api/IccIcureApi.js +2 -2
- package/icc-api/api/IccIcureApi.js.map +1 -1
- package/icc-api/api/IccInsuranceApi.d.ts +1 -1
- package/icc-api/api/IccInsuranceApi.js +67 -50
- package/icc-api/api/IccInsuranceApi.js.map +1 -1
- package/icc-api/api/IccInvoiceApi.d.ts +1 -1
- package/icc-api/api/IccInvoiceApi.js +5 -11
- package/icc-api/api/IccInvoiceApi.js.map +1 -1
- package/icc-api/api/IccKeywordApi.d.ts +6 -5
- package/icc-api/api/IccKeywordApi.js +59 -45
- package/icc-api/api/IccKeywordApi.js.map +1 -1
- package/icc-api/api/IccMaintenanceTaskApi.d.ts +13 -4
- package/icc-api/api/IccMaintenanceTaskApi.js +22 -12
- package/icc-api/api/IccMaintenanceTaskApi.js.map +1 -1
- package/icc-api/api/IccMedexApi.d.ts +1 -1
- package/icc-api/api/IccMedexApi.js +19 -10
- package/icc-api/api/IccMedexApi.js.map +1 -1
- package/icc-api/api/IccMedicallocationApi.d.ts +6 -4
- package/icc-api/api/IccMedicallocationApi.js +52 -39
- package/icc-api/api/IccMedicallocationApi.js.map +1 -1
- package/icc-api/api/IccMessageApi.d.ts +25 -7
- package/icc-api/api/IccMessageApi.js +52 -22
- package/icc-api/api/IccMessageApi.js.map +1 -1
- package/icc-api/api/IccPatientApi.d.ts +13 -5
- package/icc-api/api/IccPatientApi.js +23 -13
- package/icc-api/api/IccPatientApi.js.map +1 -1
- package/icc-api/api/IccPermissionApi.d.ts +1 -1
- package/icc-api/api/IccPermissionApi.js +19 -10
- package/icc-api/api/IccPermissionApi.js.map +1 -1
- package/icc-api/api/IccPlaceApi.d.ts +7 -5
- package/icc-api/api/IccPlaceApi.js +53 -40
- package/icc-api/api/IccPlaceApi.js.map +1 -1
- package/icc-api/api/IccReceiptApi.d.ts +13 -4
- package/icc-api/api/IccReceiptApi.js +23 -13
- package/icc-api/api/IccReceiptApi.js.map +1 -1
- package/icc-api/api/IccReplicationApi.d.ts +1 -1
- package/icc-api/api/IccReplicationApi.js +3 -5
- package/icc-api/api/IccReplicationApi.js.map +1 -1
- package/icc-api/api/IccRoleApi.d.ts +16 -0
- package/icc-api/api/IccRoleApi.js +42 -0
- package/icc-api/api/IccRoleApi.js.map +1 -0
- package/icc-api/api/IccSecureDelegationKeyMapApi.d.ts +26 -0
- package/icc-api/api/IccSecureDelegationKeyMapApi.js +71 -0
- package/icc-api/api/IccSecureDelegationKeyMapApi.js.map +1 -0
- package/icc-api/api/IccTarificationApi.d.ts +1 -1
- package/icc-api/api/IccTarificationApi.js +19 -10
- package/icc-api/api/IccTarificationApi.js.map +1 -1
- package/icc-api/api/IccTimeTableApi.d.ts +13 -4
- package/icc-api/api/IccTimeTableApi.js +21 -9
- package/icc-api/api/IccTimeTableApi.js.map +1 -1
- package/icc-api/api/IccTopicApi.d.ts +97 -0
- package/icc-api/api/IccTopicApi.js +208 -0
- package/icc-api/api/IccTopicApi.js.map +1 -0
- package/icc-api/api/IccUserApi.d.ts +31 -1
- package/icc-api/api/IccUserApi.js +65 -2
- package/icc-api/api/IccUserApi.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/AbstractFilterMessage.d.ts +15 -0
- package/icc-api/model/AbstractFilterMessage.js +21 -0
- package/icc-api/model/AbstractFilterMessage.js.map +1 -0
- package/icc-api/model/AbstractFilterTopic.d.ts +15 -0
- package/icc-api/model/AbstractFilterTopic.js +21 -0
- package/icc-api/model/AbstractFilterTopic.js.map +1 -0
- package/icc-api/model/AccessLog.d.ts +0 -2
- package/icc-api/model/AccessLog.js +0 -1
- package/icc-api/model/AccessLog.js.map +1 -1
- package/icc-api/model/Article.d.ts +0 -2
- package/icc-api/model/Article.js +0 -1
- package/icc-api/model/Article.js.map +1 -1
- package/icc-api/model/CalendarItem.d.ts +0 -2
- package/icc-api/model/CalendarItem.js +0 -1
- package/icc-api/model/CalendarItem.js.map +1 -1
- package/icc-api/model/Classification.d.ts +0 -2
- package/icc-api/model/Classification.js +0 -1
- package/icc-api/model/Classification.js.map +1 -1
- package/icc-api/model/Connection.d.ts +1 -1
- package/icc-api/model/Connection.js.map +1 -1
- package/icc-api/model/Contact.d.ts +0 -2
- package/icc-api/model/Contact.js +0 -1
- package/icc-api/model/Contact.js.map +1 -1
- package/icc-api/model/Document.d.ts +0 -2
- package/icc-api/model/Document.js +0 -1
- package/icc-api/model/Document.js.map +1 -1
- package/icc-api/model/FilterChainMessage.d.ts +19 -0
- package/icc-api/model/FilterChainMessage.js +11 -0
- package/icc-api/model/FilterChainMessage.js.map +1 -0
- package/icc-api/model/FilterChainTopic.d.ts +19 -0
- package/icc-api/model/FilterChainTopic.js +11 -0
- package/icc-api/model/FilterChainTopic.js.map +1 -0
- package/icc-api/model/Form.d.ts +0 -2
- package/icc-api/model/Form.js +0 -1
- package/icc-api/model/Form.js.map +1 -1
- package/icc-api/model/Group.d.ts +4 -0
- package/icc-api/model/Group.js.map +1 -1
- package/icc-api/model/HealthElement.d.ts +0 -2
- package/icc-api/model/HealthElement.js +0 -1
- package/icc-api/model/HealthElement.js.map +1 -1
- package/icc-api/model/HealthcareParty.js +13 -1
- package/icc-api/model/HealthcareParty.js.map +1 -1
- package/icc-api/model/Invoice.d.ts +0 -2
- package/icc-api/model/Invoice.js +0 -1
- package/icc-api/model/Invoice.js.map +1 -1
- package/icc-api/model/MaintenanceTask.d.ts +11 -10
- package/icc-api/model/MaintenanceTask.js +13 -12
- package/icc-api/model/MaintenanceTask.js.map +1 -1
- package/icc-api/model/Message.d.ts +5 -2
- package/icc-api/model/Message.js +0 -1
- package/icc-api/model/Message.js.map +1 -1
- package/icc-api/model/MessageAttachment.d.ts +10 -0
- package/icc-api/model/MessageAttachment.js +10 -0
- package/icc-api/model/MessageAttachment.js.map +1 -0
- package/icc-api/model/PaginatedListExchangeData.d.ts +1 -1
- package/icc-api/model/PaginatedListExchangeData.js.map +1 -1
- package/icc-api/model/PaginatedListTopic.d.ts +20 -0
- package/icc-api/model/PaginatedListTopic.js +10 -0
- package/icc-api/model/PaginatedListTopic.js.map +1 -0
- package/icc-api/model/Patient.d.ts +0 -2
- package/icc-api/model/Patient.js +0 -1
- package/icc-api/model/Patient.js.map +1 -1
- package/icc-api/model/Receipt.d.ts +0 -2
- package/icc-api/model/Receipt.js +0 -1
- package/icc-api/model/Receipt.js.map +1 -1
- package/icc-api/model/Role.d.ts +11 -0
- package/icc-api/model/Role.js +10 -0
- package/icc-api/model/Role.js.map +1 -0
- package/icc-api/model/RoleConfiguration.d.ts +6 -0
- package/icc-api/model/RoleConfiguration.js +10 -0
- package/icc-api/model/RoleConfiguration.js.map +1 -0
- package/icc-api/model/RoleSourceEnum.d.ts +11 -0
- package/icc-api/model/RoleSourceEnum.js +16 -0
- package/icc-api/model/RoleSourceEnum.js.map +1 -0
- package/icc-api/model/TimeTable.d.ts +0 -2
- package/icc-api/model/TimeTable.js +0 -1
- package/icc-api/model/TimeTable.js.map +1 -1
- package/icc-api/model/Topic.d.ts +95 -0
- package/icc-api/model/Topic.js +16 -0
- package/icc-api/model/Topic.js.map +1 -0
- package/icc-api/model/UserTypeEnum.d.ts +9 -0
- package/icc-api/model/UserTypeEnum.js +14 -0
- package/icc-api/model/UserTypeEnum.js.map +1 -0
- package/icc-api/model/{ExchangeData.d.ts → internal/ExchangeData.d.ts} +3 -0
- package/icc-api/model/{ExchangeData.js → internal/ExchangeData.js} +3 -0
- package/icc-api/model/internal/ExchangeData.js.map +1 -0
- package/icc-api/model/{ExchangeDataMap.d.ts → internal/ExchangeDataMap.d.ts} +3 -0
- package/icc-api/model/{ExchangeDataMap.js → internal/ExchangeDataMap.js} +3 -0
- package/icc-api/model/internal/ExchangeDataMap.js.map +1 -0
- package/icc-api/model/internal/SecureDelegationKeyMap.d.ts +14 -0
- package/icc-api/model/internal/SecureDelegationKeyMap.js +13 -0
- package/icc-api/model/internal/SecureDelegationKeyMap.js.map +1 -0
- package/icc-api/model/models.d.ts +11 -1
- package/icc-api/model/models.js +9 -0
- package/icc-api/model/models.js.map +1 -1
- package/icc-x-api/basexapi/EncryptedEntityXApi.d.ts +52 -4
- package/icc-x-api/basexapi/EncryptedEntityXApi.js.map +1 -1
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.d.ts +2 -0
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js +13 -4
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js.map +1 -1
- package/icc-x-api/crypto/AccessControlSecretUtils.d.ts +1 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.js +11 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.js.map +1 -1
- package/icc-x-api/crypto/BaseExchangeDataManager.d.ts +1 -1
- package/icc-x-api/crypto/BaseExchangeDataManager.js +1 -1
- package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -1
- package/icc-x-api/crypto/DelegationsDeAnonymization.d.ts +44 -0
- package/icc-x-api/crypto/DelegationsDeAnonymization.js +235 -0
- package/icc-x-api/crypto/DelegationsDeAnonymization.js.map +1 -0
- package/icc-x-api/crypto/ExchangeDataManager.d.ts +3 -1
- package/icc-x-api/crypto/ExchangeDataManager.js +27 -19
- package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
- package/icc-x-api/crypto/ExchangeDataMapManager.d.ts +1 -1
- package/icc-x-api/crypto/ExchangeDataMapManager.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtils.d.ts +0 -10
- package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +0 -7
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +4 -7
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -1
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.d.ts +0 -6
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js +0 -9
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js.map +1 -1
- package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -1
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.d.ts +14 -5
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js +44 -26
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js.map +1 -1
- package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +1 -18
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js +4 -23
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js.map +1 -1
- package/icc-x-api/crypto/UserSignatureKeysManager.d.ts +1 -1
- package/icc-x-api/crypto/UserSignatureKeysManager.js +2 -2
- package/icc-x-api/crypto/UserSignatureKeysManager.js.map +1 -1
- package/icc-x-api/filters/LatestMessageByHcPartyTransportGuidFilter.d.ts +8 -0
- package/icc-x-api/filters/LatestMessageByHcPartyTransportGuidFilter.js +13 -0
- package/icc-x-api/filters/LatestMessageByHcPartyTransportGuidFilter.js.map +1 -0
- package/icc-x-api/filters/MessageByHcPartyFilter.d.ts +7 -0
- package/icc-x-api/filters/MessageByHcPartyFilter.js +13 -0
- package/icc-x-api/filters/MessageByHcPartyFilter.js.map +1 -0
- package/icc-x-api/filters/MessageByHcPartyTransportGuidFilter.d.ts +8 -0
- package/icc-x-api/filters/MessageByHcPartyTransportGuidFilter.js +13 -0
- package/icc-x-api/filters/MessageByHcPartyTransportGuidFilter.js.map +1 -0
- package/icc-x-api/filters/TopicByHcPartyFilter.d.ts +7 -0
- package/icc-x-api/filters/TopicByHcPartyFilter.js +13 -0
- package/icc-x-api/filters/TopicByHcPartyFilter.js.map +1 -0
- package/icc-x-api/filters/TopicByParticipantFilter.d.ts +7 -0
- package/icc-x-api/filters/TopicByParticipantFilter.js +13 -0
- package/icc-x-api/filters/TopicByParticipantFilter.js.map +1 -0
- package/icc-x-api/filters/filters.d.ts +5 -0
- package/icc-x-api/filters/filters.js +5 -0
- package/icc-x-api/filters/filters.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.d.ts +3 -1
- package/icc-x-api/icc-accesslog-x-api.js +7 -3
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +3 -1
- package/icc-x-api/icc-calendar-item-x-api.js +7 -3
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.d.ts +3 -1
- package/icc-x-api/icc-classification-x-api.js +7 -3
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +3 -1
- package/icc-x-api/icc-contact-x-api.js +8 -4
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +7 -1
- package/icc-x-api/icc-crypto-x-api.js +8 -1
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +3 -1
- package/icc-x-api/icc-document-x-api.js +8 -4
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +3 -1
- package/icc-x-api/icc-form-x-api.js +7 -3
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +4 -2
- package/icc-x-api/icc-helement-x-api.js +8 -8
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.d.ts +3 -1
- package/icc-x-api/icc-invoice-x-api.js +7 -3
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.d.ts +8 -4
- package/icc-x-api/icc-maintenance-task-x-api.js +14 -4
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.d.ts +24 -6
- package/icc-x-api/icc-message-x-api.js +66 -6
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +3 -1
- package/icc-x-api/icc-patient-x-api.js +7 -3
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +3 -1
- package/icc-x-api/icc-receipt-x-api.js +7 -3
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.d.ts +3 -1
- package/icc-x-api/icc-time-table-x-api.js +7 -3
- package/icc-x-api/icc-time-table-x-api.js.map +1 -1
- package/icc-x-api/icc-topic-x-api.d.ts +191 -0
- package/icc-x-api/icc-topic-x-api.js +307 -0
- package/icc-x-api/icc-topic-x-api.js.map +1 -0
- package/icc-x-api/index.d.ts +17 -0
- package/icc-x-api/index.js +104 -70
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/maintenance/KeyPairUpdateRequest.d.ts +1 -1
- package/icc-x-api/storage/KeyStorageImpl.d.ts +1 -0
- package/icc-x-api/storage/KeyStorageImpl.js +20 -12
- package/icc-x-api/storage/KeyStorageImpl.js.map +1 -1
- package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +1 -1
- package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -1
- package/icc-x-api/utils/websocket.d.ts +4 -0
- package/icc-x-api/utils/websocket.js +8 -0
- package/icc-x-api/utils/websocket.js.map +1 -1
- package/package.json +1 -1
- package/icc-api/api/IccDocumentTemplateApi.d.ts +0 -106
- package/icc-api/api/IccDocumentTemplateApi.js +0 -223
- package/icc-api/api/IccDocumentTemplateApi.js.map +0 -1
- package/icc-api/model/ExchangeData.js.map +0 -1
- package/icc-api/model/ExchangeDataMap.js.map +0 -1
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.IccTopicXApi = void 0;
|
|
13
|
+
const icc_api_1 = require("../icc-api");
|
|
14
|
+
const models = require("../icc-api/model/models");
|
|
15
|
+
const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
|
|
16
|
+
const SecureDelegation_1 = require("../icc-api/model/SecureDelegation");
|
|
17
|
+
const EntityShareRequest_1 = require("../icc-api/model/requests/EntityShareRequest");
|
|
18
|
+
var AccessLevelEnum = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
|
|
19
|
+
var RequestedPermissionEnum = EntityShareRequest_1.EntityShareRequest.RequestedPermissionEnum;
|
|
20
|
+
const utils_1 = require("./utils");
|
|
21
|
+
const Connection_1 = require("../icc-api/model/Connection");
|
|
22
|
+
// noinspection JSUnusedGlobalSymbols
|
|
23
|
+
class IccTopicXApi extends icc_api_1.IccTopicApi {
|
|
24
|
+
constructor(host, headers, crypto, dataOwnerApi, authApi, autofillAuthor, authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), encryptedKeys = ['description'], fetchImpl = typeof window !== 'undefined'
|
|
25
|
+
? window.fetch
|
|
26
|
+
: typeof self !== 'undefined'
|
|
27
|
+
? self.fetch
|
|
28
|
+
: fetch) {
|
|
29
|
+
super(host, headers, authenticationProvider, fetchImpl);
|
|
30
|
+
this.crypto = crypto;
|
|
31
|
+
this.dataOwnerApi = dataOwnerApi;
|
|
32
|
+
this.authApi = authApi;
|
|
33
|
+
this.autofillAuthor = autofillAuthor;
|
|
34
|
+
this.encryptedFields = (0, utils_1.parseEncryptedFields)(encryptedKeys, 'Topic.');
|
|
35
|
+
}
|
|
36
|
+
get headers() {
|
|
37
|
+
return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'Topic'));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new instance of topic with initialised encryption metadata (not in the database).
|
|
41
|
+
* @param user the current user.
|
|
42
|
+
* @param patient the patient this topic refers to.
|
|
43
|
+
* @param c initialised data for the topic. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify
|
|
44
|
+
* other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.
|
|
45
|
+
* @param options optional parameters:
|
|
46
|
+
* - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
|
|
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
|
|
48
|
+
* auto-delegations, in such case the access level specified here will be used.
|
|
49
|
+
* - preferredSfk: secret id of the patient to use as the secret foreign key to use for the topic. The default value will be a
|
|
50
|
+
* secret id of patient known by the topmost parent in the current data owner hierarchy.
|
|
51
|
+
* @return a new instance of topic.
|
|
52
|
+
*/
|
|
53
|
+
newInstance(user, patient, c = {}, // TODO: Why this isn't Topic?
|
|
54
|
+
options = {}) {
|
|
55
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
if (!patient && options.preferredSfk)
|
|
58
|
+
throw new Error('preferredSfk can only be specified if patient is specified.');
|
|
59
|
+
const topic = Object.assign(Object.assign({}, (c !== null && c !== void 0 ? c : {})), { id: (_a = c === null || c === void 0 ? void 0 : c.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), _type: 'org.taktik.icure.entities.Topic', 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.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined), author: (_e = c === null || c === void 0 ? void 0 : c.author) !== null && _e !== void 0 ? _e : (this.autofillAuthor ? user.id : undefined), 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 : [] });
|
|
60
|
+
const extraDelegations = Object.assign(Object.assign({}, Object.fromEntries(((_j = (_h = user.autoDelegations) === null || _h === void 0 ? void 0 : _h.all) !== null && _j !== void 0 ? _j : []).map((d) => [d, AccessLevelEnum.WRITE]))), ((_k = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _k !== void 0 ? _k : {}));
|
|
61
|
+
const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
62
|
+
if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
|
|
63
|
+
throw new Error('Can only initialise entities as current data owner.');
|
|
64
|
+
const sfk = patient
|
|
65
|
+
? (_l = options.preferredSfk) !== null && _l !== void 0 ? _l : (yield this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: patient, type: 'Patient' }))
|
|
66
|
+
: undefined;
|
|
67
|
+
if (patient && !sfk)
|
|
68
|
+
throw new Error(`Couldn't find any sfk of parent patient ${patient.id}`);
|
|
69
|
+
return new models.Topic(yield this.crypto.xapi
|
|
70
|
+
.entityWithInitialisedEncryptedMetadata(topic, 'Topic', patient === null || patient === void 0 ? void 0 : patient.id, sfk, true, false, extraDelegations)
|
|
71
|
+
.then((x) => x.updatedEntity));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
decrypt(topics) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
return yield Promise.all(topics.map((topic) => this.crypto.xapi.decryptEntity(topic, 'Topic', (x) => new models.Topic(x)).then(({ entity }) => entity)));
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
encrypt(topics) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
return yield Promise.all(topics.map((p) => this.crypto.xapi.tryEncryptEntity(p, 'Topic', this.encryptedFields, true, false, (x) => new models.Topic(x))));
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Create and share a new topic with other participants.
|
|
86
|
+
* @param body the topic to create.
|
|
87
|
+
* @return the created topic.
|
|
88
|
+
*/
|
|
89
|
+
createTopic(body) {
|
|
90
|
+
const _super = Object.create(null, {
|
|
91
|
+
createTopic: { get: () => super.createTopic }
|
|
92
|
+
});
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const encryptedTopics = yield this.encrypt([body]);
|
|
95
|
+
const createdTopic = yield _super.createTopic.call(this, encryptedTopics[0]);
|
|
96
|
+
const decryptedTopics = yield this.decrypt([createdTopic]);
|
|
97
|
+
return decryptedTopics[0];
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @param topic a topic
|
|
102
|
+
* @return the id of the patient that the topic refers to, retrieved from the encrypted metadata. Normally there should only be one element
|
|
103
|
+
* in the returned array, but in case of entity merges there could be multiple values.
|
|
104
|
+
*/
|
|
105
|
+
decryptPatientIdOf(topic) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
return this.crypto.xapi.owningEntityIdsOf({ entity: topic, type: 'Topic' }, undefined);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @return if the logged data owner has write access to the content of the given topic
|
|
112
|
+
*/
|
|
113
|
+
hasWriteAccess(topic) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
return this.crypto.xapi.hasWriteAccess({ entity: topic, type: 'Topic' });
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Share an existing topic with other data owners, allowing them to access the non-encrypted data of the topic and optionally also
|
|
120
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
121
|
+
* @param delegateId the id of the data owner which will be granted access to the topic.
|
|
122
|
+
* @param topic the topic to share.
|
|
123
|
+
* @param options optional parameters to customize the sharing behaviour:
|
|
124
|
+
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
125
|
+
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
126
|
+
* - sharePatientId: specifies if the id of the patient that this topic refers to should be shared with the delegate (defaults to
|
|
127
|
+
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
128
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
129
|
+
* @return the updated entity
|
|
130
|
+
*/
|
|
131
|
+
shareWith(delegateId, topic, options = {}) {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
return this.shareWithMany(topic, { [delegateId]: options });
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Share an existing topic with other data owners, allowing them to access the non-encrypted data of the topic and optionally also
|
|
138
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
139
|
+
* @param topic the topic to share.
|
|
140
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
141
|
+
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
142
|
+
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
143
|
+
* topic does not have encrypted content.
|
|
144
|
+
* - sharePatientId: specifies if the id of the patient that this topic refers to should be shared with the delegate (defaults to
|
|
145
|
+
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
146
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
147
|
+
* @return the updated entity
|
|
148
|
+
*/
|
|
149
|
+
shareWithMany(topic, delegates) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
return (yield this.tryShareWithMany(topic, delegates)).updatedEntityOrThrow;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Share an existing topic with other data owners, allowing them to access the non-encrypted data of the topic and optionally also
|
|
156
|
+
* the encrypted content, with read-only or read-write permissions.
|
|
157
|
+
* @param topic the topic to share.
|
|
158
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
159
|
+
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
160
|
+
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
|
|
161
|
+
* topic does not have encrypted content.
|
|
162
|
+
* - sharePatientId: specifies if the id of the patient that this topic refers to should be shared with the delegate (defaults to
|
|
163
|
+
* {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
164
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
165
|
+
* @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
|
|
166
|
+
* the operation failed.
|
|
167
|
+
*/
|
|
168
|
+
tryShareWithMany(topic, delegates) {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
// All entities should have an encryption key.
|
|
171
|
+
const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(topic, 'Topic');
|
|
172
|
+
const updatedEntity = entityWithEncryptionKey ? yield this.modifyTopic(entityWithEncryptionKey) : topic;
|
|
173
|
+
return this.crypto.xapi
|
|
174
|
+
.simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type: 'Topic' }, true, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
|
|
175
|
+
delegateId,
|
|
176
|
+
{
|
|
177
|
+
requestedPermissions: options.requestedPermissions,
|
|
178
|
+
shareEncryptionKeys: options.shareEncryptionKey,
|
|
179
|
+
shareOwningEntityIds: options.sharePatientId,
|
|
180
|
+
shareSecretIds: undefined,
|
|
181
|
+
},
|
|
182
|
+
])), (x) => this.bulkShareTopics(x))
|
|
183
|
+
.then((r) => r.mapSuccessAsync((e) => this.decrypt([e]).then((es) => es[0])));
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
getDataOwnersWithAccessTo(entity) {
|
|
187
|
+
return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: 'Topic' });
|
|
188
|
+
}
|
|
189
|
+
getEncryptionKeysOf(entity) {
|
|
190
|
+
return this.crypto.xapi.encryptionKeysOf({ entity, type: 'Topic' }, undefined);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Filter and decrypt topics by the given filter.
|
|
194
|
+
* @param body the filter to apply.
|
|
195
|
+
* @param startDocumentId the document id to start from (inclusive).
|
|
196
|
+
* @param limit the maximum number of topics to return in the page.
|
|
197
|
+
* @return a paginated list of topics.
|
|
198
|
+
*/
|
|
199
|
+
filterTopicsBy(body, startDocumentId, limit) {
|
|
200
|
+
const _super = Object.create(null, {
|
|
201
|
+
filterTopicsBy: { get: () => super.filterTopicsBy }
|
|
202
|
+
});
|
|
203
|
+
var _a;
|
|
204
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
const page = yield _super.filterTopicsBy.call(this, body, startDocumentId, limit);
|
|
206
|
+
const decryptedTopics = yield this.decrypt((_a = page.rows) !== null && _a !== void 0 ? _a : []);
|
|
207
|
+
return Object.assign(Object.assign({}, page), { rows: decryptedTopics });
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Obtain the topic with the given id and decrypt it.
|
|
212
|
+
* @param id the id of the topic to retrieve.
|
|
213
|
+
* @return the decrypted topic.
|
|
214
|
+
*/
|
|
215
|
+
getTopic(id) {
|
|
216
|
+
const _super = Object.create(null, {
|
|
217
|
+
getTopic: { get: () => super.getTopic }
|
|
218
|
+
});
|
|
219
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
220
|
+
const topic = yield _super.getTopic.call(this, id);
|
|
221
|
+
const decryptedTopics = yield this.decrypt([topic]);
|
|
222
|
+
return decryptedTopics[0];
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Obtain the topics with the given ids and decrypt them.
|
|
227
|
+
* @param body the ids of the topics to retrieve.
|
|
228
|
+
* @return the decrypted topics.
|
|
229
|
+
*/
|
|
230
|
+
getTopics(body) {
|
|
231
|
+
const _super = Object.create(null, {
|
|
232
|
+
getTopics: { get: () => super.getTopics }
|
|
233
|
+
});
|
|
234
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
235
|
+
const topics = yield _super.getTopics.call(this, body);
|
|
236
|
+
return yield this.decrypt(topics);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Update and encrypt the given topic.
|
|
241
|
+
* @param body the topic to update.
|
|
242
|
+
* @return the updated decrypted topic.
|
|
243
|
+
*/
|
|
244
|
+
modifyTopic(body) {
|
|
245
|
+
const _super = Object.create(null, {
|
|
246
|
+
modifyTopic: { get: () => super.modifyTopic }
|
|
247
|
+
});
|
|
248
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
249
|
+
const encryptedTopics = yield this.encrypt([body]);
|
|
250
|
+
const modifiedTopic = yield _super.modifyTopic.call(this, encryptedTopics[0]);
|
|
251
|
+
const decryptedTopics = yield this.decrypt([modifiedTopic]);
|
|
252
|
+
return decryptedTopics[0];
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* @internal this method is for internal use only and may be changed without notice
|
|
257
|
+
* @param body data owner id of the data owner to which the participant should be added and the topic role of the participant.
|
|
258
|
+
* @param topicId Id of the topic to which the participant should be added.
|
|
259
|
+
*/
|
|
260
|
+
addParticipant(body, topicId) {
|
|
261
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
262
|
+
throw new Error('Cannot add participant to topic without sharing it first. You should use addParticipantWithTopic instead.');
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* This method is similar to {@link addParticipant} but it also shares the topic with the data owner before adding the participant.
|
|
267
|
+
* @param body data owner id of the data owner to which the participant should be added and the topic role of the participant.
|
|
268
|
+
* @param topic the topic to share and to which the participant should be added.
|
|
269
|
+
* @return the updated topic.
|
|
270
|
+
*/
|
|
271
|
+
addParticipantWithTopic(body, topic) {
|
|
272
|
+
const _super = Object.create(null, {
|
|
273
|
+
addParticipant: { get: () => super.addParticipant }
|
|
274
|
+
});
|
|
275
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
276
|
+
const updatedTopic = yield this.shareWith(body.dataOwnerId, topic, {
|
|
277
|
+
requestedPermissions: RequestedPermissionEnum.FULL_WRITE,
|
|
278
|
+
});
|
|
279
|
+
return (yield this.decrypt([yield _super.addParticipant.call(this, body, updatedTopic.id)]))[0];
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Remove the participant with the given data owner id from the topic with the given id.
|
|
284
|
+
* @param body data owner id of the participant to remove.
|
|
285
|
+
* @param topicId Id of the topic from which the participant should be removed.
|
|
286
|
+
* @return the updated decrypted topic.
|
|
287
|
+
*/
|
|
288
|
+
removeParticipant(body, topicId) {
|
|
289
|
+
const _super = Object.create(null, {
|
|
290
|
+
removeParticipant: { get: () => super.removeParticipant }
|
|
291
|
+
});
|
|
292
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
293
|
+
const updatedTopic = yield _super.removeParticipant.call(this, body, topicId);
|
|
294
|
+
return (yield this.decrypt([updatedTopic]))[0];
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
subscribeToTopicEvents(eventTypes, filter, eventFired, options = {}) {
|
|
298
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
299
|
+
return yield (0, utils_1.subscribeToEntityEvents)(this.host, this.authApi, 'Topic', eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decrypt([encrypted]))[0]; })).then((rs) => new Connection_1.ConnectionImpl(rs));
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
createDelegationDeAnonymizationMetadata(entity, delegates) {
|
|
303
|
+
return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: 'Topic' }, delegates);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
exports.IccTopicXApi = IccTopicXApi;
|
|
307
|
+
//# sourceMappingURL=icc-topic-x-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icc-topic-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-topic-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAoD;AAIpD,kDAAiD;AAGjD,0EAAgG;AAChG,wEAAoE;AAGpE,qFAAiF;AAKjF,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AACzD,IAAO,uBAAuB,GAAG,uCAAkB,CAAC,uBAAuB,CAAA;AAC3E,mCAAqH;AAErH,4DAAwE;AAExE,qCAAqC;AACrC,MAAa,YAAa,SAAQ,qBAAW;IAG3C,YACE,IAAY,EACZ,OAAkC,EACjB,MAAqB,EACrB,YAA8B,EAC9B,OAAmB,EACnB,cAAuB,EACxC,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,gBAA+B,CAAC,aAAa,CAAC,EAC9C,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,OAAO,IAAI,KAAK,WA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;KAAA;IAED,uCAAuC,CAAC,MAAa,EAAE,SAAmB;QACxE,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,iCAAiC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,SAAS,CAAC,CAAA;IACvH,CAAC;CACF;AAhVD,oCAgVC","sourcesContent":["import { IccAuthApi, IccTopicApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport * as _ from 'lodash'\nimport * as models from '../icc-api/model/models'\nimport { ListOfIds, MaintenanceTask, Topic, TopicRole } 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 { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { ShareResult } from './utils/ShareResult'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { FilterChainTopic } from '../icc-api/model/FilterChainTopic'\nimport { PaginatedListTopic } from '../icc-api/model/PaginatedListTopic'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { EncryptedFieldsManifest, parseEncryptedFields, subscribeToEntityEvents, SubscriptionOptions } from './utils'\nimport { AbstractFilter } from './filters/filters'\nimport { Connection, ConnectionImpl } from '../icc-api/model/Connection'\n\n// noinspection JSUnusedGlobalSymbols\nexport class IccTopicXApi extends IccTopicApi implements EncryptedEntityXApi<models.Topic> {\n private readonly encryptedFields: EncryptedFieldsManifest\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private readonly crypto: IccCryptoXApi,\n private readonly dataOwnerApi: IccDataOwnerXApi,\n private readonly authApi: IccAuthApi,\n private readonly autofillAuthor: boolean,\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n encryptedKeys: Array<string> = ['description'],\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\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'Topic.')\n }\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'Topic'))\n }\n\n /**\n * Creates a new instance of topic with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this topic refers to.\n * @param c initialised data for the topic. 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 * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the topic. The default value will be a\n * secret id of patient known by the topmost parent in the current data owner hierarchy.\n * @return a new instance of topic.\n */\n async newInstance(\n user: models.User,\n patient: models.Patient | null,\n c: Topic = {}, // TODO: Why this isn't Topic?\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n preferredSfk?: string\n } = {}\n ) {\n if (!patient && options.preferredSfk) throw new Error('preferredSfk can only be specified if patient is specified.')\n\n const topic = {\n ...(c ?? {}),\n id: c?.id ?? this.crypto.primitives.randomUuid(),\n _type: 'org.taktik.icure.entities.Topic',\n created: c?.created ?? new Date().getTime(),\n modified: c?.modified ?? new Date().getTime(),\n responsible: c?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: c?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: c?.codes ?? [],\n tags: c?.tags ?? [],\n }\n\n const extraDelegations = {\n ...Object.fromEntries((user.autoDelegations?.all ?? []).map((d) => [d, AccessLevelEnum.WRITE])),\n ...(options?.additionalDelegates ?? {}),\n }\n\n const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (ownerId !== (await this.dataOwnerApi.getCurrentDataOwnerId())) throw new Error('Can only initialise entities as current data owner.')\n const sfk = patient\n ? options.preferredSfk ?? (await this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: patient, type: 'Patient' }))\n : undefined\n\n if (patient && !sfk) throw new Error(`Couldn't find any sfk of parent patient ${patient.id}`)\n\n return new models.Topic(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(topic, 'Topic', patient?.id, sfk, true, false, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n async decrypt(topics: Array<models.Topic>) {\n return await Promise.all(\n topics.map((topic) => this.crypto.xapi.decryptEntity(topic, 'Topic', (x) => new models.Topic(x)).then(({ entity }) => entity))\n )\n }\n\n async encrypt(topics: Array<models.Topic>): Promise<Array<models.Topic>> {\n return await Promise.all(\n topics.map((p) => this.crypto.xapi.tryEncryptEntity(p, 'Topic', this.encryptedFields, true, false, (x) => new models.Topic(x)))\n )\n }\n\n /**\n * Create and share a new topic with other participants.\n * @param body the topic to create.\n * @return the created topic.\n */\n override async createTopic(body: Topic): Promise<Topic> {\n const encryptedTopics = await this.encrypt([body])\n const createdTopic = await super.createTopic(encryptedTopics[0])\n const decryptedTopics = await this.decrypt([createdTopic])\n return decryptedTopics[0]\n }\n\n /**\n * @param topic a topic\n * @return the id of the patient that the topic refers to, retrieved from the encrypted metadata. Normally there should only be one element\n * in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(topic: models.Topic): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: topic, type: 'Topic' }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given topic\n */\n async hasWriteAccess(topic: models.Topic): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: topic, type: 'Topic' })\n }\n\n /**\n * Share an existing topic with other data owners, allowing them to access the non-encrypted data of the topic 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 topic.\n * @param topic the topic 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}).\n * - sharePatientId: specifies if the id of the patient that this topic refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\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 topic: models.Topic,\n options: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Topic> {\n return this.shareWithMany(topic, { [delegateId]: options })\n }\n\n /**\n * Share an existing topic with other data owners, allowing them to access the non-encrypted data of the topic and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param topic the topic 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 * topic does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this topic refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWithMany(\n topic: models.Topic,\n delegates: {\n [delegateId: string]: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Topic> {\n return (await this.tryShareWithMany(topic, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing topic with other data owners, allowing them to access the non-encrypted data of the topic and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param topic the topic 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 * topic does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this topic refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\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 topic: models.Topic,\n delegates: {\n [delegateId: string]: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.Topic>> {\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(topic, 'Topic')\n const updatedEntity = entityWithEncryptionKey ? await this.modifyTopic(entityWithEncryptionKey) : topic\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n { entity: updatedEntity, type: 'Topic' },\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: options.sharePatientId,\n shareSecretIds: undefined,\n },\n ])\n ),\n (x) => this.bulkShareTopics(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decrypt([e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: models.Topic\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: 'Topic' })\n }\n\n getEncryptionKeysOf(entity: models.Topic): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: 'Topic' }, undefined)\n }\n\n /**\n * Filter and decrypt topics by the given filter.\n * @param body the filter to apply.\n * @param startDocumentId the document id to start from (inclusive).\n * @param limit the maximum number of topics to return in the page.\n * @return a paginated list of topics.\n */\n override async filterTopicsBy(body: FilterChainTopic, startDocumentId?: string, limit?: number): Promise<PaginatedListTopic> {\n const page = await super.filterTopicsBy(body, startDocumentId, limit)\n const decryptedTopics = await this.decrypt(page.rows ?? [])\n return {\n ...page,\n rows: decryptedTopics,\n }\n }\n\n /**\n * Obtain the topic with the given id and decrypt it.\n * @param id the id of the topic to retrieve.\n * @return the decrypted topic.\n */\n override async getTopic(id: string): Promise<Topic> {\n const topic = await super.getTopic(id)\n const decryptedTopics = await this.decrypt([topic])\n return decryptedTopics[0]\n }\n\n /**\n * Obtain the topics with the given ids and decrypt them.\n * @param body the ids of the topics to retrieve.\n * @return the decrypted topics.\n */\n override async getTopics(body: ListOfIds): Promise<Array<Topic>> {\n const topics = await super.getTopics(body)\n return await this.decrypt(topics)\n }\n\n /**\n * Update and encrypt the given topic.\n * @param body the topic to update.\n * @return the updated decrypted topic.\n */\n override async modifyTopic(body: Topic): Promise<Topic> {\n const encryptedTopics = await this.encrypt([body])\n const modifiedTopic = await super.modifyTopic(encryptedTopics[0])\n const decryptedTopics = await this.decrypt([modifiedTopic])\n return decryptedTopics[0]\n }\n\n /**\n * @internal this method is for internal use only and may be changed without notice\n * @param body data owner id of the data owner to which the participant should be added and the topic role of the participant.\n * @param topicId Id of the topic to which the participant should be added.\n */\n override async addParticipant(body: { dataOwnerId: string; topicRole: TopicRole }, topicId: string): Promise<Topic> {\n throw new Error('Cannot add participant to topic without sharing it first. You should use addParticipantWithTopic instead.')\n }\n\n /**\n * This method is similar to {@link addParticipant} but it also shares the topic with the data owner before adding the participant.\n * @param body data owner id of the data owner to which the participant should be added and the topic role of the participant.\n * @param topic the topic to share and to which the participant should be added.\n * @return the updated topic.\n */\n async addParticipantWithTopic(body: { dataOwnerId: string; topicRole: TopicRole }, topic: Topic): Promise<Topic> {\n const updatedTopic = await this.shareWith(body.dataOwnerId, topic, {\n requestedPermissions: RequestedPermissionEnum.FULL_WRITE,\n })\n\n return (await this.decrypt([await super.addParticipant(body, updatedTopic.id!)]))[0]\n }\n\n /**\n * Remove the participant with the given data owner id from the topic with the given id.\n * @param body data owner id of the participant to remove.\n * @param topicId Id of the topic from which the participant should be removed.\n * @return the updated decrypted topic.\n */\n async removeParticipant(body: { dataOwnerId: string }, topicId: string): Promise<Topic> {\n const updatedTopic = await super.removeParticipant(body, topicId)\n return (await this.decrypt([updatedTopic]))[0]\n }\n\n async subscribeToTopicEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Topic> | undefined,\n eventFired: (message: Topic) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n return await subscribeToEntityEvents(\n this.host,\n this.authApi,\n 'Topic',\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted) => (await this.decrypt([encrypted]))[0]\n ).then((rs) => new ConnectionImpl(rs))\n }\n\n createDelegationDeAnonymizationMetadata(entity: Topic, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: 'Topic' }, delegates)\n }\n}\n"]}
|
package/icc-x-api/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ import { IccDeviceXApi } from './icc-device-x-api';
|
|
|
27
27
|
import { IccBekmehrXApi } from './icc-bekmehr-x-api';
|
|
28
28
|
import { IccDoctemplateXApi } from './icc-doctemplate-x-api';
|
|
29
29
|
import { UserGroup } from '../icc-api/model/UserGroup';
|
|
30
|
+
import { IccTopicXApi } from './icc-topic-x-api';
|
|
31
|
+
import { IccRoleApi } from '../icc-api/api/IccRoleApi';
|
|
30
32
|
export * from './icc-accesslog-x-api';
|
|
31
33
|
export * from './icc-bekmehr-x-api';
|
|
32
34
|
export * from './icc-calendar-item-x-api';
|
|
@@ -51,6 +53,7 @@ export * from './icc-maintenance-task-x-api';
|
|
|
51
53
|
export * from './utils';
|
|
52
54
|
export * from './crypto/RSA';
|
|
53
55
|
export * from './crypto/CryptoPrimitives';
|
|
56
|
+
export * from './crypto/ShareMetadataBehaviour';
|
|
54
57
|
export * from './auth/AuthenticationProvider';
|
|
55
58
|
export { KeyStorageFacade } from './storage/KeyStorageFacade';
|
|
56
59
|
export { LocalStorageImpl } from './storage/LocalStorageImpl';
|
|
@@ -106,6 +109,8 @@ export interface Apis {
|
|
|
106
109
|
readonly replicationApi: IccReplicationApi;
|
|
107
110
|
readonly tarificationApi: IccTarificationApi;
|
|
108
111
|
readonly tmpApi: IccTmpApi;
|
|
112
|
+
readonly topicApi: IccTopicXApi;
|
|
113
|
+
readonly roleApi: IccRoleApi;
|
|
109
114
|
}
|
|
110
115
|
/**
|
|
111
116
|
* Allows to customise the behaviour of the iCure API by providing various optional parameters.
|
|
@@ -303,6 +308,16 @@ export interface EncryptedFieldsConfig {
|
|
|
303
308
|
* @default ['note', 'notes[].markdown']
|
|
304
309
|
*/
|
|
305
310
|
readonly patient?: string[];
|
|
311
|
+
/**
|
|
312
|
+
* Fields to encrypt for entities of type {@link Message}
|
|
313
|
+
* @default []
|
|
314
|
+
*/
|
|
315
|
+
readonly message?: string[];
|
|
316
|
+
/**
|
|
317
|
+
* Fields to encrypt for entities of type {@link Topic}
|
|
318
|
+
* @default ['description']
|
|
319
|
+
*/
|
|
320
|
+
readonly topic?: string[];
|
|
306
321
|
}
|
|
307
322
|
export declare namespace EncryptedFieldsConfig {
|
|
308
323
|
const Defaults: {
|
|
@@ -313,6 +328,8 @@ export declare namespace EncryptedFieldsConfig {
|
|
|
313
328
|
healthElement: string[];
|
|
314
329
|
maintenanceTask: string[];
|
|
315
330
|
patient: string[];
|
|
331
|
+
message: never[];
|
|
332
|
+
topic: string[];
|
|
316
333
|
};
|
|
317
334
|
}
|
|
318
335
|
/**
|