@icure/api 7.1.16 → 8.0.0-RC.2
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 +38 -25
- package/icc-api/api/IccDocumentApi.js +279 -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 +28 -1
- package/icc-api/api/IccMessageApi.js +294 -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/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/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/api/IccTopicApi.d.ts +90 -0
- package/icc-api/api/IccTopicApi.js +193 -0
- package/icc-api/api/IccTopicApi.js.map +1 -0
- package/icc-api/index.d.ts +2 -0
- package/icc-api/index.js +2 -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 +2 -0
- package/icc-api/model/AccessLog.js.map +1 -1
- package/icc-api/model/Article.d.ts +2 -0
- package/icc-api/model/Article.js.map +1 -1
- package/icc-api/model/CalendarItem.d.ts +2 -0
- package/icc-api/model/CalendarItem.js.map +1 -1
- package/icc-api/model/Classification.d.ts +2 -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/Connection.d.ts +1 -1
- package/icc-api/model/Connection.js.map +1 -1
- package/icc-api/model/Contact.d.ts +2 -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 +2 -0
- package/icc-api/model/Document.js.map +1 -1
- 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/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 +2 -0
- package/icc-api/model/Form.js.map +1 -1
- package/icc-api/model/HealthElement.d.ts +2 -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 +13 -1
- 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 +2 -0
- package/icc-api/model/Invoice.js.map +1 -1
- package/icc-api/model/MaintenanceTask.d.ts +13 -10
- package/icc-api/model/MaintenanceTask.js +13 -11
- package/icc-api/model/MaintenanceTask.js.map +1 -1
- package/icc-api/model/Message.d.ts +2 -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/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 +4 -2
- 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 +2 -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 +2 -0
- 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/internal/ExchangeData.d.ts +64 -0
- package/icc-api/model/internal/ExchangeData.js +15 -0
- package/icc-api/model/internal/ExchangeData.js.map +1 -0
- package/icc-api/model/internal/ExchangeDataMap.d.ts +24 -0
- package/icc-api/model/internal/ExchangeDataMap.js +13 -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 +26 -40
- package/icc-api/model/models.js +19 -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 +55 -6
- 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 +18 -0
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js +50 -0
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js.map +1 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.d.ts +43 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.js +97 -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/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 +97 -0
- package/icc-x-api/crypto/ExchangeDataManager.js +501 -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 +326 -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 +174 -0
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +559 -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 +33 -0
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js +141 -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 +46 -0
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js +312 -0
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js.map +1 -0
- package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +97 -0
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js +79 -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/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 +49 -12
- package/icc-x-api/icc-accesslog-x-api.js +81 -44
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +53 -15
- package/icc-x-api/icc-calendar-item-x-api.js +105 -51
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.d.ts +47 -10
- package/icc-x-api/icc-classification-x-api.js +62 -33
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +59 -33
- package/icc-x-api/icc-contact-x-api.js +101 -66
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +33 -333
- package/icc-x-api/icc-crypto-x-api.js +47 -764
- 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 +51 -12
- package/icc-x-api/icc-document-x-api.js +117 -66
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +48 -11
- package/icc-x-api/icc-form-x-api.js +71 -37
- 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 +59 -20
- package/icc-x-api/icc-helement-x-api.js +78 -43
- 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 +53 -16
- package/icc-x-api/icc-invoice-x-api.js +69 -35
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.d.ts +56 -22
- package/icc-x-api/icc-maintenance-task-x-api.js +77 -36
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.d.ts +75 -19
- package/icc-x-api/icc-message-x-api.js +126 -37
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +86 -29
- package/icc-x-api/icc-patient-x-api.js +318 -379
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +47 -13
- package/icc-x-api/icc-receipt-x-api.js +72 -36
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.d.ts +46 -13
- package/icc-x-api/icc-time-table-x-api.js +61 -27
- 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/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 +18 -2
- package/icc-x-api/index.js +203 -156
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/maintenance/KeyPairUpdateRequest.d.ts +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 +14 -10
- package/icc-x-api/utils/websocket.js +26 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-patient-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-patient-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAoD;AAU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,CAAA;QAC5D,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACG,aAAa,CAAC,IAAa,EAAE,UAAmB;;;;;YACpD,MAAM,eAAe,GAAG,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YAC1E,MAAM,MAAM,GAAG,MAAM,OAAM,iBAAiB,YAAC,IAAI,CAAC,EAAG,EAAE,IAAI,CAAC,GAAI,EAAE,eAAe,CAAC,CAAA;YAClF,OAAO,CAAC,MAAM,IAAI,CAAC,0BAA0B,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;QAC/E,CAAC;KAAA;IAEK,wBAAwB,CAC5B,UAA8C,EAC9C,MAA2C,EAC3C,UAA+C,EAC/C,UAA+B,EAAE;;YAEjC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAA;YACvD,OAAO,IAAA,mCAAuB,EAC5B,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ,SAAS,EACT,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;iBACE,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,2BAAc,CAAC,EAAE,CAAC,CAAC,CAAA;QACzC,CAAC;KAAA;CACF;AApwCD,wCAowCC","sourcesContent":["import {IccAuthApi, IccPatientApi} from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport { IccContactXApi } from './icc-contact-x-api'\nimport { IccFormXApi } from './icc-form-x-api'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { IccInvoiceXApi } from './icc-invoice-x-api'\nimport { IccDocumentXApi } from './icc-document-x-api'\nimport { IccHelementXApi } from './icc-helement-x-api'\nimport { IccClassificationXApi } from './icc-classification-x-api'\n\nimport * as _ from 'lodash'\nimport * as models from '../icc-api/model/models'\nimport { CalendarItem, Classification, Document, IcureStub, Invoice, ListOfIds, Patient } from '../icc-api/model/models'\nimport { IccCalendarItemXApi } from './icc-calendar-item-x-api'\nimport { b64_2ab } from '../icc-api/model/ModelHelper'\nimport { findName, garnishPersonWithName, hasName } from './utils/person-util'\nimport {EncryptedFieldsManifest, parseEncryptedFields, retry, SubscriptionOptions} from './utils'\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 {AbstractFilter} from \"./filters/filters\"\nimport {Connection, ConnectionImpl} from \"../icc-api/model/Connection\"\nimport {subscribeToEntityEvents} from \"./utils/websocket\"\nimport {IccUserXApi} from \"./icc-user-x-api\"\n\n// noinspection JSUnusedGlobalSymbols\nexport class IccPatientXApi extends IccPatientApi implements EncryptedEntityXApi<models.Patient> {\n crypto: IccCryptoXApi\n contactApi: IccContactXApi\n formApi: IccFormXApi\n helementApi: IccHelementXApi\n invoiceApi: IccInvoiceXApi\n hcpartyApi: IccHcpartyXApi\n documentApi: IccDocumentXApi\n classificationApi: IccClassificationXApi\n calendarItemApi: IccCalendarItemXApi\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 contactApi: IccContactXApi,\n formApi: IccFormXApi,\n helementApi: IccHelementXApi,\n invoiceApi: IccInvoiceXApi,\n documentApi: IccDocumentXApi,\n hcpartyApi: IccHcpartyXApi,\n classificationApi: IccClassificationXApi,\n dataOwnerApi: IccDataOwnerXApi,\n calendarItemaApi: IccCalendarItemXApi,\n userApi: IccUserXApi,\n authApi: IccAuthApi,\n encryptedKeys: Array<string> = ['note'],\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.contactApi = contactApi\n this.formApi = formApi\n this.helementApi = helementApi\n this.invoiceApi = invoiceApi\n this.hcpartyApi = hcpartyApi\n this.documentApi = documentApi\n this.classificationApi = classificationApi\n this.calendarItemApi = calendarItemaApi\n this.dataOwnerApi = dataOwnerApi\n this.userApi = userApi\n this.authApi = authApi\n\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'Patient.')\n }\n\n /**\n * Creates a new instance of patient with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param p initialised data for the patient. 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 patient.\n */\n async newInstance(\n user: models.User,\n p: any = {},\n options: {\n additionalDelegates?: { [dataOwnerId: string]: 'WRITE' }\n } = {}\n ) {\n const patient = {\n ...(p ?? {}),\n _type: 'org.taktik.icure.entities.Patient',\n id: p?.id ?? this.crypto.primitives.randomUuid(),\n created: p?.created ?? new Date().getTime(),\n modified: p?.modified ?? new Date().getTime(),\n responsible: p?.responsible ?? this.dataOwnerApi.getDataOwnerIdOf(user),\n author: p?.author ?? user.id,\n codes: p?.codes ?? [],\n tags: p?.tags ?? [],\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 extraDelegations = [\n ...Object.keys(options.additionalDelegates ?? {}),\n ...(user.autoDelegations?.all ?? []),\n ...(user.autoDelegations?.medicalInformation ?? []),\n ]\n const initialisationInfo = await this.crypto.entities.entityWithInitialisedEncryptedMetadata(\n patient,\n undefined,\n undefined,\n true,\n extraDelegations\n )\n return new models.Patient(initialisationInfo.updatedEntity)\n }\n\n completeNames(patient: models.Patient): models.Patient {\n let finalPatient = patient\n\n if (!!finalPatient.lastName && !hasName(finalPatient, models.PersonName.UseEnum.Official)) {\n finalPatient = garnishPersonWithName(finalPatient, models.PersonName.UseEnum.Official, finalPatient.lastName, finalPatient.firstName)\n }\n\n if (!!finalPatient.maidenName && !hasName(finalPatient, models.PersonName.UseEnum.Maiden)) {\n finalPatient = garnishPersonWithName(finalPatient, models.PersonName.UseEnum.Maiden, finalPatient.maidenName, finalPatient.firstName)\n }\n\n if (!!finalPatient.alias && !hasName(finalPatient, models.PersonName.UseEnum.Nickname)) {\n finalPatient = garnishPersonWithName(finalPatient, models.PersonName.UseEnum.Nickname, finalPatient.alias, finalPatient.firstName)\n }\n\n if (!finalPatient.lastName && !!hasName(finalPatient, models.PersonName.UseEnum.Official)) {\n const officialName = findName(finalPatient, models.PersonName.UseEnum.Official)\n finalPatient = {\n ...finalPatient,\n lastName: officialName!.lastName,\n firstName: officialName!.firstNames?.[0],\n }\n }\n\n if (!finalPatient.maidenName && !!hasName(finalPatient, models.PersonName.UseEnum.Maiden)) {\n finalPatient = {\n ...finalPatient,\n maidenName: findName(finalPatient, models.PersonName.UseEnum.Maiden)!.lastName,\n }\n }\n\n if (!finalPatient.alias && !!hasName(finalPatient, models.PersonName.UseEnum.Nickname)) {\n finalPatient = {\n ...finalPatient,\n alias: findName(finalPatient, models.PersonName.UseEnum.Nickname)!.lastName,\n }\n }\n\n return finalPatient\n }\n\n /**\n * @deprecated replace with {@link initConfidentialSecretId}\n */\n async initConfidentialDelegation(patient: models.Patient, user: models.User): Promise<models.Patient> {\n return this.initConfidentialSecretId(patient, user)\n }\n\n /**\n * Ensures that the current data owner has some confidential secret ids for the provided patient. If not creates them and updates the patient in the\n * database.\n * @param patient the patient for which you want to initialise the confidential secret id.\n * @param user the current user.\n * @return the updated patient or the original patient if no change was necessary.\n */\n async initConfidentialSecretId(patient: models.Patient, user: models.User): Promise<models.Patient> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (dataOwnerId !== (await this.dataOwnerApi.getCurrentDataOwnerId()))\n throw new Error('You can initialise confidential delegations only for the current data owner')\n const initialised = await this.crypto.confidential.entityWithInitialisedConfidentialSecretId(patient)\n if (initialised) {\n return initialised.rev ? this.modifyPatientWithUser(user, initialised) : this.createPatientWithUser(user, initialised)\n } else {\n return patient\n }\n }\n\n createPatient(body?: models.Patient): never {\n throw new Error('Cannot call a method that returns patients without providing a user for de/encryption')\n }\n\n createPatientWithUser(user: models.User, body?: models.Patient): Promise<models.Patient | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(this.completeNames(body))])\n .then((pats) => super.createPatient(pats[0]))\n .then((p) => this.decrypt(user, [p]))\n .then((pats) => pats[0])\n : Promise.resolve(null)\n }\n\n filterBy(\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n skip?: number,\n sort?: string,\n desc?: boolean,\n body?: models.FilterChainPatient\n ): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n filterByWithUser(\n user: models.User,\n filterChain: models.FilterChainPatient,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n skip?: number,\n sort?: string,\n desc?: boolean\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .filterPatientsBy(startKey, startDocumentId, limit, skip, sort, desc, filterChain)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n findByAccessLogUserAfterDate(\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n findByAccessLogUserAfterDateWithUser(\n user: models.User,\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .findByAccessLogUserAfterDate(userId, accessType, startDate, startKey, startDocumentId, limit)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n findByAccessLogUserAfterDate_1(externalId: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n findByExternalIdWithUser(user: models.User, externalId: string): Promise<models.Patient | any> {\n return super\n .findByExternalId(externalId)\n .then((pats) => this.decrypt(user, [pats]))\n .then((x) => x[0])\n }\n\n findByNameBirthSsinAuto(\n healthcarePartyId?: string,\n filterValue?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n findByNameBirthSsinAutoWithUser(\n user: models.User,\n healthcarePartyId?: string,\n filterValue?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .findByNameBirthSsinAuto(healthcarePartyId, filterValue, startKey, startDocumentId, limit, sortDirection)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n fuzzySearch(firstName?: string, lastName?: string, dateOfBirth?: number): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n fuzzySearchWithUser(user: models.User, firstName?: string, lastName?: string, dateOfBirth?: number): Promise<Array<models.Patient> | any> {\n return super.fuzzySearch(firstName, lastName, dateOfBirth).then((pats) => this.decrypt(user, pats))\n }\n\n getPatient(patientId: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n getPatientRaw(patientId: string): Promise<models.Patient | any> {\n return super.getPatient(patientId)\n }\n\n getPatientWithUser(user: models.User, patientId: string): Promise<models.Patient | any> {\n return super\n .getPatient(patientId)\n .then((p) => this.tryDecryptOrReturnOriginal(this.dataOwnerApi.getDataOwnerIdOf(user), [p]))\n .then((pats) => pats[0].entity)\n }\n\n getPotentiallyEncryptedPatientWithUser(user: models.User, patientId: string): Promise<{ patient: models.Patient; decrypted: boolean }> {\n return super\n .getPatient(patientId)\n .then((p) => this.tryDecryptOrReturnOriginal(this.dataOwnerApi.getDataOwnerIdOf(user), [p]))\n .then((pats) => ({ patient: pats[0].entity, decrypted: pats[0].decrypted }))\n }\n\n getPatients(body?: models.ListOfIds): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n getPatientsWithUser(user: models.User, body?: models.ListOfIds): Promise<Array<models.Patient> | any> {\n return super.getPatients(body).then((pats) => this.decrypt(user, pats))\n }\n\n listDeletedPatients(startDate?: number, endDate?: number, desc?: boolean, startDocumentId?: string, limit?: number): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listDeletedPatientsWithUser(\n user: models.User,\n startDate?: number,\n endDate?: number,\n desc?: boolean,\n startDocumentId?: string,\n limit?: number\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .listDeletedPatients(startDate, endDate, desc, startDocumentId, limit)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n listDeletedPatients_2(firstName?: string, lastName?: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listDeletedPatientsByNameWithUser(user: models.User, firstName?: string, lastName?: string): Promise<Array<models.Patient> | any> {\n return super.listDeletedPatientsByName(firstName, lastName).then((rows) => this.decrypt(user, rows, false))\n }\n\n listOfMergesAfter(date: number): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listOfMergesAfterWithUser(user: models.User, date: number): Promise<Array<models.Patient> | any> {\n return super.listOfMergesAfter(date).then((pats) => this.decrypt(user, pats, false))\n }\n\n listOfPatientsModifiedAfter(date: number, startKey?: number, startDocumentId?: string, limit?: number): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listOfPatientsModifiedAfterWithUser(\n user: models.User,\n date: number,\n startKey?: number,\n startDocumentId?: string,\n limit?: number\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .listOfPatientsModifiedAfter(date, startKey, startDocumentId, limit)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n listPatients(hcPartyId?: string, sortField?: string, startKey?: string, startDocumentId?: string, limit?: number, sortDirection?: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listPatientsWithUser(\n user: models.User,\n hcPartyId?: string,\n sortField?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .listPatients(hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n listPatientsByHcParty(\n hcPartyId: string,\n sortField?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listPatientsByHcPartyWithUser(\n user: models.User,\n hcPartyId: string,\n sortField?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .listPatientsByHcParty(hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n listPatientsOfHcParty(\n hcPartyId: string,\n sortField?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listPatientsOfHcPartyWithUser(\n user: models.User,\n hcPartyId: string,\n sortField?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .listPatientsOfHcParty(hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n mergeInto(toId: string, fromIds: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n mergeIntoWithUser(user: models.User, toId: string, fromIds: string): Promise<models.Patient | any> {\n return super\n .mergeInto(toId, fromIds)\n .then((p) => this.decrypt(user, [p]))\n .then((pats) => pats[0])\n }\n\n modifyPatient(body?: models.Patient): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n modifyPatientRaw(body?: models.Patient): Promise<models.Patient | any> {\n return super.modifyPatient(body)\n }\n\n modifyPatientWithUser(user: models.User, body?: models.Patient): Promise<models.Patient | null> {\n return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : Promise.resolve(null)\n }\n\n modifyAs(dataOwner: string, body: models.Patient): Promise<models.Patient> {\n return this.encryptAs(dataOwner, [_.cloneDeep(this.completeNames(body))])\n .then((pats) => super.modifyPatient(pats[0]))\n .then((p) => this.tryDecryptOrReturnOriginal(dataOwner, [p]))\n .then((pats) => pats[0].entity)\n }\n\n modifyPatientReferral(patientId: string, referralId: string, start?: number, end?: number): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n modifyPatientReferralWithUser(\n user: models.User,\n patientId: string,\n referralId: string,\n start?: number,\n end?: number\n ): Promise<models.Patient | any> {\n return super\n .modifyPatientReferral(patientId, referralId, start, end)\n .then((p) => this.decrypt(user, [p]))\n .then((pats) => pats[0])\n }\n\n encrypt(user: models.User, pats: Array<models.Patient>): Promise<Array<models.Patient>> {\n return this.encryptAs(this.dataOwnerApi.getDataOwnerIdOf(user), pats)\n }\n\n private encryptAs(dataOwnerId: string | undefined, pats: Array<models.Patient>): Promise<Array<models.Patient>> {\n return Promise.all(\n pats.map((p) => this.crypto.entities.tryEncryptEntity(p, dataOwnerId, this.encryptedFields, true, false, (x) => new models.Patient(x)))\n )\n }\n\n // If patient can't be decrypted returns patient with encrypted data.\n decrypt(user: models.User, patients: Array<models.Patient>, fillDelegations = true): Promise<Array<models.Patient>> {\n return this.tryDecryptOrReturnOriginal(this.dataOwnerApi.getDataOwnerIdOf(user), patients).then((ps) => ps.map((p) => p.entity))\n }\n\n tryDecryptOrReturnOriginal(\n dataOwnerId: string | undefined,\n patients: Array<models.Patient>\n ): Promise<{ entity: models.Patient; decrypted: boolean }[]> {\n return Promise.all(\n patients.map(\n async (p) =>\n await this.crypto.entities\n .decryptEntity(p, dataOwnerId, (x) => new models.Patient(x))\n .then((p) => {\n if (p.entity.picture && !(p.entity.picture instanceof ArrayBuffer)) {\n return {\n entity: new models.Patient({\n ...p.entity,\n picture: b64_2ab(p.entity.picture),\n }),\n decrypted: p.decrypted,\n }\n } else return p\n })\n )\n )\n }\n\n share(\n user: models.User,\n patId: string,\n ownerId: string,\n delegateIds: Array<string>,\n delegationTags: { [key: string]: Array<string> },\n usingPost: boolean = false\n ): Promise<{\n patient: models.Patient | null\n statuses: { [key: string]: { success: boolean | null; error: Error | null } }\n } | null> {\n const addDelegationsAndKeys = (\n dtos: Array<models.Form | models.Document | models.Contact | models.HealthElement | models.Classification | models.CalendarItem>,\n markerPromise: Promise<any>,\n delegateId: string,\n patient: models.Patient | null\n ) => {\n return dtos.reduce(\n (p, x) =>\n p.then(async () => {\n const secretIds = await this.crypto.entities.secretIdsOf(x, ownerId)\n const encryptionKeys = await this.crypto.entities.encryptionKeysOf(x, ownerId)\n const parentIds = await this.crypto.entities.owningEntityIdsOf(x, ownerId)\n const updatedX = await this.crypto.entities\n .entityWithExtendedEncryptedMetadata(x, delegateId, secretIds, encryptionKeys, parentIds, [])\n .catch((e: any) => {\n console.log(e)\n return x\n })\n _.assign(x, updatedX)\n return x\n }),\n markerPromise\n )\n }\n\n const allTags: string[] = _.uniq(_.flatMap(Object.values(delegationTags)))\n\n // Determine which keys to share, depending on the delegation tag. For example, anonymousMedicalData only shares encryption keys and no delegations or secret foreign keys.\n const shareDelegations: boolean = allTags.some((tag) => tag != 'anonymousMedicalInformation')\n const shareEncryptionKeys = true\n const shareCryptedForeignKeys: boolean = allTags.some((tag) => tag != 'anonymousMedicalInformation')\n\n // Anonymous sharing, will not change anything to the patient, only its contacts and health elements.\n const shareAnonymously: boolean = allTags.every((tag) => tag == 'anonymousMedicalInformation')\n\n return this.hcpartyApi.getHealthcareParty(ownerId).then((hcp) => {\n const parentId = hcp.parentId\n const status = {\n contacts: {\n success:\n allTags.includes('medicalInformation') || allTags.includes('anonymousMedicalInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n forms: {\n success: allTags.includes('medicalInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n healthElements: {\n success:\n allTags.includes('medicalInformation') || allTags.includes('anonymousMedicalInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n invoices: {\n success: allTags.includes('financialInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n documents: {\n success: allTags.includes('medicalInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n classifications: {\n success: allTags.includes('medicalInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n calendarItems: {\n success: allTags.includes('medicalInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n patient: { success: false, error: null, modified: 0 } as {\n success: boolean\n error: Error | null\n },\n }\n return retry(() => this.getPatientWithUser(user, patId))\n .then((patient: models.Patient) =>\n patient.encryptionKeys && Object.keys(patient.encryptionKeys || {}).length\n ? Promise.resolve(patient)\n : this.crypto.entities.ensureEncryptionKeysInitialised(patient).then((p) => (!!p ? this.modifyPatientWithUser(user, p) : patient))\n )\n .then(async (patient: models.Patient | null) => {\n if (!patient) {\n status.patient = {\n success: false,\n error: new Error('Patient does not exist or cannot initialise encryption keys'),\n }\n return Promise.resolve({ patient: patient, statuses: status })\n }\n\n const delSfks = await this.crypto.entities.secretIdsOf(patient, ownerId)\n const ecKeys = await this.crypto.entities.encryptionKeysOf(patient, ownerId)\n return delSfks.length\n ? Promise.all([\n retry(() =>\n (usingPost\n ? this.helementApi.findHealthElementsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(ownerId, _.uniq(delSfks))\n : this.helementApi.findHealthElementsDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((hes) =>\n parentId\n ? (usingPost\n ? this.helementApi.findHealthElementsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(parentId, _.uniq(delSfks))\n : this.helementApi.findHealthElementsDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreHes) => _.uniqBy(hes.concat(moreHes), 'id'))\n : hes\n )\n ) as Promise<Array<models.IcureStub>>,\n retry(() =>\n (usingPost\n ? this.formApi.findFormsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(ownerId, _.uniq(delSfks))\n : this.formApi.findFormsDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((frms) =>\n parentId\n ? (usingPost\n ? this.formApi.findFormsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(parentId, _.uniq(delSfks))\n : this.formApi.findFormsDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreFrms) => _.uniqBy(frms.concat(moreFrms), 'id'))\n : frms\n )\n ) as Promise<Array<models.Form>>,\n retry(() =>\n (usingPost\n ? this.contactApi.findByHCPartyPatientSecretFKeysUsingPost(ownerId, undefined, undefined, _.uniq(delSfks))\n : this.contactApi.findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((ctcs) =>\n parentId\n ? (usingPost\n ? this.contactApi.findByHCPartyPatientSecretFKeysUsingPost(parentId, undefined, undefined, _.uniq(delSfks))\n : this.contactApi.findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreCtcs) => _.uniqBy(ctcs.concat(moreCtcs), 'id'))\n : ctcs\n )\n ) as Promise<Array<models.Contact>>,\n retry(() =>\n (usingPost\n ? this.invoiceApi.findInvoicesDelegationsStubsByHCPartyPatientForeignKeysUsingPost(ownerId, _.uniq(delSfks))\n : this.invoiceApi.findInvoicesDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((ivs) =>\n parentId\n ? this.invoiceApi\n .findInvoicesDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n .then((moreIvs) => _.uniqBy(ivs.concat(moreIvs), 'id'))\n : ivs\n )\n ) as Promise<Array<models.IcureStub>>,\n retry(() =>\n this.classificationApi\n .findClassificationsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n .then((cls) =>\n parentId\n ? this.classificationApi\n .findClassificationsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n .then((moreCls) => _.uniqBy(cls.concat(moreCls), 'id'))\n : cls\n )\n ) as Promise<Array<models.Classification>>,\n retry(() =>\n (usingPost\n ? this.calendarItemApi.findByHCPartyPatientSecretFKeysArray(ownerId, _.uniq(delSfks))\n : this.calendarItemApi.findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((cls) =>\n parentId\n ? (usingPost\n ? this.calendarItemApi.findByHCPartyPatientSecretFKeysArray(parentId, _.uniq(delSfks))\n : this.calendarItemApi.findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreCls) => _.uniqBy(cls.concat(moreCls), 'id'))\n : cls\n )\n ) as Promise<Array<models.CalendarItem>>,\n ]).then(([hes, frms, ctcs, ivs, cls, cis]) => {\n const cloneKeysAndDelegations = function (x: models.IcureStub) {\n return {\n delegations: shareDelegations ? _.clone(x.delegations) : undefined,\n cryptedForeignKeys: shareCryptedForeignKeys ? _.clone(x.cryptedForeignKeys) : undefined,\n encryptionKeys: shareEncryptionKeys ? _.clone(x.encryptionKeys) : undefined,\n }\n }\n\n const ctcsStubs = ctcs.map((c) => ({\n id: c.id,\n rev: c.rev,\n ...cloneKeysAndDelegations(c),\n }))\n const oHes = hes.map((x) => _.assign(new IcureStub({}), x, cloneKeysAndDelegations(x)))\n const oFrms = frms.map((x) => _.assign(new IcureStub({}), x, cloneKeysAndDelegations(x)))\n const oCtcsStubs = ctcsStubs.map((x) => _.assign({}, x, cloneKeysAndDelegations(x)))\n const oIvs = ivs.map((x) => _.assign(new Invoice({}), x, cloneKeysAndDelegations(x)))\n const oCls = cls.map((x) => _.assign(new Classification({}), x, cloneKeysAndDelegations(x)))\n const oCis = cis.map((x) => _.assign(new CalendarItem({}), x, cloneKeysAndDelegations(x)))\n\n const docIds: { [key: string]: number } = {}\n ctcs.forEach(\n (c: models.Contact) =>\n c.services &&\n c.services.forEach((s) => s.content && Object.values(s.content).forEach((c) => c && c.documentId && (docIds[c.documentId] = 1)))\n )\n\n return retry(() => this.documentApi.getDocuments(new ListOfIds({ ids: Object.keys(docIds) }))).then((docs: Array<Document>) => {\n const oDocs = docs.map((x) => _.assign({}, x, cloneKeysAndDelegations(x)))\n\n let markerPromise: Promise<any> = Promise.resolve(null)\n delegateIds.forEach((delegateId) => {\n const tags = delegationTags[delegateId]\n markerPromise = markerPromise.then(async () => {\n //Share patient\n const updatedPatient = await this.crypto.entities\n .entityWithExtendedEncryptedMetadata(patient, delegateId, delSfks, ecKeys, [], [])\n .catch((e) => {\n console.log(e)\n return patient\n })\n return _.assign(patient, updatedPatient)\n })\n ;(tags.includes('medicalInformation') || tags.includes('anonymousMedicalInformation') || tags.includes('all')) &&\n (markerPromise = addDelegationsAndKeys(hes, markerPromise, delegateId, patient))\n ;(tags.includes('medicalInformation') || tags.includes('all')) &&\n (markerPromise = addDelegationsAndKeys(frms, markerPromise, delegateId, patient))\n ;(tags.includes('medicalInformation') || tags.includes('anonymousMedicalInformation') || tags.includes('all')) &&\n (markerPromise = addDelegationsAndKeys(ctcsStubs, markerPromise, delegateId, patient))\n ;(tags.includes('medicalInformation') || tags.includes('all')) &&\n (markerPromise = addDelegationsAndKeys(cls, markerPromise, delegateId, patient))\n ;(tags.includes('medicalInformation') || tags.includes('all')) &&\n (markerPromise = addDelegationsAndKeys(cis, markerPromise, delegateId, patient))\n ;(tags.includes('financialInformation') || tags.includes('all')) &&\n (markerPromise = addDelegationsAndKeys(ivs, markerPromise, delegateId, patient))\n ;(tags.includes('medicalInformation') || tags.includes('all')) &&\n (markerPromise = addDelegationsAndKeys(docs, markerPromise, delegateId, null))\n })\n\n return markerPromise\n .then(() => {\n //console.log(\"scd\")\n return (\n ((allTags.includes('medicalInformation') || allTags.includes('anonymousMedicalInformation') || allTags.includes('all')) &&\n ctcsStubs &&\n ctcsStubs.length &&\n !_.isEqual(oCtcsStubs, ctcsStubs) &&\n this.contactApi\n .setContactsDelegations(ctcsStubs)\n .then(() => {\n status.contacts.success = true\n status.contacts.modified += ctcsStubs.length\n })\n .catch((e) => (status.contacts.error = e))) ||\n Promise.resolve((status.contacts.success = true))\n )\n })\n .then(() => {\n //console.log(\"shed\")\n return (\n ((allTags.includes('medicalInformation') || allTags.includes('anonymousMedicalInformation') || allTags.includes('all')) &&\n hes &&\n hes.length &&\n !_.isEqual(oHes, hes) &&\n this.helementApi\n .setHealthElementsDelegations(hes)\n .then(() => {\n status.healthElements.success = true\n status.healthElements.modified += hes.length\n })\n .catch((e) => (status.healthElements.error = e))) ||\n Promise.resolve((status.healthElements.success = true))\n )\n })\n .then(() => {\n //console.log(\"sfd\")\n return (\n ((allTags.includes('medicalInformation') || allTags.includes('all')) &&\n frms &&\n frms.length &&\n !_.isEqual(oFrms, frms) &&\n this.formApi\n .setFormsDelegations(frms)\n .then(() => {\n status.forms.success = true\n status.forms.modified += frms.length\n })\n .catch((e) => (status.forms.error = e))) ||\n Promise.resolve((status.forms.success = true))\n )\n })\n .then(() => {\n //console.log(\"sid\")\n return (\n ((allTags.includes('financialInformation') || allTags.includes('all')) &&\n ivs &&\n ivs.length &&\n !_.isEqual(oIvs, ivs) &&\n this.invoiceApi\n .setInvoicesDelegations(ivs)\n .then(() => {\n status.invoices.success = true\n status.invoices.modified += ivs.length\n })\n .catch((e) => (status.invoices.error = e))) ||\n Promise.resolve((status.invoices.success = true))\n )\n })\n .then(() => {\n //console.log(\"sdd\")\n return (\n ((allTags.includes('medicalInformation') || allTags.includes('all')) &&\n docs &&\n docs.length &&\n !_.isEqual(oDocs, docs) &&\n this.documentApi\n .setDocumentsDelegations(docs)\n .then(() => {\n status.documents.success = true\n status.documents.modified += docs.length\n })\n .catch((e) => (status.documents.error = e))) ||\n Promise.resolve((status.documents.success = true))\n )\n })\n .then(() => {\n //console.log(\"scld\")\n return (\n ((allTags.includes('medicalInformation') || allTags.includes('all')) &&\n cls &&\n cls.length &&\n !_.isEqual(oCls, cls) &&\n this.classificationApi\n .setClassificationsDelegations(cls)\n .then(() => {\n status.classifications.success = true\n status.classifications.modified += cls.length\n })\n .catch((e) => (status.classifications.error = e))) ||\n Promise.resolve((status.classifications.success = true))\n )\n })\n .then(() => {\n //console.log(\"scid\")\n return (\n ((allTags.includes('medicalInformation') || allTags.includes('all')) &&\n cis &&\n cis.length &&\n !_.isEqual(oCis, cis) &&\n this.calendarItemApi\n .setCalendarItemsDelegations(cis)\n .then(() => {\n status.calendarItems.success = true\n status.calendarItems.modified += cis.length\n })\n .catch((e) => (status.calendarItems.error = e))) ||\n Promise.resolve((status.calendarItems.success = true))\n )\n })\n .then(() => this.modifyPatientWithUser(user, patient))\n .then((p) => {\n status.patient.success = true\n console.log(\n `c: ${status.contacts.modified}, he: ${status.healthElements.modified}, docs: ${status.documents.modified}, frms: ${status.forms.modified}, ivs: ${status.invoices.modified}, cis: ${status.calendarItems.modified}, cls: ${status.classifications.modified}`\n )\n return { patient: p, statuses: status }\n })\n .catch((e) => {\n status.patient.error = e\n return { patient: patient, statuses: status }\n })\n })\n })\n : (allTags.includes('anonymousMedicalInformation')\n ? // TODO check also in v8 how patient is shared with anonymousMedicalInformation tag\n Promise.resolve(patient)\n : this.modifyPatientWithUser(\n user,\n _.assign(patient, {\n delegations: _.assign(\n patient.delegations,\n delegateIds\n .filter((id) => !patient.delegations || !patient.delegations[id]) //If there are delegations do not modify\n .reduce((acc, del: string) => Object.assign(acc, _.fromPairs([[del, []]])), patient.delegations || {})\n ),\n })\n )\n )\n .then((p) => {\n status.patient.success = true\n return { patient: p, statuses: status }\n })\n .catch((e) => {\n status.patient.error = e\n return { patient: patient, statuses: status }\n })\n })\n })\n }\n\n export(user: models.User, patId: string, ownerId: string, usingPost: boolean = false): Promise<{ id: string }> {\n return this.hcpartyApi.getHealthcareParty(ownerId).then((hcp) => {\n const parentId = hcp.parentId\n\n return retry(() => this.getPatientWithUser(user, patId))\n .then((patient: models.Patient) =>\n patient.encryptionKeys && Object.keys(patient.encryptionKeys || {}).length\n ? Promise.resolve(patient)\n : this.crypto.entities.ensureEncryptionKeysInitialised(patient).then((p) => (!!p ? this.modifyPatientWithUser(user, p) : patient))\n )\n .then(async (patient: models.Patient | null) => {\n if (!patient) {\n return Promise.resolve({ id: patId })\n }\n const delSfks = await this.crypto.entities.secretIdsOf(patient, ownerId)\n return Promise.resolve().then(() => {\n return delSfks.length\n ? Promise.all([\n retry(() =>\n (usingPost\n ? this.helementApi.findByHCPartyPatientSecretFKeysArray(ownerId, _.uniq(delSfks))\n : this.helementApi.findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((hes) =>\n parentId\n ? this.helementApi\n .findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))\n .then((moreHes) => _.uniqBy(hes.concat(moreHes), 'id'))\n : hes\n )\n ) as Promise<Array<models.IcureStub>>,\n retry(() =>\n (usingPost\n ? this.formApi.findFormsByHCPartyPatientForeignKeysUsingPost(ownerId, undefined, undefined, undefined, _.uniq(delSfks))\n : this.formApi.findFormsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((frms) =>\n parentId\n ? (usingPost\n ? this.formApi.findFormsByHCPartyPatientForeignKeysUsingPost(parentId, undefined, undefined, undefined, _.uniq(delSfks))\n : this.formApi.findFormsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreFrms) => _.uniqBy(frms.concat(moreFrms), 'id'))\n : frms\n )\n ) as Promise<Array<models.Form>>,\n retry(() =>\n (usingPost\n ? this.contactApi.findByHCPartyPatientSecretFKeysArray(ownerId, _.uniq(delSfks))\n : this.contactApi.findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((ctcs) =>\n parentId\n ? (usingPost\n ? this.contactApi.findByHCPartyPatientSecretFKeysArray(parentId, _.uniq(delSfks))\n : this.contactApi.findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreCtcs) => _.uniqBy(ctcs.concat(moreCtcs), 'id'))\n : ctcs\n )\n ) as Promise<Array<models.Contact>>,\n retry(() =>\n (usingPost\n ? this.invoiceApi.findInvoicesByHCPartyPatientForeignKeysUsingPost(ownerId, _.uniq(delSfks))\n : this.invoiceApi.findInvoicesByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((ivs) =>\n parentId\n ? (usingPost\n ? this.invoiceApi.findInvoicesByHCPartyPatientForeignKeysUsingPost(parentId, _.uniq(delSfks))\n : this.invoiceApi.findInvoicesByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreIvs) => _.uniqBy(ivs.concat(moreIvs), 'id'))\n : ivs\n )\n ) as Promise<Array<models.IcureStub>>,\n retry(() =>\n this.classificationApi\n .findClassificationsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n .then((cls) =>\n parentId\n ? this.classificationApi\n .findClassificationsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n .then((moreCls) => _.uniqBy(cls.concat(moreCls), 'id'))\n : cls\n )\n ) as Promise<Array<models.Classification>>,\n retry(async () => {\n const delegationSFKs = _.uniq(delSfks).join(',')\n try {\n let calendarItems = await (usingPost\n ? this.calendarItemApi.findByHCPartyPatientSecretFKeysArray(ownerId, _.uniq(delSfks))\n : this.calendarItemApi.findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(',')))\n\n if (parentId) {\n const moreCalendarItems = await (usingPost\n ? this.calendarItemApi.findByHCPartyPatientSecretFKeysArray(parentId, _.uniq(delSfks))\n : this.calendarItemApi.findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(',')))\n calendarItems = _.uniqBy(calendarItems.concat(moreCalendarItems), 'id')\n }\n\n return calendarItems\n } catch (ex) {\n console.log(`exception occured exporting calendarItem for ownerId: ${ownerId} - ${ex}`)\n //throw ex\n }\n }) as Promise<Array<models.CalendarItem>>,\n ]).then(([hes, frms, ctcs, ivs, cls, cis]) => {\n const docIds: { [key: string]: number } = {}\n ctcs.forEach(\n (c: models.Contact) =>\n c.services &&\n c.services.forEach((s) => s.content && Object.values(s.content).forEach((c) => c && c.documentId && (docIds[c.documentId] = 1)))\n )\n\n return retry(() => this.documentApi.getDocuments(new ListOfIds({ ids: Object.keys(docIds) }))).then((docs: Array<Document>) => {\n return {\n id: patId,\n patient: patient,\n contacts: ctcs,\n forms: frms,\n healthElements: hes,\n invoices: ivs,\n classifications: cls,\n calItems: cis,\n documents: docs,\n }\n })\n })\n : Promise.resolve({\n id: patId,\n patient: patient,\n contacts: [],\n forms: [],\n healthElements: [],\n invoices: [],\n classifications: [],\n calItems: [],\n documents: [],\n })\n })\n })\n })\n }\n\n checkInami(inami: string): boolean {\n const num_inami = inami.replace(new RegExp('[^(0-9)]', 'g'), '')\n\n const checkDigit = num_inami.substring(6, 2)\n const numSansCheck = num_inami.substring(0, 6)\n let retour = false\n\n //modulo du niss\n const modINAMI = parseInt(numSansCheck) % 97\n\n //obtention du num de check 97 - le resultat du mod\n const checkDigit_2 = 97 - modINAMI\n\n if (parseInt(checkDigit) == checkDigit_2) {\n retour = true\n }\n return retour\n }\n\n isValidSsin(ssin: string) {\n ssin = ssin.replace(new RegExp('[^(0-9)]', 'g'), '')\n let isValidNiss = false\n\n const normalNumber =\n /^[0-9][0-9](([0][0-9])|([1][0-2]))(([0-2][0-9])|([3][0-1]))(([0-9]{2}[1-9])|([0-9][1-9][0-9])|([1-9][0-9]{2}))(([0-8][0-9])|([9][0-7]))$/.test(\n ssin\n )\n const bisNumber = /^[0-9][0-9](([2][0-9])|([3][0-2]))(([0-2][0-9])|([3][0-1]))[0-9]{3}(([0-8][0-9])|([9][0-7]))$/.test(ssin)\n const terNumber = /^[0-9][0-9](([4][0-9])|([5][0-2]))(([0-2][0-9])|([3][0-1]))[0-9]{3}(([0-8][0-9])|([9][0-7]))$/.test(ssin)\n\n if (normalNumber || bisNumber || terNumber) {\n isValidNiss =\n 97 - (Number(ssin.substring(0, 9)) % 97) === Number(ssin.substring(9, 2))\n ? true\n : 97 - (Number('2' + ssin.substring(0, 9)) % 97) === Number(ssin.substring(9, 2))\n }\n\n return isValidNiss\n }\n\n async getPatientIdOfChildDocumentForHcpAndHcpParents(\n childDocument: models.Invoice | models.CalendarItem | models.Contact | models.AccessLog,\n hcpId: string\n ): Promise<string> {\n const parentIdsArray = await this.crypto.entities.owningEntityIdsOf(childDocument, hcpId)\n\n const multipleParentIds = _.uniq(parentIdsArray).length > 1\n\n if (multipleParentIds) {\n throw 'Child document with id ' + childDocument.id + ' contains multiple parent ids in its CFKs for hcpId: ' + hcpId\n }\n\n const parentId = _.first(parentIdsArray)\n\n if (!parentId) {\n throw 'Parent id is empty in CFK of child document with id ' + childDocument.id + ' for hcpId: ' + hcpId\n }\n\n let patient: models.Patient = await super.getPatient(parentId!)\n\n let mergeLevel = 0\n const maxMergeLevel = 10\n while (patient.mergeToPatientId) {\n mergeLevel++\n if (mergeLevel === maxMergeLevel) {\n throw 'Too many merged levels for parent (Patient) of child document ' + childDocument.id + ' ; hcpId: ' + hcpId\n }\n\n patient = await super.getPatient(patient.mergeToPatientId!)\n }\n\n return patient.id!\n }\n\n /**\n * Share an existing patient with other data owners, allowing them to access the non-encrypted data of the patient and optionally also\n * the encrypted content.\n * @param delegateId the id of the data owner which will be granted access to the patient.\n * @param patient the patient to share.\n * @param shareSecretIds the secret ids of the Patient that the delegate will be given access to. Allows the delegate to search for data where the\n * shared Patient is the owning entity id.\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 * patient does not have encrypted content.\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * @return a promise which will contain the updated patient.\n */\n async shareWith(\n delegateId: string,\n patient: models.Patient,\n shareSecretIds: string[],\n options: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Patient> {\n return this.shareWithMany(patient, { [delegateId]: { shareSecretIds, ...options } })\n }\n\n /**\n * Share an existing patient with other data owners, allowing them to access the non-encrypted data of the patient and optionally also\n * the encrypted content.\n * @param patient the patient 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 * patient does not have encrypted content.\n * - shareSecretIds the secret ids of the Patient that the delegate will be given access to. Allows the delegate to search for data where the\n * shared Patient is the owning entity id.\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * @return a promise which will contain the updated patient.\n */\n async shareWithMany(\n patient: models.Patient,\n delegates: {\n [delegateId: string]: {\n shareSecretIds: string[]\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Patient> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n const extended = await this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(patient, false, delegates)\n if (!!extended) {\n return await this.modifyAs(self, extended)\n } else return patient\n }\n\n /**\n * @param patient a patient\n * @return all the decryptable secret ids of the patient, retrieved from the encrypted metadata. The result may be used to find entities where the\n * patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.\n */\n decryptSecretIdsOf(patient: models.Patient): Promise<string[]> {\n return this.crypto.entities.secretIdsOf(patient, undefined)\n }\n\n /**\n * @param patient a patient\n * @return the confidential secret ids of the patient, retrieved from the encrypted metadata. The result may be used to find entities where the\n * patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.\n */\n decryptConfidentialSecretIdsOf(patient: models.Patient): Promise<string[]> {\n return this.crypto.confidential.getConfidentialSecretIds(patient, undefined)\n }\n\n /**\n * @param patient a patient\n * @return the non-confidential secret ids of the patient, retrieved from the encrypted metadata. The result may be used to find entities where the\n * patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.\n */\n decryptNonConfidentialSecretIdsOf(patient: models.Patient): Promise<string[]> {\n return this.crypto.confidential.getSecretIdsSharedWithParents(patient)\n }\n\n async getDataOwnersWithAccessTo(\n entity: models.Patient\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: 'WRITE' }; hasUnknownAnonymousDataOwners: boolean }> {\n return await this.crypto.entities.getDataOwnersWithAccessTo(entity)\n }\n\n async getEncryptionKeysOf(entity: models.Patient): Promise<string[]> {\n return await this.crypto.entities.encryptionKeysOf(entity)\n }\n\n /**\n * Merge two patients into one. This method performs the following operations:\n * - The `from` patient will be soft-deleted, and it will point to the `into` patient. Only the `deletionDate` and `mergeToPatientId` fields of the\n * patient will be changed (automatically by this method). Note that the value of {@link from} is only used to verify that the client is aware of\n * the last version of the `from` patient: any changes to its content and/or metadata compared to what is actually stored in the database will be\n * ignored.\n * - The metadata of the `into` patient will be automatically updated to contain also the metadata of the `from` patient and to keep track of the\n * merge:\n * - the `mergedIds` will be updated to contain the `from` patient id\n * - all secret ids of the `from` patient will be added to the `into` patient\n * - all data owners (including anonymous data owners) with access to the `from` patient will have the same access to the merged `into` patient\n * (unless they already had greater access to the `into` patient, in which case they keep the greater access)\n * - The content of the `into` patient will be updated to match the content (name, address, note, ...) of the provided {@link mergedInto} parameter.\n * Note that since the metadata is automatically updated by this method you must not change the metadata of the `mergedInto` patient\n * (`delegations`, mergedInto`, ...): if there is any change between the metadata of the provided `mergedInto` patient and the stored patient this\n * method will fail with an error.\n *\n * In case the revisions of {@link from} and/or {@link mergedInto} does not match the latest revisions for these patients in the database this\n * method will fail without soft-deleting the `from` patient and without updating the `into` patient with the merged content and metadata. You will\n * have to retrieve the updated versions of both patients before retrying the merge.\n *\n * Finally, note that this method only merges existing data, and does not perform any automatic sharing of the data. The secret ids and encryption\n * keys will not be shared with users that had access only to one of the entity, you will have to use the {@link shareWith} method after the merge\n * if you want to do so.\n * For example consider hcps A, B with access to P' and hcps A, C with access to P'', and we merge P'' into P'. After the merge:\n * - A has access to all secret ids of the merged patient and to the encryption key of the merged patient\n * - B has access to the encryption key of the merged patient (since it is the same as in P'), but only to the secret id which was originally from\n * the unmerged P'\n * - C has no access to the encryption key of the merged patient, and has access only to the secret id which was originally from the unmerged P''\n *\n * @param from the original, unmodified `from` patient. Its content will be unchanged and its metadata will be automatically updated by this method\n * to reflect the merge.\n * @param mergedInto the `into` patient with updated content result of the merge with the `from` patient, as specified by your application logic.\n * The metadata of the `mergedInto` patient must not differ from the metadata of the stored version of the patient, since it will be automatically\n * updated by the method.\n * @return the updated `into` patient.\n */\n async mergePatients(from: Patient, mergedInto: Patient): Promise<Patient> {\n const encryptedMerged = (await this.encryptAs(undefined, [mergedInto]))[0]\n const merged = await super.baseMergePatients(from.id!, from.rev!, encryptedMerged)\n return (await this.tryDecryptOrReturnOriginal(undefined, [merged]))[0].entity\n }\n\n async subscribeToPatientEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Patient> | undefined,\n eventFired: (patient: Patient) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n const currentUser = await this.userApi.getCurrentUser()\n return subscribeToEntityEvents(\n this.host,\n this.authApi,\n 'Patient',\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted) => (await this.decrypt(currentUser, [encrypted]))[0]\n )\n .then((rs) => new ConnectionImpl(rs))\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"icc-patient-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-patient-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsD;AAUtD,4BAA2B;AAC3B,kDAAiD;AACjD,oDAAkG;AAElG,8DAAsD;AACtD,qDAA8E;AAC9E,mCAA4H;AAE5H,0EAAgG;AAEhG,wEAAoE;AAGpE,qFAAiF;AACjF,4EAAwE;AAExE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AACzD,IAAO,uBAAuB,GAAG,uCAAkB,CAAC,uBAAuB,CAAA;AAK3E,4DAAwE;AAExE,qCAAqC;AACrC,MAAa,cAAe,SAAQ,uBAAa;IAG/C,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,SAAS,CAAC,CAAC,CAAA;IAClH,CAAC;IAED,YACE,IAAY,EACZ,OAAkC,EACjB,MAAqB,EACrB,UAA0B,E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V,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;IAED,uCAAuC,CAAC,MAAe,EAAE,SAAmB;QAC1E,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,iCAAiC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,SAAS,CAAC,CAAA;IACzH,CAAC;CACF;AA/rCD,wCA+rCC","sourcesContent":["import { IccAuthApi, IccPatientApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport { IccContactXApi } from './icc-contact-x-api'\nimport { IccFormXApi } from './icc-form-x-api'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { IccInvoiceXApi } from './icc-invoice-x-api'\nimport { IccDocumentXApi } from './icc-document-x-api'\nimport { IccHelementXApi } from './icc-helement-x-api'\nimport { IccClassificationXApi } from './icc-classification-x-api'\n\nimport * as _ from 'lodash'\nimport * as models from '../icc-api/model/models'\nimport { Document, IcureStub, ListOfIds, MaintenanceTask, Patient } from '../icc-api/model/models'\nimport { IccCalendarItemXApi } from './icc-calendar-item-x-api'\nimport { b64_2ab } from '../icc-api/model/ModelHelper'\nimport { findName, garnishPersonWithName, hasName } from './utils/person-util'\nimport { EncryptedFieldsManifest, parseEncryptedFields, retry, subscribeToEntityEvents, SubscriptionOptions } from './utils'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { EntityWithDelegationTypeName } from './utils/EntityWithDelegationTypeName'\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport { EntityShareOrMetadataUpdateRequest } from '../icc-api/model/requests/EntityShareOrMetadataUpdateRequest'\nimport { MinimalEntityBulkShareResult } from '../icc-api/model/requests/MinimalEntityBulkShareResult'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { ShareResult } from './utils/ShareResult'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { IccUserXApi } from './icc-user-x-api'\nimport { AbstractFilter } from './filters/filters'\nimport { Connection, ConnectionImpl } from '../icc-api/model/Connection'\n\n// noinspection JSUnusedGlobalSymbols\nexport class IccPatientXApi extends IccPatientApi implements EncryptedEntityXApi<models.Patient> {\n private readonly encryptedFields: EncryptedFieldsManifest\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'Patient'))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private readonly crypto: IccCryptoXApi,\n private readonly contactApi: IccContactXApi,\n private readonly formApi: IccFormXApi,\n private readonly helementApi: IccHelementXApi,\n private readonly invoiceApi: IccInvoiceXApi,\n private readonly documentApi: IccDocumentXApi,\n private readonly hcpartyApi: IccHcpartyXApi,\n private readonly classificationApi: IccClassificationXApi,\n private readonly dataOwnerApi: IccDataOwnerXApi,\n private readonly calendarItemApi: IccCalendarItemXApi,\n private readonly userApi: IccUserXApi,\n private readonly authApi: IccAuthApi,\n private readonly autofillAuthor: boolean,\n encryptedKeys: Array<string> = ['note'],\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\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'Patient.')\n }\n\n /**\n * Creates a new instance of patient with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param p initialised data for the patient. 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 patient.\n */\n async newInstance(\n user: models.User,\n p: any = {},\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n } = {}\n ) {\n const patient = {\n ...(p ?? {}),\n _type: 'org.taktik.icure.entities.Patient',\n id: p?.id ?? this.crypto.primitives.randomUuid(),\n created: p?.created ?? new Date().getTime(),\n modified: p?.modified ?? new Date().getTime(),\n responsible: p?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: p?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: p?.codes ?? [],\n tags: p?.tags ?? [],\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 extraDelegations = {\n ...Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.medicalInformation ?? [])].map((d) => [d, AccessLevelEnum.WRITE])\n ),\n ...(options?.additionalDelegates ?? {}),\n }\n const initialisationInfo = await this.crypto.xapi.entityWithInitialisedEncryptedMetadata(\n patient,\n 'Patient',\n undefined,\n undefined,\n true,\n true,\n extraDelegations\n )\n return new models.Patient(initialisationInfo.updatedEntity)\n }\n\n completeNames(patient: models.Patient): models.Patient {\n let finalPatient: any = patient\n\n if (!!finalPatient.lastName && !hasName(finalPatient, models.PersonName.UseEnum.Official)) {\n finalPatient = garnishPersonWithName(finalPatient, models.PersonName.UseEnum.Official, finalPatient.lastName, finalPatient.firstName)\n }\n\n if (!!finalPatient.maidenName && !hasName(finalPatient, models.PersonName.UseEnum.Maiden)) {\n finalPatient = garnishPersonWithName(finalPatient, models.PersonName.UseEnum.Maiden, finalPatient.maidenName, finalPatient.firstName)\n }\n\n if (!!finalPatient.alias && !hasName(finalPatient, models.PersonName.UseEnum.Nickname)) {\n finalPatient = garnishPersonWithName(finalPatient, models.PersonName.UseEnum.Nickname, finalPatient.alias, finalPatient.firstName)\n }\n\n if (!finalPatient.lastName && !!hasName(finalPatient, models.PersonName.UseEnum.Official)) {\n const officialName = findName(finalPatient, models.PersonName.UseEnum.Official)\n finalPatient = {\n ...finalPatient,\n lastName: officialName!.lastName,\n firstName: officialName!.firstNames?.[0],\n }\n }\n\n if (!finalPatient.maidenName && !!hasName(finalPatient, models.PersonName.UseEnum.Maiden)) {\n finalPatient = {\n ...finalPatient,\n maidenName: findName(finalPatient, models.PersonName.UseEnum.Maiden)!.lastName,\n }\n }\n\n if (!finalPatient.alias && !!hasName(finalPatient, models.PersonName.UseEnum.Nickname)) {\n finalPatient = {\n ...finalPatient,\n alias: findName(finalPatient, models.PersonName.UseEnum.Nickname)!.lastName,\n }\n }\n\n return new Patient(finalPatient)\n }\n\n /**\n * @deprecated replace with {@link initConfidentialSecretId}\n */\n async initConfidentialDelegation(patient: models.Patient, user: models.User): Promise<models.Patient> {\n return this.initConfidentialSecretId(patient, user)\n }\n\n /**\n * Ensures that the current data owner has some confidential secret ids for the provided patient. If not creates them and updates the patient in the\n * database.\n * @param patient the patient for which you want to initialise the confidential secret id.\n * @param user the current user.\n * @return the updated patient or the original patient if no change was necessary.\n */\n async initConfidentialSecretId(patient: models.Patient, user: models.User): Promise<models.Patient> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (dataOwnerId !== (await this.dataOwnerApi.getCurrentDataOwnerId()))\n throw new Error('You can initialise confidential delegations only for the current data owner')\n let updatedPatient = patient\n if (!patient.rev) {\n updatedPatient = await this.createPatientWithUser(user, patient)\n if (!updatedPatient) throw new Error('Could not create patient')\n }\n const initialised = await this.crypto.confidential.initialiseConfidentialSecretId(updatedPatient, 'Patient', (x) => this.bulkSharePatients(x))\n if (initialised) {\n return initialised\n } else {\n return updatedPatient\n }\n }\n\n createPatient(body?: models.Patient): never {\n throw new Error('Cannot call a method that returns patients without providing a user for de/encryption')\n }\n\n createPatientWithUser(user: models.User, body?: models.Patient): Promise<models.Patient | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(this.completeNames(body))])\n .then((pats) => super.createPatient(pats[0]))\n .then((p) => this.decrypt(user, [p]))\n .then((pats) => pats[0])\n : Promise.resolve(null)\n }\n\n filterBy(\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n skip?: number,\n sort?: string,\n desc?: boolean,\n body?: models.FilterChainPatient\n ): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n filterByWithUser(\n user: models.User,\n filterChain: models.FilterChainPatient,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n skip?: number,\n sort?: string,\n desc?: boolean\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .filterPatientsBy(startKey, startDocumentId, limit, skip, sort, desc, filterChain)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n findByAccessLogUserAfterDate(\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n findByAccessLogUserAfterDateWithUser(\n user: models.User,\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .findByAccessLogUserAfterDate(userId, accessType, startDate, startKey, startDocumentId, limit)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n findByAccessLogUserAfterDate_1(externalId: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n findByExternalIdWithUser(user: models.User, externalId: string): Promise<models.Patient | any> {\n return super\n .findByExternalId(externalId)\n .then((pats) => this.decrypt(user, [pats]))\n .then((x) => x[0])\n }\n\n findByNameBirthSsinAuto(\n healthcarePartyId?: string,\n filterValue?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n findByNameBirthSsinAutoWithUser(\n user: models.User,\n healthcarePartyId?: string,\n filterValue?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .findByNameBirthSsinAuto(healthcarePartyId, filterValue, startKey, startDocumentId, limit, sortDirection)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n fuzzySearch(firstName?: string, lastName?: string, dateOfBirth?: number): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n fuzzySearchWithUser(user: models.User, firstName?: string, lastName?: string, dateOfBirth?: number): Promise<Array<models.Patient> | any> {\n return super.fuzzySearch(firstName, lastName, dateOfBirth).then((pats) => this.decrypt(user, pats))\n }\n\n getPatient(patientId: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n getPatientRaw(patientId: string): Promise<models.Patient | any> {\n return super.getPatient(patientId)\n }\n\n getPatientWithUser(user: models.User, patientId: string): Promise<models.Patient | any> {\n return super\n .getPatient(patientId)\n .then((p) => this.tryDecryptOrReturnOriginal([p]))\n .then((pats) => pats[0].entity)\n }\n\n getPotentiallyEncryptedPatientWithUser(user: models.User, patientId: string): Promise<{ patient: models.Patient; decrypted: boolean }> {\n return super\n .getPatient(patientId)\n .then((p) => this.tryDecryptOrReturnOriginal([p]))\n .then((pats) => ({ patient: pats[0].entity, decrypted: pats[0].decrypted }))\n }\n\n getPatients(body?: models.ListOfIds): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n getPatientsWithUser(user: models.User, body?: models.ListOfIds): Promise<Array<models.Patient> | any> {\n return super.getPatients(body).then((pats) => this.decrypt(user, pats))\n }\n\n listDeletedPatients(startDate?: number, endDate?: number, desc?: boolean, startDocumentId?: string, limit?: number): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listDeletedPatientsWithUser(\n user: models.User,\n startDate?: number,\n endDate?: number,\n desc?: boolean,\n startDocumentId?: string,\n limit?: number\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .listDeletedPatients(startDate, endDate, desc, startDocumentId, limit)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n listDeletedPatients_2(firstName?: string, lastName?: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listDeletedPatientsByNameWithUser(user: models.User, firstName?: string, lastName?: string): Promise<Array<models.Patient> | any> {\n return super.listDeletedPatientsByName(firstName, lastName).then((rows) => this.decrypt(user, rows, false))\n }\n\n listOfMergesAfter(date: number): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listOfMergesAfterWithUser(user: models.User, date: number): Promise<Array<models.Patient> | any> {\n return super.listOfMergesAfter(date).then((pats) => this.decrypt(user, pats, false))\n }\n\n listOfPatientsModifiedAfter(date: number, startKey?: number, startDocumentId?: string, limit?: number): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listOfPatientsModifiedAfterWithUser(\n user: models.User,\n date: number,\n startKey?: number,\n startDocumentId?: string,\n limit?: number\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .listOfPatientsModifiedAfter(date, startKey, startDocumentId, limit)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n listPatients(hcPartyId?: string, sortField?: string, startKey?: string, startDocumentId?: string, limit?: number, sortDirection?: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listPatientsWithUser(\n user: models.User,\n hcPartyId?: string,\n sortField?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .listPatients(hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n listPatientsByHcParty(\n hcPartyId: string,\n sortField?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listPatientsByHcPartyWithUser(\n user: models.User,\n hcPartyId: string,\n sortField?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .listPatientsByHcParty(hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n listPatientsOfHcParty(\n hcPartyId: string,\n sortField?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listPatientsOfHcPartyWithUser(\n user: models.User,\n hcPartyId: string,\n sortField?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n sortDirection?: string\n ): Promise<models.PaginatedListPatient | any> {\n return super\n .listPatientsOfHcParty(hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection)\n .then((pl) => this.decrypt(user, pl.rows!, false).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n mergeInto(toId: string, fromIds: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n mergeIntoWithUser(user: models.User, toId: string, fromIds: string): Promise<models.Patient | any> {\n return super\n .mergeInto(toId, fromIds)\n .then((p) => this.decrypt(user, [p]))\n .then((pats) => pats[0])\n }\n\n modifyPatient(body?: models.Patient): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n /**\n * @internal this method is for internal use only and may be changed without notice.\n */\n modifyPatientRaw(body?: models.Patient): Promise<models.Patient | any> {\n return super.modifyPatient(body)\n }\n\n modifyPatientWithUser(user: models.User, body?: models.Patient): Promise<models.Patient | null> {\n return body ? this.modifyPatientAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : Promise.resolve(null)\n }\n\n private modifyPatientAs(dataOwner: string, body: models.Patient): Promise<models.Patient> {\n return this.encryptAs(dataOwner, [_.cloneDeep(this.completeNames(body))])\n .then((pats) => super.modifyPatient(pats[0]))\n .then((p) => this.decryptAs(dataOwner, [p]))\n .then((pats) => pats[0])\n }\n\n modifyPatientReferral(patientId: string, referralId: string, start?: number, end?: number): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n modifyPatientReferralWithUser(\n user: models.User,\n patientId: string,\n referralId: string,\n start?: number,\n end?: number\n ): Promise<models.Patient | any> {\n return super\n .modifyPatientReferral(patientId, referralId, start, end)\n .then((p) => this.decrypt(user, [p]))\n .then((pats) => pats[0])\n }\n\n encrypt(user: models.User, pats: Array<models.Patient>): Promise<Array<models.Patient>> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n return this.encryptAs(dataOwnerId, pats)\n }\n\n private encryptAs(dataOwner: string, pats: Array<models.Patient>): Promise<Array<models.Patient>> {\n return Promise.all(\n pats.map((p) => this.crypto.xapi.tryEncryptEntity(p, 'Patient', this.encryptedFields, true, false, (x) => new models.Patient(x)))\n )\n }\n\n // If patient can't be decrypted returns patient with encrypted data.\n decrypt(user: models.User, patients: Array<models.Patient>, fillDelegations = true): Promise<Array<models.Patient>> {\n return this.decryptAs(this.dataOwnerApi.getDataOwnerIdOf(user), patients, fillDelegations)\n }\n\n private decryptAs(dataOwner: string, patients: Array<models.Patient>, fillDelegations = true): Promise<Array<models.Patient>> {\n return this.tryDecryptOrReturnOriginal(patients).then((ps) => ps.map((p) => p.entity))\n }\n\n tryDecryptOrReturnOriginal(patients: Array<models.Patient>): Promise<{ entity: models.Patient; decrypted: boolean }[]> {\n return Promise.all(\n patients.map(\n async (p) =>\n await this.crypto.xapi\n .decryptEntity(p, 'Patient', (x) => new models.Patient(x))\n .then((p) => {\n if (p.entity.picture && !(p.entity.picture instanceof ArrayBuffer)) {\n return {\n entity: new models.Patient({\n ...p.entity,\n picture: b64_2ab(p.entity.picture),\n }),\n decrypted: p.decrypted,\n }\n } else return p\n })\n )\n )\n }\n\n /**\n * @deprecated replace with {@link shareAllDataOfPatient}\n */\n async share(\n user: models.User,\n patId: string,\n ownerId: string,\n delegateIds: Array<string>,\n delegationTags: { [key: string]: Array<string> },\n usingPost: boolean = false\n ): Promise<{\n patient: models.Patient | null\n statuses: { [key: string]: { success: boolean | null; error: Error | null } }\n } | null> {\n return this.shareAllDataOfPatient(user, patId, ownerId, delegateIds, delegationTags, usingPost)\n }\n\n async shareAllDataOfPatient(\n user: models.User,\n patId: string,\n ownerId: string,\n delegateIds: Array<string>,\n delegationTags: { [key: string]: Array<string> },\n usingPost: boolean = false\n ): Promise<{\n patient: models.Patient | null\n statuses: { [key: string]: { success: boolean | null; error: Error | null } }\n } | null> {\n const allTags: string[] = _.uniq(_.flatMap(Object.values(delegationTags)))\n const status = {\n contacts: {\n success: allTags.includes('medicalInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n forms: {\n success: allTags.includes('medicalInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n healthElements: {\n success: allTags.includes('medicalInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n invoices: {\n success: allTags.includes('financialInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n documents: {\n success: allTags.includes('medicalInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n classifications: {\n success: allTags.includes('medicalInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n calendarItems: {\n success: allTags.includes('medicalInformation') || allTags.includes('all') ? false : null,\n error: null,\n modified: 0,\n },\n patient: { success: false, error: null, modified: 0 } as {\n success: boolean\n error: Error | null\n },\n }\n const hcp = await this.hcpartyApi.getHealthcareParty(ownerId)\n const parentId = hcp.parentId\n let patient = await retry(() => this.getPatientWithUser(user, patId))\n const patientWithInitialisedEncryption = await this.crypto.xapi.ensureEncryptionKeysInitialised(patient, 'Patient')\n if (patientWithInitialisedEncryption) {\n patient = await this.modifyPatientWithUser(user, patientWithInitialisedEncryption)\n }\n\n if (!patient) {\n status.patient = {\n success: false,\n error: new Error('Patient does not exist or cannot initialise encryption keys'),\n }\n return { patient: patient, statuses: status }\n }\n\n const delSfks = await this.crypto.xapi.secretIdsOf({ entity: patient, type: 'Patient' }, ownerId)\n const ecKeys = await this.crypto.xapi.encryptionKeysOf({ entity: patient, type: 'Patient' }, ownerId)\n\n if (delSfks.length) {\n const retrievedHealthElements = await retry(() =>\n (usingPost\n ? this.helementApi.findHealthElementsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(ownerId, _.uniq(delSfks))\n : this.helementApi.findHealthElementsDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((hes) =>\n parentId\n ? (usingPost\n ? this.helementApi.findHealthElementsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(parentId, _.uniq(delSfks))\n : this.helementApi.findHealthElementsDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreHes) => _.uniqBy(hes.concat(moreHes), 'id'))\n : hes\n )\n )\n const retrievedForms = await retry(() =>\n (usingPost\n ? this.formApi.findFormsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(ownerId, _.uniq(delSfks))\n : this.formApi.findFormsDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((frms) =>\n parentId\n ? (usingPost\n ? this.formApi.findFormsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(parentId, _.uniq(delSfks))\n : this.formApi.findFormsDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreFrms) => _.uniqBy(frms.concat(moreFrms), 'id'))\n : frms\n )\n )\n const retrievedContacts = await retry(() =>\n (usingPost\n ? this.contactApi.findByHCPartyPatientSecretFKeysUsingPost(ownerId, undefined, undefined, _.uniq(delSfks))\n : this.contactApi.findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((ctcs) =>\n parentId\n ? (usingPost\n ? this.contactApi.findByHCPartyPatientSecretFKeysUsingPost(parentId, undefined, undefined, _.uniq(delSfks))\n : this.contactApi.findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreCtcs) => _.uniqBy(ctcs.concat(moreCtcs), 'id'))\n : ctcs\n )\n )\n const retrievedInvoices = await retry(() =>\n (usingPost\n ? this.invoiceApi.findInvoicesDelegationsStubsByHCPartyPatientForeignKeysUsingPost(ownerId, _.uniq(delSfks))\n : this.invoiceApi.findInvoicesDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((ivs) =>\n parentId\n ? this.invoiceApi\n .findInvoicesDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n .then((moreIvs) => _.uniqBy(ivs.concat(moreIvs), 'id'))\n : ivs\n )\n )\n const retrievedClassifications = await retry(() =>\n this.classificationApi\n .findClassificationsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n .then((cls) =>\n parentId\n ? this.classificationApi\n .findClassificationsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n .then((moreCls) => _.uniqBy(cls.concat(moreCls), 'id'))\n : cls\n )\n )\n const retrievedCalendarItems = await retry(() =>\n (usingPost\n ? this.calendarItemApi.findByHCPartyPatientSecretFKeysArray(ownerId, _.uniq(delSfks))\n : this.calendarItemApi.findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((cls) =>\n parentId\n ? (usingPost\n ? this.calendarItemApi.findByHCPartyPatientSecretFKeysArray(parentId, _.uniq(delSfks))\n : this.calendarItemApi.findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreCls) => _.uniqBy(cls.concat(moreCls), 'id'))\n : cls\n )\n )\n const isMedicalInfoTags = (tags: string[]) => tags.includes('medicalInformation') || tags.includes('all')\n const isFinancialInfoTags = (tags: string[]) => tags.includes('financialInformation') || tags.includes('all')\n const doShareEntitiesAndUpdateStatus = async (\n entities: models.IcureStub[],\n entitiesType: EntityWithDelegationTypeName,\n status: {\n success: boolean | null\n error: null | Error\n modified: number\n },\n tagsCondition: (tags: string[]) => boolean,\n doShareMinimal: (request: {\n [entityId: string]: { [requestId: string]: EntityShareOrMetadataUpdateRequest }\n }) => Promise<MinimalEntityBulkShareResult[]>\n ): Promise<void> => {\n const delegatesToApply = delegateIds.filter((delegateId) => tagsCondition(delegationTags[delegateId]))\n if (entities.length && delegatesToApply.length) {\n const requests: {\n entity: IcureStub\n dataForDelegates: {\n [delegateId: string]: {\n shareSecretIds: string[]\n shareEncryptionKeys: string[]\n shareOwningEntityIds: string[]\n requestedPermissions: RequestedPermissionEnum\n }\n }\n }[] = []\n for (const entity of entities) {\n const currentEntityRequests: {\n [delegateId: string]: {\n shareSecretIds: string[]\n shareEncryptionKeys: string[]\n shareOwningEntityIds: string[]\n requestedPermissions: RequestedPermissionEnum\n }\n } = {}\n const secretIds = await this.crypto.xapi.secretIdsOf({ entity, type: entitiesType }, undefined)\n const encryptionKeys = await this.crypto.xapi.encryptionKeysOf({ entity, type: entitiesType }, undefined)\n const request = {\n shareSecretIds: secretIds,\n shareEncryptionKeys: encryptionKeys,\n shareOwningEntityIds: [patient.id!],\n requestedPermissions: RequestedPermissionEnum.MAX_WRITE,\n }\n for (const delegateId of delegatesToApply) {\n currentEntityRequests[delegateId] = request\n }\n requests.push({ dataForDelegates: currentEntityRequests, entity })\n }\n await this.crypto.xapi\n .bulkShareOrUpdateEncryptedEntityMetadataNoEntities(entitiesType, requests, (x) => doShareMinimal(x))\n .then((shareResult) => {\n status.modified = new Set(shareResult.successfulUpdates.map((x) => x.entityId)).size\n status.success = shareResult.updateErrors.length === 0\n if (!status.success) {\n const errorMsg = `Error while sharing (some) entities of type ${entitiesType} for patient ${patient.id} : ${JSON.stringify(\n shareResult.updateErrors\n )}`\n console.error(errorMsg)\n status.error = new Error(errorMsg)\n }\n })\n .catch((e) => {\n status.success = false\n status.error = e\n })\n } else {\n status.success = true\n }\n }\n await doShareEntitiesAndUpdateStatus(retrievedHealthElements, 'HealthElement', status.healthElements, isMedicalInfoTags, (x) =>\n this.helementApi.bulkShareHealthElementsMinimal(x)\n )\n await doShareEntitiesAndUpdateStatus(retrievedContacts, 'Contact', status.contacts, isMedicalInfoTags, (x) =>\n this.contactApi.bulkShareContactsMinimal(x)\n )\n await doShareEntitiesAndUpdateStatus(retrievedInvoices, 'Invoice', status.invoices, isFinancialInfoTags, (x) =>\n this.invoiceApi.bulkShareInvoicesMinimal(x)\n )\n await doShareEntitiesAndUpdateStatus(retrievedClassifications, 'Classification', status.classifications, isMedicalInfoTags, (x) =>\n this.classificationApi.bulkShareClassificationsMinimal(x)\n )\n await doShareEntitiesAndUpdateStatus(retrievedCalendarItems, 'CalendarItem', status.calendarItems, isMedicalInfoTags, (x) =>\n this.calendarItemApi.bulkShareCalendarItemsMinimal(x)\n )\n await doShareEntitiesAndUpdateStatus(retrievedForms, 'Form', status.forms, isMedicalInfoTags, (x) => this.formApi.bulkShareFormsMinimal(x))\n }\n const sharePatientDataRequest = {\n shareSecretIds: delSfks,\n shareEncryptionKeys: ecKeys,\n shareOwningEntityIds: [],\n requestedPermissions: RequestedPermissionEnum.MAX_WRITE,\n }\n const sharePatientRequest = {\n entity: patient,\n dataForDelegates: Object.fromEntries(delegateIds.map((delegateId) => [delegateId, sharePatientDataRequest])),\n }\n return await this.crypto.xapi\n .bulkShareOrUpdateEncryptedEntityMetadata('Patient', [sharePatientRequest], (x) => this.bulkSharePatients(x))\n .then((shareResult) => {\n if (shareResult.updatedEntities.length && !shareResult.updateErrors.length) {\n status.patient.success = true\n return { patient: shareResult.updatedEntities[0], statuses: status }\n } else {\n const errorMsg = `Error while sharing patient with id ${patient.id} : ${JSON.stringify(shareResult.updateErrors)}`\n console.error(errorMsg)\n status.patient.error = new Error(errorMsg)\n status.patient.success = false\n return { patient: shareResult.updatedEntities[0] ?? patient, statuses: status }\n }\n })\n .catch((e) => {\n status.patient.error = e\n status.patient.success = false\n return { patient, statuses: status }\n })\n }\n\n export(user: models.User, patId: string, ownerId: string, usingPost: boolean = false): Promise<{ id: string }> {\n return this.hcpartyApi.getHealthcareParty(ownerId).then((hcp) => {\n const parentId = hcp.parentId\n\n return retry(() => this.getPatientWithUser(user, patId))\n .then(async (patient: models.Patient) => {\n const initialised = await this.crypto.xapi.ensureEncryptionKeysInitialised(patient, 'Patient')\n if (!initialised) {\n return patient\n } else {\n return await this.modifyPatientWithUser(user, initialised)\n }\n })\n .then(async (patient: models.Patient | null) => {\n if (!patient) {\n return Promise.resolve({ id: patId })\n }\n const delSfks = await this.crypto.xapi.secretIdsOf({ entity: patient, type: 'Patient' }, ownerId)\n return delSfks.length\n ? Promise.all([\n retry(() =>\n (usingPost\n ? this.helementApi.findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))\n : this.helementApi.findByHCPartyPatientSecretFKeysArray(ownerId, delSfks)\n ).then((hes) =>\n parentId\n ? (usingPost\n ? this.helementApi.findHealthElementsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(parentId, _.uniq(delSfks))\n : this.helementApi.findHealthElementsDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreHes) => _.uniqBy(hes.concat(moreHes), 'id'))\n : hes\n )\n ) as Promise<Array<models.IcureStub>>,\n retry(() =>\n (usingPost\n ? this.formApi.findFormsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(ownerId, _.uniq(delSfks))\n : this.formApi.findFormsDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((frms) =>\n parentId\n ? (usingPost\n ? this.formApi.findFormsDelegationsStubsByHCPartyPatientForeignKeysUsingPost(parentId, _.uniq(delSfks))\n : this.formApi.findFormsDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreFrms) => _.uniqBy(frms.concat(moreFrms), 'id'))\n : frms\n )\n ) as Promise<Array<models.Form>>,\n retry(() =>\n (usingPost\n ? this.contactApi.findByHCPartyPatientSecretFKeysUsingPost(ownerId, undefined, undefined, _.uniq(delSfks))\n : this.contactApi.findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((ctcs) =>\n parentId\n ? (usingPost\n ? this.contactApi.findByHCPartyPatientSecretFKeysUsingPost(parentId, undefined, undefined, _.uniq(delSfks))\n : this.contactApi.findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(','))\n ).then((moreCtcs) => _.uniqBy(ctcs.concat(moreCtcs), 'id'))\n : ctcs\n )\n ) as Promise<Array<models.Contact>>,\n retry(() =>\n (usingPost\n ? this.invoiceApi.findInvoicesDelegationsStubsByHCPartyPatientForeignKeysUsingPost(ownerId, _.uniq(delSfks))\n : this.invoiceApi.findInvoicesDelegationsStubsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n ).then((ivs) =>\n parentId\n ? this.invoiceApi\n .findInvoicesDelegationsStubsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n .then((moreIvs) => _.uniqBy(ivs.concat(moreIvs), 'id'))\n : ivs\n )\n ) as Promise<Array<models.IcureStub>>,\n retry(() =>\n this.classificationApi\n .findClassificationsByHCPartyPatientForeignKeys(ownerId, _.uniq(delSfks).join(','))\n .then((cls) =>\n parentId\n ? this.classificationApi\n .findClassificationsByHCPartyPatientForeignKeys(parentId, _.uniq(delSfks).join(','))\n .then((moreCls) => _.uniqBy(cls.concat(moreCls), 'id'))\n : cls\n )\n ) as Promise<Array<models.Classification>>,\n retry(async () => {\n const delegationSFKs = _.uniq(delSfks).join(',')\n try {\n let calendarItems = await (usingPost\n ? this.calendarItemApi.findByHCPartyPatientSecretFKeysArray(ownerId, _.uniq(delSfks))\n : this.calendarItemApi.findByHCPartyPatientSecretFKeys(ownerId, _.uniq(delSfks).join(',')))\n\n if (parentId) {\n const moreCalendarItems = await (usingPost\n ? this.calendarItemApi.findByHCPartyPatientSecretFKeysArray(parentId, _.uniq(delSfks))\n : this.calendarItemApi.findByHCPartyPatientSecretFKeys(parentId, _.uniq(delSfks).join(',')))\n calendarItems = _.uniqBy(calendarItems.concat(moreCalendarItems), 'id')\n }\n\n return calendarItems\n } catch (ex) {\n console.log(`exception occured exporting calendarItem for ownerId: ${ownerId} - ${ex}`)\n //throw ex\n }\n }) as Promise<Array<models.CalendarItem>>,\n ]).then(([hes, frms, ctcs, ivs, cls, cis]) => {\n const docIds: { [key: string]: number } = {}\n ctcs.forEach(\n (c: models.Contact) =>\n c.services &&\n c.services.forEach((s) => s.content && Object.values(s.content).forEach((c) => c && c.documentId && (docIds[c.documentId] = 1)))\n )\n\n return retry(() => this.documentApi.getDocuments(new ListOfIds({ ids: Object.keys(docIds) }))).then((docs: Array<Document>) => {\n return {\n id: patId,\n patient: patient,\n contacts: ctcs,\n forms: frms,\n healthElements: hes,\n invoices: ivs,\n classifications: cls,\n calItems: cis,\n documents: docs,\n }\n })\n })\n : Promise.resolve({\n id: patId,\n patient: patient,\n contacts: [],\n forms: [],\n healthElements: [],\n invoices: [],\n classifications: [],\n calItems: [],\n documents: [],\n })\n })\n })\n }\n\n checkInami(inami: string): boolean {\n const num_inami = inami.replace(new RegExp('[^(0-9)]', 'g'), '')\n\n const checkDigit = num_inami.substring(6, 2)\n const numSansCheck = num_inami.substring(0, 6)\n let retour = false\n\n //modulo du niss\n const modINAMI = parseInt(numSansCheck) % 97\n\n //obtention du num de check 97 - le resultat du mod\n const checkDigit_2 = 97 - modINAMI\n\n if (parseInt(checkDigit) == checkDigit_2) {\n retour = true\n }\n return retour\n }\n\n isValidSsin(ssin: string) {\n ssin = ssin.replace(new RegExp('[^(0-9)]', 'g'), '')\n let isValidNiss = false\n\n const normalNumber =\n /^[0-9][0-9](([0][0-9])|([1][0-2]))(([0-2][0-9])|([3][0-1]))(([0-9]{2}[1-9])|([0-9][1-9][0-9])|([1-9][0-9]{2}))(([0-8][0-9])|([9][0-7]))$/.test(\n ssin\n )\n const bisNumber = /^[0-9][0-9](([2][0-9])|([3][0-2]))(([0-2][0-9])|([3][0-1]))[0-9]{3}(([0-8][0-9])|([9][0-7]))$/.test(ssin)\n const terNumber = /^[0-9][0-9](([4][0-9])|([5][0-2]))(([0-2][0-9])|([3][0-1]))[0-9]{3}(([0-8][0-9])|([9][0-7]))$/.test(ssin)\n\n if (normalNumber || bisNumber || terNumber) {\n isValidNiss =\n 97 - (Number(ssin.substring(0, 9)) % 97) === Number(ssin.substring(9, 2))\n ? true\n : 97 - (Number('2' + ssin.substring(0, 9)) % 97) === Number(ssin.substring(9, 2))\n }\n\n return isValidNiss\n }\n\n async getPatientIdOfChildDocumentForHcpAndHcpParents(\n childDocument: models.Invoice | models.CalendarItem | models.Contact | models.AccessLog,\n hcpId: string,\n childDocumentType: EntityWithDelegationTypeName\n ): Promise<string> {\n const parentIdsArray = await this.crypto.xapi.owningEntityIdsOf({ entity: childDocument, type: childDocumentType }, hcpId)\n\n const multipleParentIds = _.uniq(parentIdsArray).length > 1\n\n if (multipleParentIds) {\n throw 'Child document with id ' + childDocument.id + ' contains multiple parent ids in its CFKs for hcpId: ' + hcpId\n }\n\n const parentId = _.first(parentIdsArray)\n\n if (!parentId) {\n throw 'Parent id is empty in CFK of child document with id ' + childDocument.id + ' for hcpId: ' + hcpId\n }\n\n let patient: models.Patient = await super.getPatient(parentId!)\n\n let mergeLevel = 0\n const maxMergeLevel = 10\n while (patient.mergeToPatientId) {\n mergeLevel++\n if (mergeLevel === maxMergeLevel) {\n throw 'Too many merged levels for parent (Patient) of child document ' + childDocument.id + ' ; hcpId: ' + hcpId\n }\n\n patient = await super.getPatient(patient.mergeToPatientId!)\n }\n\n return patient.id!\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given patient\n */\n async hasWriteAccess(patient: models.Patient): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: patient, type: 'Patient' })\n }\n\n /**\n * Share an existing patient with other data owners, allowing them to access the non-encrypted data of the patient 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 patient.\n * @param patient the patient to share.\n * @param shareSecretIds the secret ids of the Patient that the delegate will be given access to. Allows the delegate to search for data where the\n * shared Patient is the owning entity id.\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 * patient does not have encrypted content.\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 patient: models.Patient,\n shareSecretIds: string[],\n options: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Patient> {\n return this.shareWithMany(patient, { [delegateId]: { ...options, shareSecretIds: shareSecretIds } })\n }\n\n /**\n * Share an existing patient with other data owners, allowing them to access the non-encrypted data of the patient and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param patient the patient 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 * - shareSecretIds the secret ids of the Patient that the delegate will be given access to. Allows the delegate to search for data where the\n * shared Patient is the owning entity id.\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 * patient does not have encrypted content.\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 patient: models.Patient,\n delegates: {\n [delegateIds: string]: {\n shareSecretIds: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Patient> {\n return (await this.tryShareWithMany(patient, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing patient with other data owners, allowing them to access the non-encrypted data of the patient and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param patient the patient 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 * - shareSecretIds the secret ids of the Patient that the delegate will be given access to. Allows the delegate to search for data where the\n * shared Patient is the owning entity id.\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 * patient does not have encrypted content.\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 patient: models.Patient,\n delegates: {\n [delegateIds: string]: {\n shareSecretIds: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.Patient>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(patient, 'Patient')\n const updatedEntity = entityWithEncryptionKey ? await this.modifyPatientAs(self, entityWithEncryptionKey) : patient\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n { entity: updatedEntity, type: 'Patient' },\n false,\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: options.shareSecretIds,\n },\n ])\n ),\n (x) => this.bulkSharePatients(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decryptAs(self, [e]).then((es) => es[0])))\n }\n\n /**\n * @param patient a patient\n * @return all the decryptable secret ids of the patient, retrieved from the encrypted metadata. The result may be used to find entities where the\n * patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.\n */\n decryptSecretIdsOf(patient: models.Patient): Promise<string[]> {\n return this.crypto.xapi.secretIdsOf({ entity: patient, type: 'Patient' }, undefined)\n }\n\n /**\n * @param patient a patient\n * @return the confidential secret ids of the patient, retrieved from the encrypted metadata. The result may be used to find entities where the\n * patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.\n */\n decryptConfidentialSecretIdsOf(patient: models.Patient): Promise<string[]> {\n return this.crypto.confidential.getConfidentialSecretIds({ entity: patient, type: 'Patient' }, undefined)\n }\n\n /**\n * @param patient a patient\n * @return the non-confidential secret ids of the patient, retrieved from the encrypted metadata. The result may be used to find entities where the\n * patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.\n */\n decryptNonConfidentialSecretIdsOf(patient: models.Patient): Promise<string[]> {\n return this.crypto.confidential.getSecretIdsSharedWithParents({ entity: patient, type: 'Patient' })\n }\n\n getDataOwnersWithAccessTo(\n entity: models.Patient\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: 'Patient' })\n }\n\n getEncryptionKeysOf(entity: models.Patient): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: 'Patient' }, undefined)\n }\n\n /**\n * Merge two patients into one. This method performs the following operations:\n * - The `from` patient will be soft-deleted, and it will point to the `into` patient. Only the `deletionDate` and `mergeToPatientId` fields of the\n * patient will be changed (automatically by this method). Note that the value of {@link from} is only used to verify that the client is aware of\n * the last version of the `from` patient: any changes to its content and/or metadata compared to what is actually stored in the database will be\n * ignored.\n * - The metadata of the `into` patient will be automatically updated to contain also the metadata of the `from` patient and to keep track of the\n * merge:\n * - the `mergedIds` will be updated to contain the `from` patient id\n * - all secret ids of the `from` patient will be added to the `into` patient\n * - all data owners (including anonymous data owners) with access to the `from` patient will have the same access to the merged `into` patient\n * (unless they already had greater access to the `into` patient, in which case they keep the greater access)\n * - The content of the `into` patient will be updated to match the content (name, address, note, ...) of the provided {@link mergedInto} parameter.\n * Note that since the metadata is automatically updated by this method you must not change the metadata of the `mergedInto` patient\n * (`delegations`, mergedInto`, ...): if there is any change between the metadata of the provided `mergedInto` patient and the stored patient this\n * method will fail with an error.\n *\n * In case the revisions of {@link from} and/or {@link mergedInto} does not match the latest revisions for these patients in the database this\n * method will fail without soft-deleting the `from` patient and without updating the `into` patient with the merged content and metadata. You will\n * have to retrieve the updated versions of both patients before retrying the merge.\n *\n * Finally, note that this method only merges existing data, and does not perform any automatic sharing of the data. The secret ids and encryption\n * keys will not be shared with users that had access only to one of the entity, you will have to use the {@link shareWith} method after the merge\n * if you want to do so.\n * For example consider hcps A, B with access to P' and hcps A, C with access to P'', and we merge P'' into P'. After the merge:\n * - A has access to all secret ids of the merged patient and to the encryption key of the merged patient\n * - B has access to the encryption key of the merged patient (since it is the same as in P'), but only to the secret id which was originally from\n * the unmerged P'\n * - C has no access to the encryption key of the merged patient, and has access only to the secret id which was originally from the unmerged P''\n *\n * @param from the original, unmodified `from` patient. Its content will be unchanged and its metadata will be automatically updated by this method\n * to reflect the merge.\n * @param mergedInto the `into` patient with updated content result of the merge with the `from` patient, as specified by your application logic.\n * The metadata of the `mergedInto` patient must not differ from the metadata of the stored version of the patient, since it will be automatically\n * updated by the method.\n * @return the updated `into` patient.\n */\n async mergePatients(from: Patient, mergedInto: Patient): Promise<Patient> {\n const encryptedMerged = (await this.encryptAs(await this.dataOwnerApi.getCurrentDataOwnerId(), [mergedInto]))[0]\n const merged = await super.baseMergePatients(from.id!, from.rev!, encryptedMerged)\n return (await this.tryDecryptOrReturnOriginal([merged]))[0].entity\n }\n\n async subscribeToPatientEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Patient> | undefined,\n eventFired: (patient: Patient) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n const currentUser = await this.userApi.getCurrentUser()\n return subscribeToEntityEvents(\n this.host,\n this.authApi,\n 'Patient',\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 createDelegationDeAnonymizationMetadata(entity: Patient, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: 'Patient' }, delegates)\n }\n}\n"]}
|