@icure/api 8.2.3 → 8.2.4
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/IccAuthApi.js +1 -1
- package/icc-api/api/IccAuthApi.js.map +1 -1
- package/icc-api/api/IccDocumentApi.js.map +1 -1
- package/icc-api/api/IccFormApi.js.map +1 -1
- package/icc-api/api/IccReceiptApi.js.map +1 -1
- package/icc-api/api/IccRestApiPath.js +1 -2
- package/icc-api/api/IccRestApiPath.js.map +1 -1
- package/icc-api/api/XHR.js +17 -8
- package/icc-api/api/XHR.js.map +1 -1
- package/icc-api/model/Address.js +1 -1
- package/icc-api/model/Address.js.map +1 -1
- package/icc-api/model/Amp.js +1 -1
- package/icc-api/model/Amp.js.map +1 -1
- package/icc-api/model/AmpComponent.js +1 -1
- package/icc-api/model/AmpComponent.js.map +1 -1
- package/icc-api/model/Ampp.js +1 -1
- package/icc-api/model/Ampp.js.map +1 -1
- package/icc-api/model/AmppComponent.js +1 -1
- package/icc-api/model/AmppComponent.js.map +1 -1
- package/icc-api/model/CareTeamMember.js +1 -1
- package/icc-api/model/CareTeamMember.js.map +1 -1
- package/icc-api/model/CareTeamMembership.js +1 -1
- package/icc-api/model/CareTeamMembership.js.map +1 -1
- package/icc-api/model/Code.js +1 -1
- package/icc-api/model/Code.js.map +1 -1
- package/icc-api/model/Contact.js.map +1 -1
- package/icc-api/model/Content.js.map +1 -1
- package/icc-api/model/DataOwnerTypeEnum.js +1 -1
- package/icc-api/model/DataOwnerTypeEnum.js.map +1 -1
- package/icc-api/model/DataOwnerWithType.js +1 -1
- package/icc-api/model/DataOwnerWithType.js.map +1 -1
- package/icc-api/model/DatabaseSynchronization.js +1 -1
- package/icc-api/model/DatabaseSynchronization.js.map +1 -1
- package/icc-api/model/Dmpp.js +1 -1
- package/icc-api/model/Dmpp.js.map +1 -1
- package/icc-api/model/Document.js +1 -1
- package/icc-api/model/Document.js.map +1 -1
- package/icc-api/model/DocumentTemplate.d.ts +1 -1
- package/icc-api/model/DocumentTemplate.js +1 -1
- package/icc-api/model/DocumentTemplate.js.map +1 -1
- package/icc-api/model/Editor.js +1 -1
- package/icc-api/model/Editor.js.map +1 -1
- package/icc-api/model/EfactInvoice.js +1 -1
- package/icc-api/model/EfactInvoice.js.map +1 -1
- package/icc-api/model/EmailOrSmsMessage.js +1 -1
- package/icc-api/model/EmailOrSmsMessage.js.map +1 -1
- package/icc-api/model/FlatRateTarification.js +1 -1
- package/icc-api/model/FlatRateTarification.js.map +1 -1
- package/icc-api/model/Formula.js +1 -1
- package/icc-api/model/Formula.js.map +1 -1
- package/icc-api/model/FrontEndMigration.js +1 -1
- package/icc-api/model/FrontEndMigration.js.map +1 -1
- package/icc-api/model/HealthElement.js +1 -1
- package/icc-api/model/HealthElement.js.map +1 -1
- package/icc-api/model/HealthcareParty.js +1 -1
- package/icc-api/model/HealthcareParty.js.map +1 -1
- package/icc-api/model/HealthcarePartyHistoryStatus.js +1 -1
- package/icc-api/model/HealthcarePartyHistoryStatus.js.map +1 -1
- package/icc-api/model/Ingredient.js +1 -1
- package/icc-api/model/Ingredient.js.map +1 -1
- package/icc-api/model/Invoice.js +1 -1
- package/icc-api/model/Invoice.js.map +1 -1
- package/icc-api/model/InvoiceItem.js +1 -1
- package/icc-api/model/InvoiceItem.js.map +1 -1
- package/icc-api/model/InvoicingCode.js +1 -1
- package/icc-api/model/InvoicingCode.js.map +1 -1
- package/icc-api/model/MaintenanceTask.js +1 -1
- package/icc-api/model/MaintenanceTask.js.map +1 -1
- package/icc-api/model/Measure.js.map +1 -1
- package/icc-api/model/MedicalHouseContract.js +1 -1
- package/icc-api/model/MedicalHouseContract.js.map +1 -1
- package/icc-api/model/ModelHelper.js +9 -10
- package/icc-api/model/ModelHelper.js.map +1 -1
- package/icc-api/model/Partnership.js +1 -1
- package/icc-api/model/Partnership.js.map +1 -1
- package/icc-api/model/Patient.js +1 -1
- package/icc-api/model/Patient.js.map +1 -1
- package/icc-api/model/PatientByHcPartyGenderEducationProfession.js +1 -1
- package/icc-api/model/PatientByHcPartyGenderEducationProfession.js.map +1 -1
- package/icc-api/model/PatientHealthCareParty.js +1 -1
- package/icc-api/model/PatientHealthCareParty.js.map +1 -1
- package/icc-api/model/Payment.js +1 -1
- package/icc-api/model/Payment.js.map +1 -1
- package/icc-api/model/PermissionCriterion.js +1 -1
- package/icc-api/model/PermissionCriterion.js.map +1 -1
- package/icc-api/model/PermissionItem.js +1 -1
- package/icc-api/model/PermissionItem.js.map +1 -1
- package/icc-api/model/PersonName.js +1 -1
- package/icc-api/model/PersonName.js.map +1 -1
- package/icc-api/model/PropertyTypeStub.js +1 -1
- package/icc-api/model/PropertyTypeStub.js.map +1 -1
- package/icc-api/model/Reimbursement.js +1 -1
- package/icc-api/model/Reimbursement.js.map +1 -1
- package/icc-api/model/RoleSourceEnum.js +1 -1
- package/icc-api/model/RoleSourceEnum.js.map +1 -1
- package/icc-api/model/SecureDelegation.js +1 -1
- package/icc-api/model/SecureDelegation.js.map +1 -1
- package/icc-api/model/Service.js.map +1 -1
- package/icc-api/model/StandardSubstance.js +1 -1
- package/icc-api/model/StandardSubstance.js.map +1 -1
- package/icc-api/model/SumehrValidity.js +1 -1
- package/icc-api/model/SumehrValidity.js.map +1 -1
- package/icc-api/model/Tarification.js +1 -1
- package/icc-api/model/Tarification.js.map +1 -1
- package/icc-api/model/Telecom.js +1 -1
- package/icc-api/model/Telecom.js.map +1 -1
- package/icc-api/model/Topic.js +1 -1
- package/icc-api/model/Topic.js.map +1 -1
- package/icc-api/model/TypedValueObject.js +1 -1
- package/icc-api/model/TypedValueObject.js.map +1 -1
- package/icc-api/model/User.js +1 -1
- package/icc-api/model/User.js.map +1 -1
- package/icc-api/model/UserTypeEnum.js +1 -1
- package/icc-api/model/UserTypeEnum.js.map +1 -1
- package/icc-api/model/VirtualIngredient.js +1 -1
- package/icc-api/model/VirtualIngredient.js.map +1 -1
- package/icc-api/model/internal/RecoveryData.js +1 -1
- package/icc-api/model/internal/RecoveryData.js.map +1 -1
- package/icc-api/model/requests/EntityBulkShareResult.js.map +1 -1
- package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js.map +1 -1
- package/icc-api/model/requests/EntityShareRequest.js +1 -1
- package/icc-api/model/requests/EntityShareRequest.js.map +1 -1
- package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js +1 -1
- package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js.map +1 -1
- package/icc-x-api/auth/AuthenticationProvider.js.map +1 -1
- package/icc-x-api/auth/BasicAuthService.js.map +1 -1
- package/icc-x-api/auth/EnsembleAuthService.js.map +1 -1
- package/icc-x-api/auth/JwtAuthService.js.map +1 -1
- package/icc-x-api/auth/JwtBridgedAuthService.d.ts +1 -1
- package/icc-x-api/auth/JwtBridgedAuthService.js +1 -1
- package/icc-x-api/auth/JwtBridgedAuthService.js.map +1 -1
- package/icc-x-api/auth/JwtUtils.js +3 -4
- package/icc-x-api/auth/JwtUtils.js.map +1 -1
- package/icc-x-api/auth/NoAuthService.js.map +1 -1
- package/icc-x-api/auth/SmartAuthProvider.d.ts +1 -1
- package/icc-x-api/auth/SmartAuthProvider.js +1 -1
- package/icc-x-api/auth/SmartAuthProvider.js.map +1 -1
- package/icc-x-api/crypto/AES.js.map +1 -1
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js.map +1 -1
- package/icc-x-api/crypto/AccessControlSecretUtils.js.map +1 -1
- package/icc-x-api/crypto/BaseExchangeDataManager.js +10 -10
- package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -1
- package/icc-x-api/crypto/BaseExchangeKeysManager.js +4 -4
- package/icc-x-api/crypto/BaseExchangeKeysManager.js.map +1 -1
- package/icc-x-api/crypto/CryptoStrategies.d.ts +5 -7
- package/icc-x-api/crypto/CryptoStrategies.js.map +1 -1
- package/icc-x-api/crypto/DelegationsDeAnonymization.js +1 -1
- package/icc-x-api/crypto/DelegationsDeAnonymization.js.map +1 -1
- package/icc-x-api/crypto/ExchangeDataManager.js +7 -8
- package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
- package/icc-x-api/crypto/ExchangeDataMapManager.js.map +1 -1
- package/icc-x-api/crypto/ExchangeKeysManager.js +1 -1
- package/icc-x-api/crypto/ExchangeKeysManager.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +11 -10
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -1
- package/icc-x-api/crypto/HMACUtils.js.map +1 -1
- package/icc-x-api/crypto/KeyRecovery.js +5 -5
- package/icc-x-api/crypto/KeyRecovery.js.map +1 -1
- package/icc-x-api/crypto/NativeCryptoPrimitivesBridge.js +3 -3
- package/icc-x-api/crypto/NativeCryptoPrimitivesBridge.js.map +1 -1
- package/icc-x-api/crypto/RSA.js +4 -4
- package/icc-x-api/crypto/RSA.js.map +1 -1
- package/icc-x-api/crypto/RecoveryDataEncryption.js +1 -1
- package/icc-x-api/crypto/RecoveryDataEncryption.js.map +1 -1
- package/icc-x-api/crypto/SecretIdUseOption.js +1 -1
- package/icc-x-api/crypto/SecretIdUseOption.js.map +1 -1
- package/icc-x-api/crypto/SecureDelegationsEncryption.js +4 -4
- package/icc-x-api/crypto/SecureDelegationsEncryption.js.map +1 -1
- package/icc-x-api/crypto/SecureDelegationsManager.js +1 -1
- package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -1
- package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +1 -1
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js +9 -9
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js.map +1 -1
- package/icc-x-api/crypto/ShamirKeysManager.js.map +1 -1
- package/icc-x-api/crypto/ShareMetadataBehaviour.js +1 -1
- package/icc-x-api/crypto/ShareMetadataBehaviour.js.map +1 -1
- package/icc-x-api/crypto/TransferKeysManager.js +1 -1
- package/icc-x-api/crypto/TransferKeysManager.js.map +1 -1
- package/icc-x-api/crypto/UserEncryptionKeysManager.js +2 -2
- package/icc-x-api/crypto/UserEncryptionKeysManager.js.map +1 -1
- package/icc-x-api/crypto/shamir.d.ts +2 -2
- package/icc-x-api/crypto/shamir.js +4 -4
- package/icc-x-api/crypto/shamir.js.map +1 -1
- package/icc-x-api/crypto/utils.js +14 -15
- package/icc-x-api/crypto/utils.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.js +10 -10
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-bekmehr-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.js +7 -7
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.js +5 -5
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-code-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.js +12 -12
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
- package/icc-x-api/icc-device-x-api.js +2 -2
- package/icc-x-api/icc-device-x-api.js.map +1 -1
- package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.js +15 -15
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.js +7 -7
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-hcparty-x-api.js +4 -4
- package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.js +10 -10
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-icure-maintenance-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.js +7 -7
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.js +7 -7
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.js +8 -8
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.js +11 -11
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.js +10 -10
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-recovery-x-api.js +4 -4
- package/icc-x-api/icc-recovery-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.js +5 -5
- package/icc-x-api/icc-time-table-x-api.js.map +1 -1
- package/icc-x-api/icc-topic-x-api.js +9 -9
- package/icc-x-api/icc-topic-x-api.js.map +1 -1
- package/icc-x-api/icc-user-x-api.js +4 -4
- package/icc-x-api/icc-user-x-api.js.map +1 -1
- package/icc-x-api/index.js +22 -22
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/maintenance/KeyPairUpdateRequest.js +2 -2
- package/icc-x-api/maintenance/KeyPairUpdateRequest.js.map +1 -1
- package/icc-x-api/storage/IcureStorageFacade.js +1 -1
- package/icc-x-api/storage/IcureStorageFacade.js.map +1 -1
- package/icc-x-api/storage/LocalStorageImpl.js +1 -1
- package/icc-x-api/storage/LocalStorageImpl.js.map +1 -1
- package/icc-x-api/utils/EntityWithDelegationTypeName.js +4 -4
- package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -1
- package/icc-x-api/utils/asn1-packer.js +2 -3
- package/icc-x-api/utils/asn1-packer.js.map +1 -1
- package/icc-x-api/utils/asn1-parser.js +1 -2
- package/icc-x-api/utils/asn1-parser.js.map +1 -1
- package/icc-x-api/utils/binary-utils.js +11 -11
- package/icc-x-api/utils/binary-utils.js.map +1 -1
- package/icc-x-api/utils/code-util.js +1 -2
- package/icc-x-api/utils/code-util.js.map +1 -1
- package/icc-x-api/utils/collection-utils.js +5 -6
- package/icc-x-api/utils/collection-utils.js.map +1 -1
- package/icc-x-api/utils/crypto-utils.d.ts +1 -1
- package/icc-x-api/utils/crypto-utils.js +17 -18
- package/icc-x-api/utils/crypto-utils.js.map +1 -1
- package/icc-x-api/utils/formatting-util.js +21 -21
- package/icc-x-api/utils/formatting-util.js.map +1 -1
- package/icc-x-api/utils/functional-util.js +3 -4
- package/icc-x-api/utils/functional-util.js.map +1 -1
- package/icc-x-api/utils/graph-utils.js +3 -4
- package/icc-x-api/utils/graph-utils.js.map +1 -1
- package/icc-x-api/utils/hcp-util.js +4 -4
- package/icc-x-api/utils/hcp-util.js.map +1 -1
- package/icc-x-api/utils/insurability-util.js +6 -7
- package/icc-x-api/utils/insurability-util.js.map +1 -1
- package/icc-x-api/utils/lru-temporised-async-cache.js.map +1 -1
- package/icc-x-api/utils/net-utils.js +3 -4
- package/icc-x-api/utils/net-utils.js.map +1 -1
- package/icc-x-api/utils/person-util.js +3 -4
- package/icc-x-api/utils/person-util.js.map +1 -1
- package/icc-x-api/utils/proxy-utils.js.map +1 -1
- package/icc-x-api/utils/simple-lru-cache.js.map +1 -1
- package/icc-x-api/utils/uuid-encoder.js +2 -2
- package/icc-x-api/utils/uuid-encoder.js.map +1 -1
- package/icc-x-api/utils/websocket.d.ts +0 -1
- package/icc-x-api/utils/websocket.js +3 -3
- package/icc-x-api/utils/websocket.js.map +1 -1
- package/package.json +3 -3
- package/test/icc-api/api/IccAgendaApi.js.map +1 -1
- package/test/icc-api/api/IccCalendarItemApi.js.map +1 -1
- package/test/icc-api/api/IccCalendarItemTypeApi.js +2 -2
- package/test/icc-api/api/IccCalendarItemTypeApi.js.map +1 -1
- package/test/icc-api/api/IccDocumentApi.js.map +1 -1
- package/test/icc-api/api/IccKeywordApi.js.map +1 -1
- package/test/icc-api/api/IccMedicalLocationApi.js.map +1 -1
- package/test/icc-api/api/IccPlaceApi.js.map +1 -1
- package/test/icc-api/api/IccUserApi.js +6 -6
- package/test/icc-x-api/auth/group-switch-test.js.map +1 -1
- package/test/icc-x-api/auth/jwt-concurrency-test.js +1 -2
- package/test/icc-x-api/auth/jwt-concurrency-test.js.map +1 -1
- package/test/icc-x-api/auth/jwt-provider-test.js.map +1 -1
- package/test/icc-x-api/auth/smart-auth-provider-test.js.map +1 -1
- package/test/icc-x-api/autofix-anonymity-test.js.map +1 -1
- package/test/icc-x-api/confidential-entities-test.js +1 -1
- package/test/icc-x-api/confidential-entities-test.js.map +1 -1
- package/test/icc-x-api/crud/comprehensive-crud-test.js.map +1 -1
- package/test/icc-x-api/crud/entities-crud-test-interface.js +24 -24
- package/test/icc-x-api/crud/entities-crud-test-interface.js.map +1 -1
- package/test/icc-x-api/crypto/anonymous-delegations-test.js +2 -2
- package/test/icc-x-api/crypto/anonymous-delegations-test.js.map +1 -1
- package/test/icc-x-api/crypto/cryptoTest.js.map +1 -1
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js.map +1 -1
- package/test/icc-x-api/crypto/exchange-data-manager-test.js +4 -4
- package/test/icc-x-api/crypto/exchange-data-manager-test.js.map +1 -1
- package/test/icc-x-api/crypto/full-crypto-test.js +5 -5
- package/test/icc-x-api/crypto/full-crypto-test.js.map +1 -1
- package/test/icc-x-api/crypto/legacy-metadata-migration-test.js +7 -7
- package/test/icc-x-api/crypto/legacy-metadata-migration-test.js.map +1 -1
- package/test/icc-x-api/crypto/secure-delegations-manager-test.js +2 -2
- package/test/icc-x-api/crypto/secure-delegations-manager-test.js.map +1 -1
- package/test/icc-x-api/crypto/shamir.js.map +1 -1
- package/test/icc-x-api/crypto/soft-deleted-data-owners.js +3 -3
- package/test/icc-x-api/crypto/soft-deleted-data-owners.js.map +1 -1
- package/test/icc-x-api/entity-with-attachments-api-test.js +2 -2
- package/test/icc-x-api/entity-with-attachments-api-test.js.map +1 -1
- package/test/icc-x-api/icc-maintenance-task-x-api-test.js +4 -4
- package/test/icc-x-api/icc-message-x-api.js +1 -1
- package/test/icc-x-api/icc-message-x-api.js.map +1 -1
- package/test/icc-x-api/icc-patient-x-api-test.js.map +1 -1
- package/test/icc-x-api/icc-recovery-x-api.js.map +1 -1
- package/test/icc-x-api/icc-topic-x-api.js.map +1 -1
- package/test/icc-x-api/icc-user-x-api-test.js.map +1 -1
- package/test/icc-x-api/patient-user.js.map +1 -1
- package/test/icc-x-api/test-legacy-data-support.js.map +1 -1
- package/test/icc-x-api/utils/graph-test.js.map +1 -1
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.js.map +1 -1
- package/test/support/CSM-243.js +2 -2
- package/test/support/CSM-243.js.map +1 -1
- package/test/support/CSM-93.js +1 -1
- package/test/support/CSM-93.js.map +1 -1
- package/test/utils/FakeDataOwnerApi.js.map +1 -1
- package/test/utils/FakeEncryptionKeysManager.js +2 -2
- package/test/utils/FakeEncryptionKeysManager.js.map +1 -1
- package/test/utils/FakeExchangeDataApi.js.map +1 -1
- package/test/utils/FakeExchangeDataManager.js.map +1 -1
- package/test/utils/FakeGenericApi.js.map +1 -1
- package/test/utils/TestApi.js +2 -2
- package/test/utils/TestApi.js.map +1 -1
- package/test/utils/TestCryptoStrategies.js.map +1 -1
- package/test/utils/TestStorage.js +2 -2
- package/test/utils/TestStorage.js.map +1 -1
- package/test/utils/test_utils.js +22 -22
- package/test/utils/test_utils.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-contact-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-contact-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsD;AAGtD,sDAAsC;AAEtC,iCAAgC;AAChC,4BAA2B;AAC3B,kDAAiD;AACjD,oDAAyF;AAEzF,uDAA+C;AAC/C,qEAAiE;AAEjE,mCASgB;AAChB,0EAAgG;AAChG,wEAAoE;AAQpE,4DAAwE;AACxE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAEzD,kEAA8D;AAE9D,MAAa,cAAe,SAAQ,uBAAa;IAM/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,oCAA4B,CAAC,OAAO,CAAC,CA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EAAE,SAAS,CAAC,CAAA;IACpJ,CAAC;CACF;AAxmCD,wCAwmCC","sourcesContent":["import { IccAuthApi, IccContactApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport i18n from './rsrc/contact.i18n'\n\nimport * as moment from 'moment'\nimport * as _ from 'lodash'\nimport * as models from '../icc-api/model/models'\nimport { Contact, FilterChainService, ListOfIds, Service } from '../icc-api/model/models'\nimport { PaginatedListContact } from '../icc-api/model/PaginatedListContact'\nimport { utf8_2ua } from './utils/binary-utils'\nimport { ServiceByIdsFilter } from './filters/ServiceByIdsFilter'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport {\n before,\n decryptObject,\n EncryptedFieldsManifest,\n encryptObject,\n EntityWithDelegationTypeName,\n parseEncryptedFields,\n subscribeToEntityEvents,\n SubscriptionOptions,\n} from './utils'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { ShareResult } from './utils/ShareResult'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport { XHR } from '../icc-api/api/XHR'\nimport { IccUserXApi } from './icc-user-x-api'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { AbstractFilter } from './filters/filters'\nimport { Connection, ConnectionImpl } from '../icc-api/model/Connection'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\n\nexport class IccContactXApi extends IccContactApi implements EncryptedEntityXApi<models.Contact> {\n i18n: any = i18n\n private readonly contactEncryptedFields: EncryptedFieldsManifest\n private readonly serviceEncryptedFieldsNoContent: EncryptedFieldsManifest | undefined\n private readonly serviceEncryptedFieldsWithContent: EncryptedFieldsManifest\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.Contact))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private readonly crypto: IccCryptoXApi,\n private readonly dataOwnerApi: IccDataOwnerXApi,\n private readonly userApi: IccUserXApi,\n private readonly authApi: IccAuthApi,\n private readonly autofillAuthor: boolean,\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 contactEncryptedKeys: string[] = ['descr'],\n serviceEncryptedKeys: string[] = []\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n if (contactEncryptedKeys.some((key) => key.startsWith('services'))) {\n throw new Error(\"You can't customise encryption of the `services` field of Contact. Use the serviceEncryptedKeys parameter instead.\")\n }\n if (serviceEncryptedKeys.some((key) => key.startsWith('content'))) {\n throw new Error(\"You can't customise encryption of the `content` of a Service. The content values for services is automatically encrypted.\")\n }\n this.crypto = crypto\n this.dataOwnerApi = dataOwnerApi\n this.userApi = userApi\n this.authApi = authApi\n this.contactEncryptedFields = parseEncryptedFields(contactEncryptedKeys, 'Contact.')\n const customServiceEncryptedFields = parseEncryptedFields(serviceEncryptedKeys, 'Service.')\n if (serviceEncryptedKeys.length > 0) {\n this.serviceEncryptedFieldsNoContent = customServiceEncryptedFields\n }\n this.serviceEncryptedFieldsWithContent = {\n ...customServiceEncryptedFields,\n topLevelFields: [...customServiceEncryptedFields.topLevelFields, { fieldName: 'content', fieldPath: 'Service.content' }],\n }\n }\n\n /**\n * Creates a new instance of contact with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this contact refers to.\n * @param c initialised data for the contact. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify other\n * kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with\n * auto-delegations, in such case the access level specified here will be used.\n * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the contact. The default value will be a\n * secret id of patient known by the topmost parent in the current data owner hierarchy if the confidential is set to false, else a secret id that\n * the data owner did not share with any of his parents.\n * - confidential: if true, the entity will be created as confidential. Confidential entities are not shared with auto-delegations, and the default\n * foreign key used is any key that is not shared with any of the data owner parents. By default entities are created as non-confidential.\n * - alternateRootDelegation: by default a new entity is created with a root delegation from self to self. In keyless mode this is not possible,\n * and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.\n * @return a new instance of contact.\n */\n async newInstance(\n user: models.User,\n patient: models.Patient,\n c: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n ignoreAutoDelegations?: boolean // default is considered false\n alternateRootDelegation?: string\n } = {}\n ): Promise<models.Contact> {\n const contact = new models.Contact({\n ...(c ?? {}),\n _type: 'org.taktik.icure.entities.Contact',\n id: c?.id ?? this.crypto.primitives.randomUuid(),\n created: c?.created ?? new Date().getTime(),\n modified: c?.modified ?? new Date().getTime(),\n responsible: c?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: c?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: c?.codes ?? [],\n tags: c?.tags ?? [],\n groupId: c?.groupId ?? this.crypto.primitives.randomUuid(),\n subContacts: c?.subContacts ?? [],\n services: c?.services ?? [],\n openingDate: c?.openingDate ?? parseInt(moment().format('YYYYMMDDHHmmss')),\n })\n\n const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (ownerId !== (await this.dataOwnerApi.getCurrentDataOwnerId())) throw new Error('Can only initialise entities as current data owner.')\n const sfk = await this.crypto.xapi.resolveSecretIdUseOptions(\n { entity: patient, type: EntityWithDelegationTypeName.Patient },\n options.sfkOption ?? SecretIdUseOption.UseAnySharedWithParent\n )\n const extraDelegations = {\n ...(options.ignoreAutoDelegations\n ? {}\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 contact,\n EntityWithDelegationTypeName.Contact,\n patient.id,\n sfk,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n return new models.Contact(initialisationInfo.updatedEntity)\n }\n\n /**\n * 1. Check whether there is a delegation with 'hcpartyId' or not.\n * 2. 'fetchHcParty[hcpartyId][1]': is encrypted AES exchange key by RSA public key of him.\n * 3. Obtain the AES exchange key, by decrypting the previous step value with hcparty private key\n * 3.1. KeyPair should be fetch from cache (in jwk)\n * 3.2. if it doesn't exist in the cache, it has to be loaded from Browser Local store, and then import it to WebCrypto\n * 4. Obtain the array of delegations which are delegated to his ID (hcpartyId) in this patient\n * 5. Decrypt and collect all keys (secretForeignKeys) within delegations of previous step (with obtained AES key of step 4)\n * 6. Do the REST call to get all contacts with (allSecretForeignKeysDelimitedByComa, hcpartyId)\n *\n * After these painful steps, you have the contacts of the patient.\n *\n * @deprecated use {@link findIdsBy} instead.\n * @param hcpartyId\n * @param patient (Promise)\n * @param usingPost\n */\n async findBy(hcpartyId: string, patient: models.Patient, usingPost: boolean = false) {\n return await this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }).then((keysHierarchy) =>\n keysHierarchy && keysHierarchy.length > 0\n ? Promise.all(\n keysHierarchy\n .reduce((acc, level) => {\n return acc.concat([\n {\n hcpartyId: level.ownerId,\n extractedKeys: level.extracted.filter((key) => !acc.some((previousLevel) => previousLevel.extractedKeys.includes(key))),\n },\n ])\n }, [] as Array<{ hcpartyId: string; extractedKeys: Array<string> }>)\n .filter((l) => l.extractedKeys.length > 0)\n .map(({ hcpartyId, extractedKeys }) =>\n usingPost\n ? this.findByHCPartyPatientSecretFKeysArray(hcpartyId, _.uniq(extractedKeys))\n : this.findByHCPartyPatientSecretFKeys(hcpartyId, _.uniq(extractedKeys).join(','))\n )\n ).then((results) => _.uniqBy(_.flatMap(results), (x) => x.id))\n : Promise.resolve([])\n )\n }\n\n /**\n * Same as {@link findIdsBy} but it will only return the ids of the contacts. It can also filter the contacts where Contact.openingDate is between\n * startDate and endDate in ascending or descending order by that field. (default: ascending).\n */\n async findIdsBy(hcpartyId: string, patient: models.Patient, startDate?: number, endDate?: number, descending?: boolean) {\n return await this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }).then((keysHierarchy) =>\n keysHierarchy && keysHierarchy.length > 0\n ? Promise.all(\n keysHierarchy\n .reduce((acc, level) => {\n return acc.concat([\n {\n hcpartyId: level.ownerId,\n extractedKeys: level.extracted.filter((key) => !acc.some((previousLevel) => previousLevel.extractedKeys.includes(key))),\n },\n ])\n }, [] as Array<{ hcpartyId: string; extractedKeys: Array<string> }>)\n .filter((l) => l.extractedKeys.length > 0)\n .map(({ hcpartyId, extractedKeys }) =>\n this.findContactIdsByDataOwnerPatientOpeningDate(hcpartyId, extractedKeys, startDate, endDate, descending)\n )\n ).then((results) => _.uniq(_.flatMap(results)))\n : Promise.resolve([])\n )\n }\n\n /**\n * @deprecated Unused method, bugged: won't work if `hcpartyId` is not the parent hcp and doesn't decrypt contacts.\n * Will be permanently removed in version 8.2.0\n */\n async findByPatientSFKs(hcpartyId: string, patients: Array<models.Patient>): Promise<Array<models.Contact>> {\n const perHcpId: { [key: string]: string[] } = {}\n for (const patient of patients) {\n ;(await this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }))\n .reduce((acc, level) => {\n return acc.concat([\n {\n hcpartyId: level.ownerId,\n extractedKeys: level.extracted.filter((key) => !acc.some((previousLevel) => previousLevel.extractedKeys.includes(key))),\n },\n ])\n }, [] as Array<{ hcpartyId: string; extractedKeys: Array<string> }>)\n .filter((l) => l.extractedKeys.length > 0)\n .forEach(({ hcpartyId, extractedKeys }) => {\n ;(perHcpId[hcpartyId] || (perHcpId[hcpartyId] = [])).push(...extractedKeys)\n })\n }\n\n return _.uniqBy(\n _.flatMap(\n await Promise.all(\n Object.keys(perHcpId).map((hcpId) =>\n this.findContactsByHCPartyPatientForeignKeys(\n hcpartyId,\n new models.ListOfIds({\n ids: perHcpId[hcpId],\n })\n )\n )\n )\n ),\n (x) => x.id\n )\n }\n\n filterBy(startKey?: string, startDocumentId?: string, limit?: number, body?: models.FilterChainContact): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listContactsByOpeningDate(\n startDate: number,\n endDate: number,\n hcpartyid: string,\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 listServices(body?: ListOfIds): Promise<Array<Service>> {\n throw new Error('Cannot call a method that returns services without providing a user for de/encryption')\n }\n\n findByHCPartyFormId(hcPartyId?: string, formId?: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n findByHCPartyFormIds(hcPartyId?: string, 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 getContact(contactId: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n getContacts(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 modifyContact(body?: Contact): never {\n throw new Error('Cannot call a method that modify contacts without providing a user for de/encryption')\n }\n\n modifyContacts(body?: Array<Contact>): never {\n throw new Error('Cannot call a method that modify contacts without providing a user for de/encryption')\n }\n\n createContact(body?: Contact): never {\n throw new Error('Cannot call a method that modify contacts without providing a user for de/encryption')\n }\n\n /**\n * @deprecated use {@link findContactIdsByDataOwnerPatientOpeningDate} instead.\n */\n findByHCPartyPatientSecretFKeys(\n hcPartyId: string,\n secretFKeys: string,\n planOfActionIds?: string,\n skipClosedContacts?: boolean\n ): Promise<Array<models.Contact>> {\n return super\n .findByHCPartyPatientSecretFKeys(hcPartyId, secretFKeys, planOfActionIds, skipClosedContacts)\n .then((contacts) => this.decrypt(hcPartyId, contacts))\n }\n\n /**\n * @deprecated use {@link findContactIdsByDataOwnerPatientOpeningDate} instead.\n */\n findByHCPartyPatientSecretFKeysArray(\n hcPartyId: string,\n secretFKeys: string[],\n planOfActionIds?: string,\n skipClosedContacts?: boolean\n ): Promise<Array<models.Contact> | any> {\n return super\n .findByHCPartyPatientSecretFKeysUsingPost(hcPartyId, planOfActionIds, skipClosedContacts, secretFKeys)\n .then((contacts) => this.decrypt(hcPartyId, contacts))\n }\n\n filterByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainContact\n ): Promise<PaginatedListContact | any> {\n return super\n .filterContactsBy(startDocumentId, limit, body)\n .then((ctcs) =>\n this.decrypt(user.healthcarePartyId! || user.patientId!, ctcs.rows!).then((decryptedRows) => Object.assign(ctcs, { rows: decryptedRows }))\n )\n }\n\n listContactsByOpeningDateWithUser(\n user: models.User,\n startDate: number,\n endDate: number,\n hcpartyid: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): Promise<PaginatedListContact | any> {\n return super\n .listContactsByOpeningDate(startDate, endDate, hcpartyid, startKey, startDocumentId, limit)\n .then((ctcs) =>\n this.decrypt(user.healthcarePartyId! || user.patientId!, ctcs.rows!).then((decryptedRows) => Object.assign(ctcs, { rows: decryptedRows }))\n )\n }\n\n getServiceWithUser(user: models.User, serviceId: string): Promise<Service> {\n return super\n .getService(serviceId)\n .then((service) => this.decryptServices(user.healthcarePartyId ?? user.patientId ?? user.deviceId!, [service]))\n .then((decrypted) => decrypted[0])\n }\n\n listServicesWithUser(user: models.User, serviceIds: ListOfIds): Promise<Array<Service> | any> {\n return super\n .filterServicesBy(undefined, serviceIds.ids?.length, new FilterChainService({ filter: new ServiceByIdsFilter({ ids: serviceIds.ids }) }))\n .then((paginatedList) => this.decryptServices(user.healthcarePartyId ?? user.patientId ?? user.deviceId!, paginatedList.rows ?? []))\n }\n\n findByHCPartyFormIdWithUser(user: models.User, hcPartyId: string, formId: string): Promise<Array<models.Contact> | any> {\n return super.findByHCPartyFormId(hcPartyId, formId).then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n }\n\n findByHCPartyFormIdsWithUser(user: models.User, hcPartyId: string, body: models.ListOfIds): Promise<Array<models.Contact> | any> {\n return super.findByHCPartyFormIds(hcPartyId, body).then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n }\n\n getContactWithUser(user: models.User, contactId: string): Promise<models.Contact> {\n return super\n .getContact(contactId)\n .then((ctc) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [ctc]))\n .then((ctcs) => ctcs[0])\n }\n\n getContactsWithUser(user: models.User, body?: models.ListOfIds): Promise<Array<models.Contact> | any> {\n return super.getContacts(body).then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n }\n\n async modifyContactWithUser(user: models.User, body?: models.Contact): Promise<models.Contact | any> {\n return body ? this.modifyContactAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, body) : null\n }\n\n private modifyContactAs(dataOwner: string, body: models.Contact): Promise<models.Contact> {\n return this.encryptAs(dataOwner, [_.cloneDeep(body)])\n .then((ctcs) => super.modifyContact(ctcs[0]))\n .then((ctc) => this.decrypt(dataOwner, [ctc]))\n .then((ctcs) => ctcs[0])\n }\n\n async modifyContactsWithUser(user: models.User, bodies?: Array<models.Contact>): Promise<models.Contact[] | any> {\n return bodies\n ? this.encrypt(\n user,\n bodies.map((c) => _.cloneDeep(c))\n )\n .then((ctcs) => super.modifyContacts(ctcs))\n .then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n : null\n }\n\n async createContactWithUser(user: models.User, body?: models.Contact): Promise<models.Contact | null> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((ctcs) => super.createContact(ctcs[0]))\n .then((ctc) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [ctc]))\n .then((ctcs) => ctcs[0])\n : null\n }\n\n async createContactsWithUser(user: models.User, bodies?: Array<models.Contact>): Promise<models.Contact[] | null> {\n return bodies\n ? this.encrypt(\n user,\n bodies.map((c) => _.cloneDeep(c))\n )\n .then((ctcs) => super.createContacts(ctcs))\n .then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n : null\n }\n\n encryptServices(key: CryptoKey, rawKey: string, services: Service[]): PromiseLike<Service[]> {\n return Promise.all(\n services.map(async (svc) => {\n if (\n svc.content &&\n Object.values(svc.content).every(\n (c) =>\n c.compoundValue &&\n !c.stringValue &&\n !c.documentId &&\n !c.measureValue &&\n !c.medicationValue &&\n (c.booleanValue === null || c.booleanValue === undefined) &&\n (c.numberValue === null || c.numberValue === undefined) &&\n !c.instantValue &&\n !c.fuzzyDateValue &&\n !c.binaryValue\n )\n ) {\n const recursivelyEncryptedContent = Object.fromEntries(\n await Promise.all(\n Object.entries(svc.content).map(async (p) => {\n if (p[1].compoundValue?.length) {\n return [p[0], { ...p[1], compoundValue: await this.encryptServices(key, rawKey, p[1].compoundValue!) }]\n } else return p\n })\n )\n )\n const copyWithEncryptedContent = { ...svc, content: recursivelyEncryptedContent }\n return this.serviceEncryptedFieldsNoContent\n ? encryptObject(\n copyWithEncryptedContent,\n (obj) => {\n return this.crypto.primitives.AES.encrypt(key, utf8_2ua(JSON.stringify(obj)), rawKey)\n },\n this.serviceEncryptedFieldsNoContent,\n 'service'\n )\n : copyWithEncryptedContent\n } else {\n return encryptObject(\n svc,\n (obj) => {\n return this.crypto.primitives.AES.encrypt(key, utf8_2ua(JSON.stringify(obj)), rawKey)\n },\n this.serviceEncryptedFieldsWithContent,\n 'service'\n )\n }\n })\n )\n }\n\n encrypt(user: models.User, ctcs: Array<models.Contact>) {\n return this.encryptAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs)\n }\n\n private async encryptAs(hcpartyId: string, ctcs: Array<models.Contact>): Promise<models.Contact[]> {\n const initializedContacts: models.Contact[] = []\n for (const ctc of ctcs) {\n initializedContacts.push((await this.crypto.xapi.ensureEncryptionKeysInitialised(ctc, EntityWithDelegationTypeName.Contact)) ?? ctc)\n }\n const allEncrypted = await this.crypto.xapi.doManyIncrementallyDecryptingKeys(\n initializedContacts,\n EntityWithDelegationTypeName.Contact,\n async (entity, t, keys) => {\n for (const k of keys) {\n try {\n const encrypted = new Contact(\n await encryptObject(\n {\n ...entity,\n services: entity.services ? await this.encryptServices(k.key, k.raw, entity.services) : [],\n },\n (obj) => {\n return this.crypto.primitives.AES.encrypt(k.key, utf8_2ua(JSON.stringify(obj)), k.raw)\n },\n this.contactEncryptedFields,\n EntityWithDelegationTypeName.Contact\n )\n )\n return { success: encrypted }\n } catch (e) {\n console.warn(`Failed to encrypt contact ${entity.id} with key ${k.raw}`)\n }\n }\n return null\n }\n )\n if (ctcs.length != allEncrypted.size) {\n throw new Error(`Couldn't encrypt contacts ${ctcs.flatMap((e) => (allEncrypted.has(e.id!) ? [] : [e.id!]))}`)\n }\n return ctcs.map((e) => allEncrypted.get(e.id!)!)\n }\n\n async decrypt(hcpartyId: string, ctcs: Array<models.Contact>): Promise<Array<models.Contact>> {\n return (await this.crypto.xapi.tryDecryptEntities(ctcs, EntityWithDelegationTypeName.Contact, (x) => new Contact(x))).map(({ entity }) => entity)\n }\n\n async decryptServices(hcpartyId: string, svcs: Array<models.Service>): Promise<Array<models.Service>> {\n /*TODO\n * not super efficient, re-decrypts the encryption key metadata of services multiple times, but should mostly rely\n * on cached exchange data after the first decryption and should not do any extra requests to the db.\n * We could ensure to use only cached exchange data by doing limited-size batches of services from the same contact\n * id.\n */\n return (await this.crypto.xapi.tryDecryptEntities(svcs, EntityWithDelegationTypeName.Contact, (x) => new Service(x))).map(({ entity }) => entity)\n }\n\n contactOfService(ctcs: Array<models.Contact>, svcId: string): models.Contact | undefined {\n let latestContact: models.Contact | undefined = undefined\n let latestService: models.Service\n ctcs.forEach((c) => {\n const s: models.Service | undefined = c.services!.find((it) => svcId === it.id)\n if (s && (!latestService || moment(s.valueDate).isAfter(moment(latestService.valueDate)))) {\n latestContact = c\n latestService = s\n }\n })\n return latestContact\n }\n\n filteredServices(ctcs: Array<models.Contact>, filter: any): Array<models.Service> {\n const byIds: { [key: string]: models.Service } = {}\n ctcs.forEach((c) =>\n (c.services || [])\n .filter((s) => filter(s, c))\n .forEach((s) => {\n const ps = byIds[s.id!]\n if (!ps || !ps.modified || (s.modified && ps.modified < s.modified)) {\n byIds[s.id!] = s\n s.contactId = c.id\n }\n })\n )\n return _.values(byIds).filter((s: any) => !s.deleted && !s.endOfLife)\n }\n\n //Return a promise\n filterServices(ctcs: Array<models.Contact>, filter: any): Promise<Array<models.Service>> {\n return Promise.resolve(this.filteredServices(ctcs, filter))\n }\n\n services(ctc: models.Contact, label: string) {\n return ctc.services!.filter((s) => s.label === label)\n }\n\n preferredContent(svc: models.Service, lng: string) {\n return (\n svc && svc.content && (svc.content[lng] || svc.content['fr'] || (Object.keys(svc.content)[0] ? svc.content[Object.keys(svc.content)[0]] : null))\n )\n }\n\n contentValue(c: models.Content) {\n return (\n c.stringValue ||\n ((c.numberValue || c.numberValue === 0) && c.numberValue) ||\n (c.measureValue && (c.measureValue.value || c.measureValue.value === 0) ? c.measureValue : null) ||\n c.medicationValue ||\n c.booleanValue\n )\n }\n\n shortServiceDescription(svc: models.Service, lng: string) {\n const c = this.preferredContent(svc, lng)\n return !c ? '' : this.shortContentDescription(c, lng, svc.label)\n }\n\n shortContentDescription(c: models.Content, lng: string, label?: string) {\n return (\n c.stringValue ||\n ((c.numberValue || c.numberValue === 0) && c.numberValue) ||\n (c.measureValue &&\n '' +\n (c.measureValue.value || c.measureValue.value === 0 ? c.measureValue.value : '-') +\n (c.measureValue.unit ? ' ' + c.measureValue.unit : '')) ||\n (c.medicationValue ? this.medication().medicationToString(c.medicationValue, lng) : null) ||\n (c.booleanValue && label) ||\n 'OK'\n )\n }\n\n medicationValue(svc: models.Service, lng: string) {\n const c =\n svc && svc.content && (svc.content[lng] || svc.content['fr'] || (Object.keys(svc.content)[0] ? svc.content[Object.keys(svc.content)[0]] : null))\n return c && c.medicationValue\n }\n\n contentHasData(c: any): boolean {\n return c.stringValue || c.numberValue || c.measureValue || c.booleanValue || c.booleanValue === false || c.medicationValue || c.documentId\n }\n\n localize(e: any, lng: string) {\n if (!e) {\n return null\n }\n return e[lng] || e.fr || e.en || e.nl\n }\n\n /**\n * Modifies the subcontacts this svc belongs to while minimizing the number of references to the svcs inside the subcontacts\n * After the invocation, there is at least one subcontact with provided poaId and heId that contains the svc\n * The svc is not removed from a previous subcontact it would belong to except if the new conditions are compatible\n * Note that undefined and null do not have the same meaning for formId\n * If formId is null: the subcontact which refers svc must have a null formId\n * If formId is undefined, the subcontact can have any value for formId\n *\n * When a svc does not exist yet in the current contact but exists in a previous contact, all the scs it was belonging to are\n * copied in the current contact\n *\n * the svc returned is the one that's inside the ctc\n *\n * @param ctc\n * @param user\n * @param ctcs\n * @param svc\n * @param formId\n * @param poaId aMap {heId2: [poaId11, poaId12], heId2: [poaId21] }\n * @param heId an Array of heIds, equivalent to poaIds = {heId: [], ...}\n * @param init\n * @returns {*}\n */\n\n promoteServiceInContact(\n ctc: models.Contact,\n user: models.User,\n ctcs: Array<models.Contact>,\n svc: models.Service,\n formId: string,\n poaIds?: { [key: string]: string[] },\n heIds?: Array<string>,\n init?: any\n ) {\n if (!ctc) {\n return null\n }\n const existing = ctc.services!.find((s) => s.id === svc.id)\n const promoted = _.extend(_.extend(existing || {}, svc), {\n author: user.id,\n responsible: this.dataOwnerApi.getDataOwnerIdOf(user),\n modified: new Date().getTime(),\n })\n if (!existing) {\n ;(ctc.services || (ctc.services = [])).push(promoted)\n }\n const allSubcontactsInCurrentContactContainingService = (ctc.subContacts || []).filter((csc) =>\n (csc.services || []).some((s) => s.serviceId === svc.id)\n )\n\n //Rearrange poaIds and heIds as a hierarchy\n const hierarchyOfHeAndPoaIds: { [key: string]: Array<any> } = {}\n ;(heIds || []).forEach((id) => (hierarchyOfHeAndPoaIds[id || '_'] = []))\n Object.keys(poaIds || {}).forEach((k: string) => {\n const poas = hierarchyOfHeAndPoaIds[k]\n if (poas) {\n hierarchyOfHeAndPoaIds[k] = _.concat(poas, (poaIds || {})[k])\n } else {\n hierarchyOfHeAndPoaIds[k] = (poaIds || {})[k]\n }\n })\n\n const pastCtc =\n (svc.contactId && svc.contactId !== ctc.id && ctcs.find((c) => c.id === svc.contactId)) ||\n ctcs.reduce(\n (selected: { s: models.Service | null; c: models.Contact | null }, c: models.Contact) => {\n const candidate = (c.services || []).find((s) => s.id === svc.id)\n return ctc.id !== c.id && candidate && (selected.s === null || before(selected.s.modified || 0, candidate.modified || 0))\n ? { s: candidate, c: c }\n : selected\n },\n { s: null, c: null }\n ).c\n //Make sure that all scs the svc was belonging to are copied inside the current contact\n pastCtc &&\n pastCtc\n .subContacts!.filter((psc) => psc.services!.some((s) => s.serviceId === svc.id))\n .forEach((psc) => {\n const sameInCurrent = allSubcontactsInCurrentContactContainingService.find(\n (csc) => csc.formId === psc.formId && csc.planOfActionId === psc.planOfActionId && csc.healthElementId === psc.healthElementId\n )\n if (sameInCurrent) {\n if (!sameInCurrent.services!.some((s) => s.serviceId === svc.id)) {\n sameInCurrent.services!.push({ serviceId: svc.id })\n }\n } else {\n const newSubContact = _.assign(_.assign({}, psc), {\n services: [{ serviceId: svc.id }],\n })\n ctc.subContacts!.push(newSubContact)\n allSubcontactsInCurrentContactContainingService.push(newSubContact)\n }\n })\n\n if (!Object.keys(hierarchyOfHeAndPoaIds).length) {\n hierarchyOfHeAndPoaIds._ = [] //Default is to have at least one option with heId equals to null (represented by _)\n }\n\n Object.keys(hierarchyOfHeAndPoaIds).forEach((heId: string | null) => {\n if (heId === '_') {\n heId = null\n }\n const subPoaIds = heId ? hierarchyOfHeAndPoaIds[heId] : []\n ;((subPoaIds || []).length ? subPoaIds : [null]).forEach((poaId) => {\n //Create or assign subcontacts for all pairs he/poa (can be null/null)\n let destinationSubcontact = ctc.subContacts!.find(\n (sc) =>\n (!formId || sc.formId === formId) &&\n ((!poaId && !sc.planOfActionId) || sc.planOfActionId === poaId) &&\n ((!heId && !sc.healthElementId) || sc.healthElementId === heId)\n )\n if (!destinationSubcontact) {\n ctc.subContacts!.push(\n (destinationSubcontact = new models.SubContact({\n formId: formId || undefined,\n planOfActionId: poaId,\n healthElementId: heId,\n services: [],\n }))\n )\n }\n\n const redundantSubcontact =\n allSubcontactsInCurrentContactContainingService.find((aSc) => destinationSubcontact === aSc) ||\n allSubcontactsInCurrentContactContainingService.find(\n (aSc) =>\n (!aSc.planOfActionId || aSc.planOfActionId === destinationSubcontact!.planOfActionId) &&\n (!aSc.healthElementId || aSc.healthElementId === destinationSubcontact!.healthElementId) &&\n (!aSc.formId || aSc.formId === destinationSubcontact!.formId)\n ) // Find a compatible sc: one that does not contain extra and ≠ information than the destination\n\n if (redundantSubcontact && redundantSubcontact !== destinationSubcontact) {\n redundantSubcontact.services!.splice(\n redundantSubcontact.services!.findIndex((link) => link.serviceId === svc.id),\n 1\n )\n }\n if (!destinationSubcontact.services!.some((s) => s.serviceId === svc.id)) {\n destinationSubcontact.services!.push({ serviceId: svc.id! })\n }\n })\n })\n\n return (init && init(promoted)) || promoted\n }\n\n isNumeric(svc: models.Service, lng: string) {\n const c = this.preferredContent(svc, lng)\n return c && (c.measureValue || c.numberValue || c.numberValue == 0)\n }\n\n service() {\n return {\n newInstance: (user: models.User, s: any) =>\n _.extend(\n {\n id: this.crypto.primitives.randomUuid(),\n _type: 'org.taktik.icure.entities.embed.Service',\n created: new Date().getTime(),\n modified: new Date().getTime(),\n responsible: s?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: s?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: [],\n tags: [],\n content: {},\n valueDate: parseInt(moment().format('YYYYMMDDHHmmss')),\n },\n s\n ),\n }\n }\n\n medication() {\n const regimenScores: any = {\n afterwakingup: 63000,\n beforebreakfast: 70000,\n duringbreakfast: 80000,\n afterbreakfast: 90000,\n morning: 100000,\n betweenbreakfastandlunch: 103000,\n beforelunch: 113000,\n midday: 120000,\n duringlunch: 123000,\n afterlunch: 130000,\n afternoon: 140000,\n betweenlunchanddinner: 160000,\n beforedinner: 180000,\n duringdinner: 190000,\n afterdinner: 200000,\n evening: 210000,\n betweendinnerandsleep: 213000,\n thehourofsleep: 220000,\n night: 230000,\n beforemeals: -30000,\n betweenmeals: -20000,\n aftermeals: -10000,\n }\n\n const myself = {\n regimenScores: function () {\n return regimenScores\n },\n medicationNameToString: function (m: any): string {\n return m && m.compoundPrescription\n ? m.compoundPrescription\n : m && m.substanceProduct\n ? myself.productToString(m && m.substanceProduct)\n : myself.productToString(m && m.medicinalProduct)\n },\n reimbursementReasonToString: (m: any, lang: string) => {\n return m && m.reimbursementReason && m.reimbursementReason.label && m.reimbursementReason.label.hasOwnProperty(lang)\n ? m.reimbursementReason.label[lang]\n : ''\n },\n medicationToString: (m: any, lang: string) => {\n let res = `${myself.medicationNameToString(m)}, ${myself.posologyToString(m, lang)}`\n const reason = myself.reimbursementReasonToString(m, lang)\n res = m.numberOfPackages\n ? `${m.numberOfPackages} ${m.numberOfPackages > 1 ? this.i18n[lang].packagesOf : this.i18n[lang].packageOf} ${res}`\n : res\n res = m.duration ? `${res} ${this.i18n[lang].during} ${myself.durationToString(m.duration, lang)}` : res\n res = reason ? `${res} (${reason})` : res\n return res\n },\n productToString: (m: any): string => {\n if (!m) {\n return ''\n }\n return m.intendedname\n },\n posologyToString: (m: any, lang: string) => {\n if (m) {\n if (m.instructionForPatient && m.instructionForPatient.length) {\n return m.instructionForPatient\n }\n if (!m.regimen || !m.regimen.length) {\n return ''\n }\n\n const unit =\n m.regimen[0].administratedQuantity && m.regimen[0].administratedQuantity.administrationUnit\n ? m.regimen[0].administratedQuantity.administrationUnit.code\n : m.regimen[0].administratedQuantity && m.regimen[0].administratedQuantity.unit\n let quantity = m.regimen[0].administratedQuantity && m.regimen[0].administratedQuantity.quantity\n\n m.regimen.slice(1).find((ri: any) => {\n const oUnit =\n ri.administratedQuantity && ri.administratedQuantity.administrationUnit\n ? ri.administratedQuantity.administrationUnit.code\n : ri.administratedQuantity && ri.administratedQuantity.unit\n const oQuantity = ri.administratedQuantity && ri.administratedQuantity.quantity\n\n if (oQuantity !== quantity) {\n quantity = -1\n }\n return oUnit !== unit && oQuantity !== quantity\n })\n\n const cplxRegimen = !unit || quantity < 0\n const quantityUnit = cplxRegimen ? `1 ${this.i18n[lang].take_s_}` : `${quantity} ${unit || this.i18n[lang].take_s_}`\n\n const dayPeriod = m.regimen.find((r: any) => r.weekday !== null && r.weekday !== undefined)\n ? this.i18n[lang].weekly\n : m.regimen.find((r: any) => r.date)\n ? this.i18n[lang].monthly\n : this.i18n[lang].daily\n\n return `${quantityUnit}, ${m.regimen.length} x ${dayPeriod}, ${_.sortBy(\n m.regimen,\n (r) =>\n (r.date ? r.date * 1000000 : 29990000000000) +\n (r.dayNumber || 0) * 1000000 +\n ((r.weekday && r.weekday.weekNumber) || 0) * 7 * 1000000 +\n (r.timeOfDay ? r.timeOfDay : r.dayPeriod && r.dayPeriod.code ? (regimenScores[r.dayPeriod.code] as number) : 0)\n )\n .map((r) => (cplxRegimen ? myself.regimenToExtString(r, lang) : myself.regimenToString(r, lang)))\n .join(', ')}`\n }\n },\n frequencyToString: (m: any, lang: string) => {\n if (m.instructionForPatient && m.instructionForPatient.length) {\n return m.instructionForPatient\n }\n if (!m.regimen || !m.regimen.length) {\n return ''\n }\n\n const dayPeriod = m.regimen.find((r: any) => r.weekday !== null && r.weekday !== undefined)\n ? this.i18n[lang].weekly\n : m.regimen.find((r: any) => r.date)\n ? this.i18n[lang].monthly\n : this.i18n[lang].daily\n\n return `${m.regimen.length} x ${dayPeriod}`\n },\n durationToString: (d: models.Duration, lang: string) => {\n return d.value ? `${d.value} ${this.localize(d.unit!.label, lang)}` : ''\n },\n regimenToExtString: (r: models.RegimenItem, lang: string) => {\n const desc = myself.regimenToString(r, lang)\n return (\n (r.administratedQuantity && r.administratedQuantity.quantity && desc\n ? `${desc} (${r.administratedQuantity.quantity} ${\n (r.administratedQuantity.administrationUnit ? r.administratedQuantity.administrationUnit.code : r.administratedQuantity.unit) ||\n this.i18n[lang].take_s_\n })`\n : desc) || ''\n )\n },\n regimenToString: (r: models.RegimenItem, lang: string) => {\n let res = r.date\n ? `${this.i18n[lang].the} ${moment(r.date).format('DD/MM/YYYY')}`\n : r.dayNumber\n ? `${this.i18n[lang].onDay} ${r.dayNumber}`\n : r.weekday && r.weekday.weekday\n ? `${this.i18n[lang].on} ${r.weekday.weekday}`\n : null\n if (r.dayPeriod && r.dayPeriod.code && r.dayPeriod.code.length) {\n res = res\n ? `${res} ${this.i18n[lang][r.dayPeriod.code] || this.localize(r.dayPeriod.label, lang) || r.dayPeriod.code}`\n : this.i18n[lang][r.dayPeriod.code] || this.localize(r.dayPeriod.label, lang) || r.dayPeriod.code\n }\n if (r.timeOfDay) {\n const timeOfDay =\n r.timeOfDay === 120000\n ? this.i18n[lang].noon\n : `${Math.floor(r.timeOfDay / 10000)}:${('' + (Math.floor(r.timeOfDay / 100) % 100)).replace(/^(.)$/, '0$1')}`\n res = res ? res + ' ' + this.i18n[lang].at + ' ' + timeOfDay : timeOfDay\n }\n return res\n },\n localize: (s: any, lang: string) => {\n if (!s) {\n return s\n }\n return (\n this.i18n[lang][s] ||\n (this.i18n[lang][s.toLowerCase()] &&\n this.i18n[lang][s.toLowerCase()]\n .split('')\n .map((c: string, idx: number) => (idx >= s.length || s[idx].toLocaleLowerCase() === s[idx] ? c : c.toLocaleUpperCase()))\n .join('')) ||\n s\n ) //Applies the (lower/upper)case to the translated lowercase version of the input string (s)\n },\n }\n return myself\n }\n\n /**\n * @param contact a contact\n * @return the id of the patient that the contact refers to, retrieved from the encrypted metadata. Normally there should only be one element\n * in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(contact: models.Contact): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: contact, type: EntityWithDelegationTypeName.Contact }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given contact\n */\n async hasWriteAccess(contact: models.Contact): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: contact, type: EntityWithDelegationTypeName.Contact })\n }\n\n /**\n * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact 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 contact.\n * @param contact the contact to share.\n * @param options optional parameters to customize the sharing behaviour:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\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 * contact does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWith(\n delegateId: string,\n contact: models.Contact,\n options: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Contact> {\n return this.shareWithMany(contact, { [delegateId]: options })\n }\n\n /**\n * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param contact the contact 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: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\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 * contact does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWithMany(\n contact: models.Contact,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Contact> {\n return (await this.tryShareWithMany(contact, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param contact the contact 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: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\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 * contact does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return a promise which will contain the result of the operation: the updated entity if the operation was successful or details of the error if\n * the operation failed.\n */\n async tryShareWithMany(\n contact: models.Contact,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.Contact>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(contact, EntityWithDelegationTypeName.Contact)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyContactAs(self, entityWithEncryptionKey) : contact\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.Contact,\n },\n Object.fromEntries(\n Object.entries(delegates).map(([delegateId, options]) => [\n delegateId,\n {\n requestedPermissions: options.requestedPermissions,\n shareEncryptionKeys: options.shareEncryptionKey,\n shareOwningEntityIds: options.sharePatientId,\n shareSecretIds: options.shareSecretIds,\n },\n ])\n ),\n (x) => this.bulkShareContacts(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: models.Contact\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.Contact })\n }\n\n getEncryptionKeysOf(entity: models.Contact): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.Contact }, undefined)\n }\n\n async subscribeToServiceEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Service> | undefined,\n eventFired: (dataSample: Service) => 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 'Service',\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted: Service) => (await this.decryptServices(currentUser.healthcarePartyId!, [encrypted]))[0]\n ).then((ws) => new ConnectionImpl(ws))\n }\n\n async subscribeToContactEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Contact> | undefined,\n eventFired: (dataSample: Contact) => 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 EntityWithDelegationTypeName.Contact,\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted: Contact) => (await this.decrypt(currentUser.healthcarePartyId!, [encrypted]))[0]\n ).then((ws) => new ConnectionImpl(ws))\n }\n\n createDelegationDeAnonymizationMetadata(entity: Contact, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: EntityWithDelegationTypeName.Contact }, delegates)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"icc-contact-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-contact-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsD;AAGtD,sDAAsC;AAEtC,iCAAgC;AAChC,4BAA2B;AAC3B,kDAAiD;AACjD,oDAAyF;AAEzF,uDAA+C;AAC/C,qEAAiE;AAEjE,mCASgB;AAChB,0EAAgG;AAChG,wEAAoE;AAQpE,4DAAwE;AACxE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAEzD,kEAA8D;AAE9D,MAAa,cAAe,SAAQ,uBAAa;IAM/C,IAAI,OAAO;QACT,OAAO,KAAK,CAAC,OAAO,CAAC,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EAAE,CAAA;YACvD,OAAO,IAAA,+BAAuB,EAC5B,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ,oCAA4B,CAAC,OAAO,EACpC,UAAU,EACV,MAAM,EACN,UAAU,EACV,OAAO,EACP,CAAO,SAAkB,EAAE,EAAE,gDAAC,OAAA,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,iBAAkB,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,GAAA,CACnG,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,oCAA4B,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAA;IACpJ,CAAC;CACF;AAxmCD,wCAwmCC","sourcesContent":["import { IccAuthApi, IccContactApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport i18n from './rsrc/contact.i18n'\n\nimport * as moment from 'moment'\nimport * as _ from 'lodash'\nimport * as models from '../icc-api/model/models'\nimport { Contact, FilterChainService, ListOfIds, Service } from '../icc-api/model/models'\nimport { PaginatedListContact } from '../icc-api/model/PaginatedListContact'\nimport { utf8_2ua } from './utils/binary-utils'\nimport { ServiceByIdsFilter } from './filters/ServiceByIdsFilter'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport {\n before,\n decryptObject,\n EncryptedFieldsManifest,\n encryptObject,\n EntityWithDelegationTypeName,\n parseEncryptedFields,\n subscribeToEntityEvents,\n SubscriptionOptions,\n} from './utils'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { ShareResult } from './utils/ShareResult'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport { XHR } from '../icc-api/api/XHR'\nimport { IccUserXApi } from './icc-user-x-api'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { AbstractFilter } from './filters/filters'\nimport { Connection, ConnectionImpl } from '../icc-api/model/Connection'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\n\nexport class IccContactXApi extends IccContactApi implements EncryptedEntityXApi<models.Contact> {\n i18n: any = i18n\n private readonly contactEncryptedFields: EncryptedFieldsManifest\n private readonly serviceEncryptedFieldsNoContent: EncryptedFieldsManifest | undefined\n private readonly serviceEncryptedFieldsWithContent: EncryptedFieldsManifest\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.Contact))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private readonly crypto: IccCryptoXApi,\n private readonly dataOwnerApi: IccDataOwnerXApi,\n private readonly userApi: IccUserXApi,\n private readonly authApi: IccAuthApi,\n private readonly autofillAuthor: boolean,\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 contactEncryptedKeys: string[] = ['descr'],\n serviceEncryptedKeys: string[] = []\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n if (contactEncryptedKeys.some((key) => key.startsWith('services'))) {\n throw new Error(\"You can't customise encryption of the `services` field of Contact. Use the serviceEncryptedKeys parameter instead.\")\n }\n if (serviceEncryptedKeys.some((key) => key.startsWith('content'))) {\n throw new Error(\"You can't customise encryption of the `content` of a Service. The content values for services is automatically encrypted.\")\n }\n this.crypto = crypto\n this.dataOwnerApi = dataOwnerApi\n this.userApi = userApi\n this.authApi = authApi\n this.contactEncryptedFields = parseEncryptedFields(contactEncryptedKeys, 'Contact.')\n const customServiceEncryptedFields = parseEncryptedFields(serviceEncryptedKeys, 'Service.')\n if (serviceEncryptedKeys.length > 0) {\n this.serviceEncryptedFieldsNoContent = customServiceEncryptedFields\n }\n this.serviceEncryptedFieldsWithContent = {\n ...customServiceEncryptedFields,\n topLevelFields: [...customServiceEncryptedFields.topLevelFields, { fieldName: 'content', fieldPath: 'Service.content' }],\n }\n }\n\n /**\n * Creates a new instance of contact with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this contact refers to.\n * @param c initialised data for the contact. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify other\n * kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with\n * auto-delegations, in such case the access level specified here will be used.\n * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the contact. The default value will be a\n * secret id of patient known by the topmost parent in the current data owner hierarchy if the confidential is set to false, else a secret id that\n * the data owner did not share with any of his parents.\n * - confidential: if true, the entity will be created as confidential. Confidential entities are not shared with auto-delegations, and the default\n * foreign key used is any key that is not shared with any of the data owner parents. By default entities are created as non-confidential.\n * - alternateRootDelegation: by default a new entity is created with a root delegation from self to self. In keyless mode this is not possible,\n * and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.\n * @return a new instance of contact.\n */\n async newInstance(\n user: models.User,\n patient: models.Patient,\n c: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n ignoreAutoDelegations?: boolean // default is considered false\n alternateRootDelegation?: string\n } = {}\n ): Promise<models.Contact> {\n const contact = new models.Contact({\n ...(c ?? {}),\n _type: 'org.taktik.icure.entities.Contact',\n id: c?.id ?? this.crypto.primitives.randomUuid(),\n created: c?.created ?? new Date().getTime(),\n modified: c?.modified ?? new Date().getTime(),\n responsible: c?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: c?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: c?.codes ?? [],\n tags: c?.tags ?? [],\n groupId: c?.groupId ?? this.crypto.primitives.randomUuid(),\n subContacts: c?.subContacts ?? [],\n services: c?.services ?? [],\n openingDate: c?.openingDate ?? parseInt(moment().format('YYYYMMDDHHmmss')),\n })\n\n const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (ownerId !== (await this.dataOwnerApi.getCurrentDataOwnerId())) throw new Error('Can only initialise entities as current data owner.')\n const sfk = await this.crypto.xapi.resolveSecretIdUseOptions(\n { entity: patient, type: EntityWithDelegationTypeName.Patient },\n options.sfkOption ?? SecretIdUseOption.UseAnySharedWithParent\n )\n const extraDelegations = {\n ...(options.ignoreAutoDelegations\n ? {}\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 contact,\n EntityWithDelegationTypeName.Contact,\n patient.id,\n sfk,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n return new models.Contact(initialisationInfo.updatedEntity)\n }\n\n /**\n * 1. Check whether there is a delegation with 'hcpartyId' or not.\n * 2. 'fetchHcParty[hcpartyId][1]': is encrypted AES exchange key by RSA public key of him.\n * 3. Obtain the AES exchange key, by decrypting the previous step value with hcparty private key\n * 3.1. KeyPair should be fetch from cache (in jwk)\n * 3.2. if it doesn't exist in the cache, it has to be loaded from Browser Local store, and then import it to WebCrypto\n * 4. Obtain the array of delegations which are delegated to his ID (hcpartyId) in this patient\n * 5. Decrypt and collect all keys (secretForeignKeys) within delegations of previous step (with obtained AES key of step 4)\n * 6. Do the REST call to get all contacts with (allSecretForeignKeysDelimitedByComa, hcpartyId)\n *\n * After these painful steps, you have the contacts of the patient.\n *\n * @deprecated use {@link findIdsBy} instead.\n * @param hcpartyId\n * @param patient (Promise)\n * @param usingPost\n */\n async findBy(hcpartyId: string, patient: models.Patient, usingPost: boolean = false) {\n return await this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }).then((keysHierarchy) =>\n keysHierarchy && keysHierarchy.length > 0\n ? Promise.all(\n keysHierarchy\n .reduce((acc, level) => {\n return acc.concat([\n {\n hcpartyId: level.ownerId,\n extractedKeys: level.extracted.filter((key) => !acc.some((previousLevel) => previousLevel.extractedKeys.includes(key))),\n },\n ])\n }, [] as Array<{ hcpartyId: string; extractedKeys: Array<string> }>)\n .filter((l) => l.extractedKeys.length > 0)\n .map(({ hcpartyId, extractedKeys }) =>\n usingPost\n ? this.findByHCPartyPatientSecretFKeysArray(hcpartyId, _.uniq(extractedKeys))\n : this.findByHCPartyPatientSecretFKeys(hcpartyId, _.uniq(extractedKeys).join(','))\n )\n ).then((results) => _.uniqBy(_.flatMap(results), (x) => x.id))\n : Promise.resolve([])\n )\n }\n\n /**\n * Same as {@link findIdsBy} but it will only return the ids of the contacts. It can also filter the contacts where Contact.openingDate is between\n * startDate and endDate in ascending or descending order by that field. (default: ascending).\n */\n async findIdsBy(hcpartyId: string, patient: models.Patient, startDate?: number, endDate?: number, descending?: boolean) {\n return await this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }).then((keysHierarchy) =>\n keysHierarchy && keysHierarchy.length > 0\n ? Promise.all(\n keysHierarchy\n .reduce((acc, level) => {\n return acc.concat([\n {\n hcpartyId: level.ownerId,\n extractedKeys: level.extracted.filter((key) => !acc.some((previousLevel) => previousLevel.extractedKeys.includes(key))),\n },\n ])\n }, [] as Array<{ hcpartyId: string; extractedKeys: Array<string> }>)\n .filter((l) => l.extractedKeys.length > 0)\n .map(({ hcpartyId, extractedKeys }) =>\n this.findContactIdsByDataOwnerPatientOpeningDate(hcpartyId, extractedKeys, startDate, endDate, descending)\n )\n ).then((results) => _.uniq(_.flatMap(results)))\n : Promise.resolve([])\n )\n }\n\n /**\n * @deprecated Unused method, bugged: won't work if `hcpartyId` is not the parent hcp and doesn't decrypt contacts.\n * Will be permanently removed in version 8.2.0\n */\n async findByPatientSFKs(hcpartyId: string, patients: Array<models.Patient>): Promise<Array<models.Contact>> {\n const perHcpId: { [key: string]: string[] } = {}\n for (const patient of patients) {\n ;(await this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }))\n .reduce((acc, level) => {\n return acc.concat([\n {\n hcpartyId: level.ownerId,\n extractedKeys: level.extracted.filter((key) => !acc.some((previousLevel) => previousLevel.extractedKeys.includes(key))),\n },\n ])\n }, [] as Array<{ hcpartyId: string; extractedKeys: Array<string> }>)\n .filter((l) => l.extractedKeys.length > 0)\n .forEach(({ hcpartyId, extractedKeys }) => {\n ;(perHcpId[hcpartyId] || (perHcpId[hcpartyId] = [])).push(...extractedKeys)\n })\n }\n\n return _.uniqBy(\n _.flatMap(\n await Promise.all(\n Object.keys(perHcpId).map((hcpId) =>\n this.findContactsByHCPartyPatientForeignKeys(\n hcpartyId,\n new models.ListOfIds({\n ids: perHcpId[hcpId],\n })\n )\n )\n )\n ),\n (x) => x.id\n )\n }\n\n filterBy(startKey?: string, startDocumentId?: string, limit?: number, body?: models.FilterChainContact): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listContactsByOpeningDate(\n startDate: number,\n endDate: number,\n hcpartyid: string,\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 listServices(body?: ListOfIds): Promise<Array<Service>> {\n throw new Error('Cannot call a method that returns services without providing a user for de/encryption')\n }\n\n findByHCPartyFormId(hcPartyId?: string, formId?: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n findByHCPartyFormIds(hcPartyId?: string, 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 getContact(contactId: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n getContacts(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 modifyContact(body?: Contact): never {\n throw new Error('Cannot call a method that modify contacts without providing a user for de/encryption')\n }\n\n modifyContacts(body?: Array<Contact>): never {\n throw new Error('Cannot call a method that modify contacts without providing a user for de/encryption')\n }\n\n createContact(body?: Contact): never {\n throw new Error('Cannot call a method that modify contacts without providing a user for de/encryption')\n }\n\n /**\n * @deprecated use {@link findContactIdsByDataOwnerPatientOpeningDate} instead.\n */\n findByHCPartyPatientSecretFKeys(\n hcPartyId: string,\n secretFKeys: string,\n planOfActionIds?: string,\n skipClosedContacts?: boolean\n ): Promise<Array<models.Contact>> {\n return super\n .findByHCPartyPatientSecretFKeys(hcPartyId, secretFKeys, planOfActionIds, skipClosedContacts)\n .then((contacts) => this.decrypt(hcPartyId, contacts))\n }\n\n /**\n * @deprecated use {@link findContactIdsByDataOwnerPatientOpeningDate} instead.\n */\n findByHCPartyPatientSecretFKeysArray(\n hcPartyId: string,\n secretFKeys: string[],\n planOfActionIds?: string,\n skipClosedContacts?: boolean\n ): Promise<Array<models.Contact> | any> {\n return super\n .findByHCPartyPatientSecretFKeysUsingPost(hcPartyId, planOfActionIds, skipClosedContacts, secretFKeys)\n .then((contacts) => this.decrypt(hcPartyId, contacts))\n }\n\n filterByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainContact\n ): Promise<PaginatedListContact | any> {\n return super\n .filterContactsBy(startDocumentId, limit, body)\n .then((ctcs) =>\n this.decrypt(user.healthcarePartyId! || user.patientId!, ctcs.rows!).then((decryptedRows) => Object.assign(ctcs, { rows: decryptedRows }))\n )\n }\n\n listContactsByOpeningDateWithUser(\n user: models.User,\n startDate: number,\n endDate: number,\n hcpartyid: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): Promise<PaginatedListContact | any> {\n return super\n .listContactsByOpeningDate(startDate, endDate, hcpartyid, startKey, startDocumentId, limit)\n .then((ctcs) =>\n this.decrypt(user.healthcarePartyId! || user.patientId!, ctcs.rows!).then((decryptedRows) => Object.assign(ctcs, { rows: decryptedRows }))\n )\n }\n\n getServiceWithUser(user: models.User, serviceId: string): Promise<Service> {\n return super\n .getService(serviceId)\n .then((service) => this.decryptServices(user.healthcarePartyId ?? user.patientId ?? user.deviceId!, [service]))\n .then((decrypted) => decrypted[0])\n }\n\n listServicesWithUser(user: models.User, serviceIds: ListOfIds): Promise<Array<Service> | any> {\n return super\n .filterServicesBy(undefined, serviceIds.ids?.length, new FilterChainService({ filter: new ServiceByIdsFilter({ ids: serviceIds.ids }) }))\n .then((paginatedList) => this.decryptServices(user.healthcarePartyId ?? user.patientId ?? user.deviceId!, paginatedList.rows ?? []))\n }\n\n findByHCPartyFormIdWithUser(user: models.User, hcPartyId: string, formId: string): Promise<Array<models.Contact> | any> {\n return super.findByHCPartyFormId(hcPartyId, formId).then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n }\n\n findByHCPartyFormIdsWithUser(user: models.User, hcPartyId: string, body: models.ListOfIds): Promise<Array<models.Contact> | any> {\n return super.findByHCPartyFormIds(hcPartyId, body).then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n }\n\n getContactWithUser(user: models.User, contactId: string): Promise<models.Contact> {\n return super\n .getContact(contactId)\n .then((ctc) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [ctc]))\n .then((ctcs) => ctcs[0])\n }\n\n getContactsWithUser(user: models.User, body?: models.ListOfIds): Promise<Array<models.Contact> | any> {\n return super.getContacts(body).then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n }\n\n async modifyContactWithUser(user: models.User, body?: models.Contact): Promise<models.Contact | any> {\n return body ? this.modifyContactAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, body) : null\n }\n\n private modifyContactAs(dataOwner: string, body: models.Contact): Promise<models.Contact> {\n return this.encryptAs(dataOwner, [_.cloneDeep(body)])\n .then((ctcs) => super.modifyContact(ctcs[0]))\n .then((ctc) => this.decrypt(dataOwner, [ctc]))\n .then((ctcs) => ctcs[0])\n }\n\n async modifyContactsWithUser(user: models.User, bodies?: Array<models.Contact>): Promise<models.Contact[] | any> {\n return bodies\n ? this.encrypt(\n user,\n bodies.map((c) => _.cloneDeep(c))\n )\n .then((ctcs) => super.modifyContacts(ctcs))\n .then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n : null\n }\n\n async createContactWithUser(user: models.User, body?: models.Contact): Promise<models.Contact | null> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((ctcs) => super.createContact(ctcs[0]))\n .then((ctc) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [ctc]))\n .then((ctcs) => ctcs[0])\n : null\n }\n\n async createContactsWithUser(user: models.User, bodies?: Array<models.Contact>): Promise<models.Contact[] | null> {\n return bodies\n ? this.encrypt(\n user,\n bodies.map((c) => _.cloneDeep(c))\n )\n .then((ctcs) => super.createContacts(ctcs))\n .then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n : null\n }\n\n encryptServices(key: CryptoKey, rawKey: string, services: Service[]): PromiseLike<Service[]> {\n return Promise.all(\n services.map(async (svc) => {\n if (\n svc.content &&\n Object.values(svc.content).every(\n (c) =>\n c.compoundValue &&\n !c.stringValue &&\n !c.documentId &&\n !c.measureValue &&\n !c.medicationValue &&\n (c.booleanValue === null || c.booleanValue === undefined) &&\n (c.numberValue === null || c.numberValue === undefined) &&\n !c.instantValue &&\n !c.fuzzyDateValue &&\n !c.binaryValue\n )\n ) {\n const recursivelyEncryptedContent = Object.fromEntries(\n await Promise.all(\n Object.entries(svc.content).map(async (p) => {\n if (p[1].compoundValue?.length) {\n return [p[0], { ...p[1], compoundValue: await this.encryptServices(key, rawKey, p[1].compoundValue!) }]\n } else return p\n })\n )\n )\n const copyWithEncryptedContent = { ...svc, content: recursivelyEncryptedContent }\n return this.serviceEncryptedFieldsNoContent\n ? encryptObject(\n copyWithEncryptedContent,\n (obj) => {\n return this.crypto.primitives.AES.encrypt(key, utf8_2ua(JSON.stringify(obj)), rawKey)\n },\n this.serviceEncryptedFieldsNoContent,\n 'service'\n )\n : copyWithEncryptedContent\n } else {\n return encryptObject(\n svc,\n (obj) => {\n return this.crypto.primitives.AES.encrypt(key, utf8_2ua(JSON.stringify(obj)), rawKey)\n },\n this.serviceEncryptedFieldsWithContent,\n 'service'\n )\n }\n })\n )\n }\n\n encrypt(user: models.User, ctcs: Array<models.Contact>) {\n return this.encryptAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs)\n }\n\n private async encryptAs(hcpartyId: string, ctcs: Array<models.Contact>): Promise<models.Contact[]> {\n const initializedContacts: models.Contact[] = []\n for (const ctc of ctcs) {\n initializedContacts.push((await this.crypto.xapi.ensureEncryptionKeysInitialised(ctc, EntityWithDelegationTypeName.Contact)) ?? ctc)\n }\n const allEncrypted = await this.crypto.xapi.doManyIncrementallyDecryptingKeys(\n initializedContacts,\n EntityWithDelegationTypeName.Contact,\n async (entity, t, keys) => {\n for (const k of keys) {\n try {\n const encrypted = new Contact(\n await encryptObject(\n {\n ...entity,\n services: entity.services ? await this.encryptServices(k.key, k.raw, entity.services) : [],\n },\n (obj) => {\n return this.crypto.primitives.AES.encrypt(k.key, utf8_2ua(JSON.stringify(obj)), k.raw)\n },\n this.contactEncryptedFields,\n EntityWithDelegationTypeName.Contact\n )\n )\n return { success: encrypted }\n } catch (e) {\n console.warn(`Failed to encrypt contact ${entity.id} with key ${k.raw}`)\n }\n }\n return null\n }\n )\n if (ctcs.length != allEncrypted.size) {\n throw new Error(`Couldn't encrypt contacts ${ctcs.flatMap((e) => (allEncrypted.has(e.id!) ? [] : [e.id!]))}`)\n }\n return ctcs.map((e) => allEncrypted.get(e.id!)!)\n }\n\n async decrypt(hcpartyId: string, ctcs: Array<models.Contact>): Promise<Array<models.Contact>> {\n return (await this.crypto.xapi.tryDecryptEntities(ctcs, EntityWithDelegationTypeName.Contact, (x) => new Contact(x))).map(({ entity }) => entity)\n }\n\n async decryptServices(hcpartyId: string, svcs: Array<models.Service>): Promise<Array<models.Service>> {\n /*TODO\n * not super efficient, re-decrypts the encryption key metadata of services multiple times, but should mostly rely\n * on cached exchange data after the first decryption and should not do any extra requests to the db.\n * We could ensure to use only cached exchange data by doing limited-size batches of services from the same contact\n * id.\n */\n return (await this.crypto.xapi.tryDecryptEntities(svcs, EntityWithDelegationTypeName.Contact, (x) => new Service(x))).map(({ entity }) => entity)\n }\n\n contactOfService(ctcs: Array<models.Contact>, svcId: string): models.Contact | undefined {\n let latestContact: models.Contact | undefined = undefined\n let latestService: models.Service\n ctcs.forEach((c) => {\n const s: models.Service | undefined = c.services!.find((it) => svcId === it.id)\n if (s && (!latestService || moment(s.valueDate).isAfter(moment(latestService.valueDate)))) {\n latestContact = c\n latestService = s\n }\n })\n return latestContact\n }\n\n filteredServices(ctcs: Array<models.Contact>, filter: any): Array<models.Service> {\n const byIds: { [key: string]: models.Service } = {}\n ctcs.forEach((c) =>\n (c.services || [])\n .filter((s) => filter(s, c))\n .forEach((s) => {\n const ps = byIds[s.id!]\n if (!ps || !ps.modified || (s.modified && ps.modified < s.modified)) {\n byIds[s.id!] = s\n s.contactId = c.id\n }\n })\n )\n return _.values(byIds).filter((s: any) => !s.deleted && !s.endOfLife)\n }\n\n //Return a promise\n filterServices(ctcs: Array<models.Contact>, filter: any): Promise<Array<models.Service>> {\n return Promise.resolve(this.filteredServices(ctcs, filter))\n }\n\n services(ctc: models.Contact, label: string) {\n return ctc.services!.filter((s) => s.label === label)\n }\n\n preferredContent(svc: models.Service, lng: string) {\n return (\n svc && svc.content && (svc.content[lng] || svc.content['fr'] || (Object.keys(svc.content)[0] ? svc.content[Object.keys(svc.content)[0]] : null))\n )\n }\n\n contentValue(c: models.Content) {\n return (\n c.stringValue ||\n ((c.numberValue || c.numberValue === 0) && c.numberValue) ||\n (c.measureValue && (c.measureValue.value || c.measureValue.value === 0) ? c.measureValue : null) ||\n c.medicationValue ||\n c.booleanValue\n )\n }\n\n shortServiceDescription(svc: models.Service, lng: string) {\n const c = this.preferredContent(svc, lng)\n return !c ? '' : this.shortContentDescription(c, lng, svc.label)\n }\n\n shortContentDescription(c: models.Content, lng: string, label?: string) {\n return (\n c.stringValue ||\n ((c.numberValue || c.numberValue === 0) && c.numberValue) ||\n (c.measureValue &&\n '' +\n (c.measureValue.value || c.measureValue.value === 0 ? c.measureValue.value : '-') +\n (c.measureValue.unit ? ' ' + c.measureValue.unit : '')) ||\n (c.medicationValue ? this.medication().medicationToString(c.medicationValue, lng) : null) ||\n (c.booleanValue && label) ||\n 'OK'\n )\n }\n\n medicationValue(svc: models.Service, lng: string) {\n const c =\n svc && svc.content && (svc.content[lng] || svc.content['fr'] || (Object.keys(svc.content)[0] ? svc.content[Object.keys(svc.content)[0]] : null))\n return c && c.medicationValue\n }\n\n contentHasData(c: any): boolean {\n return c.stringValue || c.numberValue || c.measureValue || c.booleanValue || c.booleanValue === false || c.medicationValue || c.documentId\n }\n\n localize(e: any, lng: string) {\n if (!e) {\n return null\n }\n return e[lng] || e.fr || e.en || e.nl\n }\n\n /**\n * Modifies the subcontacts this svc belongs to while minimizing the number of references to the svcs inside the subcontacts\n * After the invocation, there is at least one subcontact with provided poaId and heId that contains the svc\n * The svc is not removed from a previous subcontact it would belong to except if the new conditions are compatible\n * Note that undefined and null do not have the same meaning for formId\n * If formId is null: the subcontact which refers svc must have a null formId\n * If formId is undefined, the subcontact can have any value for formId\n *\n * When a svc does not exist yet in the current contact but exists in a previous contact, all the scs it was belonging to are\n * copied in the current contact\n *\n * the svc returned is the one that's inside the ctc\n *\n * @param ctc\n * @param user\n * @param ctcs\n * @param svc\n * @param formId\n * @param poaId aMap {heId2: [poaId11, poaId12], heId2: [poaId21] }\n * @param heId an Array of heIds, equivalent to poaIds = {heId: [], ...}\n * @param init\n * @returns {*}\n */\n\n promoteServiceInContact(\n ctc: models.Contact,\n user: models.User,\n ctcs: Array<models.Contact>,\n svc: models.Service,\n formId: string,\n poaIds?: { [key: string]: string[] },\n heIds?: Array<string>,\n init?: any\n ) {\n if (!ctc) {\n return null\n }\n const existing = ctc.services!.find((s) => s.id === svc.id)\n const promoted = _.extend(_.extend(existing || {}, svc), {\n author: user.id,\n responsible: this.dataOwnerApi.getDataOwnerIdOf(user),\n modified: new Date().getTime(),\n })\n if (!existing) {\n ;(ctc.services || (ctc.services = [])).push(promoted)\n }\n const allSubcontactsInCurrentContactContainingService = (ctc.subContacts || []).filter((csc) =>\n (csc.services || []).some((s) => s.serviceId === svc.id)\n )\n\n //Rearrange poaIds and heIds as a hierarchy\n const hierarchyOfHeAndPoaIds: { [key: string]: Array<any> } = {}\n ;(heIds || []).forEach((id) => (hierarchyOfHeAndPoaIds[id || '_'] = []))\n Object.keys(poaIds || {}).forEach((k: string) => {\n const poas = hierarchyOfHeAndPoaIds[k]\n if (poas) {\n hierarchyOfHeAndPoaIds[k] = _.concat(poas, (poaIds || {})[k])\n } else {\n hierarchyOfHeAndPoaIds[k] = (poaIds || {})[k]\n }\n })\n\n const pastCtc =\n (svc.contactId && svc.contactId !== ctc.id && ctcs.find((c) => c.id === svc.contactId)) ||\n ctcs.reduce(\n (selected: { s: models.Service | null; c: models.Contact | null }, c: models.Contact) => {\n const candidate = (c.services || []).find((s) => s.id === svc.id)\n return ctc.id !== c.id && candidate && (selected.s === null || before(selected.s.modified || 0, candidate.modified || 0))\n ? { s: candidate, c: c }\n : selected\n },\n { s: null, c: null }\n ).c\n //Make sure that all scs the svc was belonging to are copied inside the current contact\n pastCtc &&\n pastCtc\n .subContacts!.filter((psc) => psc.services!.some((s) => s.serviceId === svc.id))\n .forEach((psc) => {\n const sameInCurrent = allSubcontactsInCurrentContactContainingService.find(\n (csc) => csc.formId === psc.formId && csc.planOfActionId === psc.planOfActionId && csc.healthElementId === psc.healthElementId\n )\n if (sameInCurrent) {\n if (!sameInCurrent.services!.some((s) => s.serviceId === svc.id)) {\n sameInCurrent.services!.push({ serviceId: svc.id })\n }\n } else {\n const newSubContact = _.assign(_.assign({}, psc), {\n services: [{ serviceId: svc.id }],\n })\n ctc.subContacts!.push(newSubContact)\n allSubcontactsInCurrentContactContainingService.push(newSubContact)\n }\n })\n\n if (!Object.keys(hierarchyOfHeAndPoaIds).length) {\n hierarchyOfHeAndPoaIds._ = [] //Default is to have at least one option with heId equals to null (represented by _)\n }\n\n Object.keys(hierarchyOfHeAndPoaIds).forEach((heId: string | null) => {\n if (heId === '_') {\n heId = null\n }\n const subPoaIds = heId ? hierarchyOfHeAndPoaIds[heId] : []\n ;((subPoaIds || []).length ? subPoaIds : [null]).forEach((poaId) => {\n //Create or assign subcontacts for all pairs he/poa (can be null/null)\n let destinationSubcontact = ctc.subContacts!.find(\n (sc) =>\n (!formId || sc.formId === formId) &&\n ((!poaId && !sc.planOfActionId) || sc.planOfActionId === poaId) &&\n ((!heId && !sc.healthElementId) || sc.healthElementId === heId)\n )\n if (!destinationSubcontact) {\n ctc.subContacts!.push(\n (destinationSubcontact = new models.SubContact({\n formId: formId || undefined,\n planOfActionId: poaId,\n healthElementId: heId,\n services: [],\n }))\n )\n }\n\n const redundantSubcontact =\n allSubcontactsInCurrentContactContainingService.find((aSc) => destinationSubcontact === aSc) ||\n allSubcontactsInCurrentContactContainingService.find(\n (aSc) =>\n (!aSc.planOfActionId || aSc.planOfActionId === destinationSubcontact!.planOfActionId) &&\n (!aSc.healthElementId || aSc.healthElementId === destinationSubcontact!.healthElementId) &&\n (!aSc.formId || aSc.formId === destinationSubcontact!.formId)\n ) // Find a compatible sc: one that does not contain extra and ≠ information than the destination\n\n if (redundantSubcontact && redundantSubcontact !== destinationSubcontact) {\n redundantSubcontact.services!.splice(\n redundantSubcontact.services!.findIndex((link) => link.serviceId === svc.id),\n 1\n )\n }\n if (!destinationSubcontact.services!.some((s) => s.serviceId === svc.id)) {\n destinationSubcontact.services!.push({ serviceId: svc.id! })\n }\n })\n })\n\n return (init && init(promoted)) || promoted\n }\n\n isNumeric(svc: models.Service, lng: string) {\n const c = this.preferredContent(svc, lng)\n return c && (c.measureValue || c.numberValue || c.numberValue == 0)\n }\n\n service() {\n return {\n newInstance: (user: models.User, s: any) =>\n _.extend(\n {\n id: this.crypto.primitives.randomUuid(),\n _type: 'org.taktik.icure.entities.embed.Service',\n created: new Date().getTime(),\n modified: new Date().getTime(),\n responsible: s?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: s?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: [],\n tags: [],\n content: {},\n valueDate: parseInt(moment().format('YYYYMMDDHHmmss')),\n },\n s\n ),\n }\n }\n\n medication() {\n const regimenScores: any = {\n afterwakingup: 63000,\n beforebreakfast: 70000,\n duringbreakfast: 80000,\n afterbreakfast: 90000,\n morning: 100000,\n betweenbreakfastandlunch: 103000,\n beforelunch: 113000,\n midday: 120000,\n duringlunch: 123000,\n afterlunch: 130000,\n afternoon: 140000,\n betweenlunchanddinner: 160000,\n beforedinner: 180000,\n duringdinner: 190000,\n afterdinner: 200000,\n evening: 210000,\n betweendinnerandsleep: 213000,\n thehourofsleep: 220000,\n night: 230000,\n beforemeals: -30000,\n betweenmeals: -20000,\n aftermeals: -10000,\n }\n\n const myself = {\n regimenScores: function () {\n return regimenScores\n },\n medicationNameToString: function (m: any): string {\n return m && m.compoundPrescription\n ? m.compoundPrescription\n : m && m.substanceProduct\n ? myself.productToString(m && m.substanceProduct)\n : myself.productToString(m && m.medicinalProduct)\n },\n reimbursementReasonToString: (m: any, lang: string) => {\n return m && m.reimbursementReason && m.reimbursementReason.label && m.reimbursementReason.label.hasOwnProperty(lang)\n ? m.reimbursementReason.label[lang]\n : ''\n },\n medicationToString: (m: any, lang: string) => {\n let res = `${myself.medicationNameToString(m)}, ${myself.posologyToString(m, lang)}`\n const reason = myself.reimbursementReasonToString(m, lang)\n res = m.numberOfPackages\n ? `${m.numberOfPackages} ${m.numberOfPackages > 1 ? this.i18n[lang].packagesOf : this.i18n[lang].packageOf} ${res}`\n : res\n res = m.duration ? `${res} ${this.i18n[lang].during} ${myself.durationToString(m.duration, lang)}` : res\n res = reason ? `${res} (${reason})` : res\n return res\n },\n productToString: (m: any): string => {\n if (!m) {\n return ''\n }\n return m.intendedname\n },\n posologyToString: (m: any, lang: string) => {\n if (m) {\n if (m.instructionForPatient && m.instructionForPatient.length) {\n return m.instructionForPatient\n }\n if (!m.regimen || !m.regimen.length) {\n return ''\n }\n\n const unit =\n m.regimen[0].administratedQuantity && m.regimen[0].administratedQuantity.administrationUnit\n ? m.regimen[0].administratedQuantity.administrationUnit.code\n : m.regimen[0].administratedQuantity && m.regimen[0].administratedQuantity.unit\n let quantity = m.regimen[0].administratedQuantity && m.regimen[0].administratedQuantity.quantity\n\n m.regimen.slice(1).find((ri: any) => {\n const oUnit =\n ri.administratedQuantity && ri.administratedQuantity.administrationUnit\n ? ri.administratedQuantity.administrationUnit.code\n : ri.administratedQuantity && ri.administratedQuantity.unit\n const oQuantity = ri.administratedQuantity && ri.administratedQuantity.quantity\n\n if (oQuantity !== quantity) {\n quantity = -1\n }\n return oUnit !== unit && oQuantity !== quantity\n })\n\n const cplxRegimen = !unit || quantity < 0\n const quantityUnit = cplxRegimen ? `1 ${this.i18n[lang].take_s_}` : `${quantity} ${unit || this.i18n[lang].take_s_}`\n\n const dayPeriod = m.regimen.find((r: any) => r.weekday !== null && r.weekday !== undefined)\n ? this.i18n[lang].weekly\n : m.regimen.find((r: any) => r.date)\n ? this.i18n[lang].monthly\n : this.i18n[lang].daily\n\n return `${quantityUnit}, ${m.regimen.length} x ${dayPeriod}, ${_.sortBy(\n m.regimen,\n (r) =>\n (r.date ? r.date * 1000000 : 29990000000000) +\n (r.dayNumber || 0) * 1000000 +\n ((r.weekday && r.weekday.weekNumber) || 0) * 7 * 1000000 +\n (r.timeOfDay ? r.timeOfDay : r.dayPeriod && r.dayPeriod.code ? (regimenScores[r.dayPeriod.code] as number) : 0)\n )\n .map((r) => (cplxRegimen ? myself.regimenToExtString(r, lang) : myself.regimenToString(r, lang)))\n .join(', ')}`\n }\n },\n frequencyToString: (m: any, lang: string) => {\n if (m.instructionForPatient && m.instructionForPatient.length) {\n return m.instructionForPatient\n }\n if (!m.regimen || !m.regimen.length) {\n return ''\n }\n\n const dayPeriod = m.regimen.find((r: any) => r.weekday !== null && r.weekday !== undefined)\n ? this.i18n[lang].weekly\n : m.regimen.find((r: any) => r.date)\n ? this.i18n[lang].monthly\n : this.i18n[lang].daily\n\n return `${m.regimen.length} x ${dayPeriod}`\n },\n durationToString: (d: models.Duration, lang: string) => {\n return d.value ? `${d.value} ${this.localize(d.unit!.label, lang)}` : ''\n },\n regimenToExtString: (r: models.RegimenItem, lang: string) => {\n const desc = myself.regimenToString(r, lang)\n return (\n (r.administratedQuantity && r.administratedQuantity.quantity && desc\n ? `${desc} (${r.administratedQuantity.quantity} ${\n (r.administratedQuantity.administrationUnit ? r.administratedQuantity.administrationUnit.code : r.administratedQuantity.unit) ||\n this.i18n[lang].take_s_\n })`\n : desc) || ''\n )\n },\n regimenToString: (r: models.RegimenItem, lang: string) => {\n let res = r.date\n ? `${this.i18n[lang].the} ${moment(r.date).format('DD/MM/YYYY')}`\n : r.dayNumber\n ? `${this.i18n[lang].onDay} ${r.dayNumber}`\n : r.weekday && r.weekday.weekday\n ? `${this.i18n[lang].on} ${r.weekday.weekday}`\n : null\n if (r.dayPeriod && r.dayPeriod.code && r.dayPeriod.code.length) {\n res = res\n ? `${res} ${this.i18n[lang][r.dayPeriod.code] || this.localize(r.dayPeriod.label, lang) || r.dayPeriod.code}`\n : this.i18n[lang][r.dayPeriod.code] || this.localize(r.dayPeriod.label, lang) || r.dayPeriod.code\n }\n if (r.timeOfDay) {\n const timeOfDay =\n r.timeOfDay === 120000\n ? this.i18n[lang].noon\n : `${Math.floor(r.timeOfDay / 10000)}:${('' + (Math.floor(r.timeOfDay / 100) % 100)).replace(/^(.)$/, '0$1')}`\n res = res ? res + ' ' + this.i18n[lang].at + ' ' + timeOfDay : timeOfDay\n }\n return res\n },\n localize: (s: any, lang: string) => {\n if (!s) {\n return s\n }\n return (\n this.i18n[lang][s] ||\n (this.i18n[lang][s.toLowerCase()] &&\n this.i18n[lang][s.toLowerCase()]\n .split('')\n .map((c: string, idx: number) => (idx >= s.length || s[idx].toLocaleLowerCase() === s[idx] ? c : c.toLocaleUpperCase()))\n .join('')) ||\n s\n ) //Applies the (lower/upper)case to the translated lowercase version of the input string (s)\n },\n }\n return myself\n }\n\n /**\n * @param contact a contact\n * @return the id of the patient that the contact refers to, retrieved from the encrypted metadata. Normally there should only be one element\n * in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(contact: models.Contact): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: contact, type: EntityWithDelegationTypeName.Contact }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given contact\n */\n async hasWriteAccess(contact: models.Contact): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: contact, type: EntityWithDelegationTypeName.Contact })\n }\n\n /**\n * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact 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 contact.\n * @param contact the contact to share.\n * @param options optional parameters to customize the sharing behaviour:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\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 * contact does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWith(\n delegateId: string,\n contact: models.Contact,\n options: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Contact> {\n return this.shareWithMany(contact, { [delegateId]: options })\n }\n\n /**\n * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param contact the contact 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: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\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 * contact does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWithMany(\n contact: models.Contact,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Contact> {\n return (await this.tryShareWithMany(contact, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param contact the contact 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: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\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 * contact does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return a promise which will contain the result of the operation: the updated entity if the operation was successful or details of the error if\n * the operation failed.\n */\n async tryShareWithMany(\n contact: models.Contact,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.Contact>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(contact, EntityWithDelegationTypeName.Contact)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyContactAs(self, entityWithEncryptionKey) : contact\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.Contact,\n },\n Object.fromEntries(\n Object.entries(delegates).map(([delegateId, options]) => [\n delegateId,\n {\n requestedPermissions: options.requestedPermissions,\n shareEncryptionKeys: options.shareEncryptionKey,\n shareOwningEntityIds: options.sharePatientId,\n shareSecretIds: options.shareSecretIds,\n },\n ])\n ),\n (x) => this.bulkShareContacts(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: models.Contact\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.Contact })\n }\n\n getEncryptionKeysOf(entity: models.Contact): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.Contact }, undefined)\n }\n\n async subscribeToServiceEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Service> | undefined,\n eventFired: (dataSample: Service) => 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 'Service',\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted: Service) => (await this.decryptServices(currentUser.healthcarePartyId!, [encrypted]))[0]\n ).then((ws) => new ConnectionImpl(ws))\n }\n\n async subscribeToContactEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Contact> | undefined,\n eventFired: (dataSample: Contact) => 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 EntityWithDelegationTypeName.Contact,\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted: Contact) => (await this.decrypt(currentUser.healthcarePartyId!, [encrypted]))[0]\n ).then((ws) => new ConnectionImpl(ws))\n }\n\n createDelegationDeAnonymizationMetadata(entity: Contact, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: EntityWithDelegationTypeName.Contact }, delegates)\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-data-owner-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-data-owner-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,0CAAiH;AAGjH,sEAA2F;AAE3F,0EAAgG;AAChG,oEAAgE;AAMhE,MAAa,gBAAiB,SAAQ,iCAAe;IAInD,IAAY,eAAe;QACzB,IAAI,CAAC,IAAI,CAAC,4BAA4B;YAAE,OAAO,SAAS,CAAA;QACxD,OAAO,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,4BAA4B,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACxF,CAAC;IAED,YACE,IAAY,EACZ,OAAkC,EAClC,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,KAAK;QAET,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAA;IACzD,CAAC;IAED;;;;OAIG;IACH,0BAA0B,CAAC,SAA0B;QACnD,OAAO,IAAA,+BAAuB,EAAC,SAAS,CAAC,CAAA;IAC3C,CAAC;IAED;;;;OAIG;IACH,4BAA4B,CAAC,SAA0B;QACrD,OAAO,IAAA,iCAAyB,EAAC,SAAS,CAAC,CAAA;IAC7C,CAAC;IAED;;;OAGG;IACH,kBAAkB,CAAC,SAA0B;QAC3C,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,0BAA0B,CAAC,SAAS,CAAC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ACF;AAvLD,4CAuLC","sourcesContent":["import { User } from '../icc-api/model/User'\nimport { IccDeviceApi, IccPatientApi, IccUserApi } from '../icc-api'\nimport { HealthcareParty } from '../icc-api/model/HealthcareParty'\nimport { Patient } from '../icc-api/model/Patient'\nimport { Device } from '../icc-api/model/Device'\nimport { fingerprintV1, fingerprintV2, hexPublicKeysWithSha1Of, hexPublicKeysWithSha256Of } from './crypto/utils'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { XHR } from '../icc-api/api/XHR'\nimport { CryptoActorStub, CryptoActorStubWithType } from '../icc-api/model/CryptoActorStub'\nimport { DataOwnerTypeEnum } from '../icc-api/model/DataOwnerTypeEnum'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { IccDataownerApi } from '../icc-api/api/IccDataownerApi'\nimport { DataOwnerWithType } from '../icc-api/model/DataOwnerWithType'\n\nexport type DataOwnerOrStub = DataOwner | CryptoActorStub\nexport type DataOwner = HealthcareParty | Patient | Device\n\nexport class IccDataOwnerXApi extends IccDataownerApi {\n private currentDataOwnerType: DataOwnerTypeEnum | undefined\n private currentDataOwnerHierarchyIds: string[] | undefined\n\n private get selfDataOwnerId(): string | undefined {\n if (!this.currentDataOwnerHierarchyIds) return undefined\n return this.currentDataOwnerHierarchyIds[this.currentDataOwnerHierarchyIds.length - 1]\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n }\n\n /**\n * Gets the public keys of a data owner to be used for encryption with RSA-OAEP+SHA-1, in hex format.\n * @param dataOwner a data owner.\n * @return the public keys for the data owner in hex format.\n */\n getHexPublicKeysWithSha1Of(dataOwner: DataOwnerOrStub): Set<string> {\n return hexPublicKeysWithSha1Of(dataOwner)\n }\n\n /**\n * Gets the public keys of a data owner to be used for encryption with RSA-OAEP+SHA-256, in hex format.\n * @param dataOwner a data owner.\n * @return the public keys for the data owner in hex format.\n */\n getHexPublicKeysWithSha256Of(dataOwner: DataOwnerOrStub): Set<string> {\n return hexPublicKeysWithSha256Of(dataOwner)\n }\n\n /**\n * Gets all public keys of a data owner to be used for encryption, in hex format. Note that this may include keys that should be used for different\n * encryption algorithms.\n */\n getHexPublicKeysOf(dataOwner: DataOwnerOrStub): Set<string> {\n return new Set([...this.getHexPublicKeysWithSha1Of(dataOwner), ...this.getHexPublicKeysWithSha256Of(dataOwner)])\n }\n\n async getCurrentDataOwnerStub(): Promise<CryptoActorStubWithType> {\n return CryptoActorStubWithType.fromDataOwner(await this.getCurrentDataOwner())\n }\n\n /**\n * If the logged user is a data owner get the current data owner. This information is cached without expiration, and will only be updated in case\n * of forced refresh.\n * @throws if the current user is not a data owner.\n */\n async getCurrentDataOwnerId(): Promise<string> {\n if (!this.currentDataOwnerHierarchyIds) {\n await this.getCurrentDataOwnerHierarchyIds()\n }\n return this.currentDataOwnerHierarchyIds![this.currentDataOwnerHierarchyIds!.length - 1]\n }\n\n /**\n * If the logged user is a data owner get its parent hierarchy. This information is cached without expiration, and will only be updated in case\n * of forced refresh.\n * The resulting array starts with the topmost parent (the only ancestor without a parent) and ends with the data owner itself.\n * @throws if the current user is not a data owner.\n */\n async getCurrentDataOwnerHierarchyIds(): Promise<string[]> {\n if (!this.currentDataOwnerHierarchyIds) {\n await this.forceLoadCurrentDataOwnerHierarchyAndCacheIds()\n }\n return [...this.currentDataOwnerHierarchyIds!]\n }\n\n /**\n * Get the hierarchy for the current data owner starting from the specified parent.\n * @throws an array starting at the topmost parent and ending at the provided parent id. If the provided id is not part of the hierarchy throws an\n * error.\n */\n async getCurrentDataOwnerHierarchyIdsFrom(parentId: string): Promise<string[]> {\n if (!this.currentDataOwnerHierarchyIds) {\n await this.getCurrentDataOwnerHierarchyIds()\n }\n const res = []\n for (const dataOwnerId of this.currentDataOwnerHierarchyIds!) {\n res.push(dataOwnerId)\n if (dataOwnerId === parentId) return res\n }\n throw new Error(`${parentId} is not part of the data owner hierarchy for the current user`)\n }\n\n /**\n * If the logged user is a data owner get the current data owner and all of his parents.\n * @throws if the current user is not a data owner.\n * @return the current data owner hierarchy, starting from the topmost parent to the current data owner.\n */\n async getCurrentDataOwnerHierarchy(): Promise<DataOwnerWithType[]> {\n if (!this.currentDataOwnerHierarchyIds) {\n return await this.forceLoadCurrentDataOwnerHierarchyAndCacheIds()\n } else return Promise.all(this.currentDataOwnerHierarchyIds!.map((id) => this.getDataOwner(id)))\n }\n\n /**\n * If the logged user is a data owner get the type of the current data owner. This information is cached.\n * @throws if the current user is not a data owner\n */\n async getCurrentDataOwnerType(): Promise<DataOwnerTypeEnum> {\n if (!this.currentDataOwnerHierarchyIds) {\n await this.forceLoadCurrentDataOwnerHierarchyAndCacheIds()\n }\n return this.currentDataOwnerType!\n }\n\n /**\n * Get the id of the data owner entity for a user.\n * @param user a user that is also a data owner.\n * @return the id of the data owner corresponding to the provided user.\n * @throws if the user is not a data owner.\n */\n getDataOwnerIdOf(user: User): string {\n const dataOwnerId = user.healthcarePartyId ?? user.patientId ?? user.deviceId\n if (dataOwnerId == undefined) {\n throw Error(`User ${user.id} is not a data owner`)\n }\n return dataOwnerId\n }\n\n /**\n * Get a data owner. Note that this does not decrpyt patient data owners.\n * @param ownerId id of the data owner to retrieve (patient, medical device, hcp, ...)\n * @return the data owner with the provided id\n * @throws if you have no access to the data owner. Use {@link getCryptoActorStub}.\n */\n async getDataOwner(ownerId: string): Promise<DataOwnerWithType> {\n return super.getDataOwner(ownerId).then((dowt) => {\n if (dowt.dataOwner.id === this.selfDataOwnerId) this.checkDataOwnerIntegrity(dowt.dataOwner)\n return dowt\n })\n }\n\n /**\n * Get a crypto actor stub for a data owner.\n * @param ownerId id of the data owner for which you want to retrieve the stub (patient, medical device, hcp, ...)\n * @return the crypto actor stub of the data owner with the provided id\n */\n async getCryptoActorStub(ownerId: string): Promise<CryptoActorStubWithType> {\n return super.getCryptoActorStub(ownerId).then((dowt) => {\n if (dowt.stub.id === this.selfDataOwnerId) this.checkDataOwnerIntegrity(dowt.stub)\n return dowt\n })\n }\n\n /**\n * Clears the cache of current data owner id and parent hierarchy ids. The hierarchy of a data owner should not normally change over time, so this\n * method should be rarely needed.\n */\n clearCurrentDataOwnerIdsCache() {\n this.currentDataOwnerHierarchyIds = undefined\n }\n\n private checkDataOwnerIntegrity(dataOwner: DataOwnerOrStub) {\n const keys = new Set([...this.getHexPublicKeysWithSha1Of(dataOwner), ...this.getHexPublicKeysWithSha256Of(dataOwner)])\n if (new Set(Array.from(keys).map((x) => fingerprintV2(x))).size != keys.size)\n throw new Error(\n `Different public keys for ${dataOwner.id} have the same fingerprint; this should not happen in normal circumstances. Please report this error to iCure.`\n )\n }\n\n private async forceLoadCurrentDataOwnerHierarchyAndCacheIds(): Promise<DataOwnerWithType[]> {\n let curr = await this.getCurrentDataOwner()\n this.checkDataOwnerIntegrity(curr.dataOwner)\n this.currentDataOwnerType = curr.type\n let res = [curr]\n while ((curr.dataOwner as HealthcareParty).parentId) {\n curr = await this.getDataOwner((curr.dataOwner as HealthcareParty).parentId!)\n res = [curr, ...res]\n }\n this.currentDataOwnerHierarchyIds = res.map((x) => x.dataOwner.id!)\n return res\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"icc-data-owner-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-data-owner-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,0CAAiH;AAGjH,sEAA2F;AAE3F,0EAAgG;AAChG,oEAAgE;AAMhE,MAAa,gBAAiB,SAAQ,iCAAe;IAInD,IAAY,eAAe;QACzB,IAAI,CAAC,IAAI,CAAC,4BAA4B;YAAE,OAAO,SAAS,CAAA;QACxD,OAAO,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,4BAA4B,CAAC,MAAM,GAAG,CAAC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AC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI;YAC1E,MAAM,IAAI,KAAK,CACb,6BAA6B,SAAS,CAAC,EAAE,gHAAgH,CAC1J,CAAA;IACL,CAAC;IAEa,6CAA6C;;YACzD,IAAI,IAAI,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAA;YAC3C,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YAC5C,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAA;YACrC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,CAAA;YAChB,OAAQ,IAAI,CAAC,SAA6B,CAAC,QAAQ,EAAE,CAAC;gBACpD,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAE,IAAI,CAAC,SAA6B,CAAC,QAAS,CAAC,CAAA;gBAC7E,GAAG,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,CAAA;YACtB,CAAC;YACD,IAAI,CAAC,4BAA4B,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAG,CAAC,CAAA;YACnE,OAAO,GAAG,CAAA;QACZ,CAAC;KAAA;CACF;AAvLD,4CAuLC","sourcesContent":["import { User } from '../icc-api/model/User'\nimport { IccDeviceApi, IccPatientApi, IccUserApi } from '../icc-api'\nimport { HealthcareParty } from '../icc-api/model/HealthcareParty'\nimport { Patient } from '../icc-api/model/Patient'\nimport { Device } from '../icc-api/model/Device'\nimport { fingerprintV1, fingerprintV2, hexPublicKeysWithSha1Of, hexPublicKeysWithSha256Of } from './crypto/utils'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { XHR } from '../icc-api/api/XHR'\nimport { CryptoActorStub, CryptoActorStubWithType } from '../icc-api/model/CryptoActorStub'\nimport { DataOwnerTypeEnum } from '../icc-api/model/DataOwnerTypeEnum'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { IccDataownerApi } from '../icc-api/api/IccDataownerApi'\nimport { DataOwnerWithType } from '../icc-api/model/DataOwnerWithType'\n\nexport type DataOwnerOrStub = DataOwner | CryptoActorStub\nexport type DataOwner = HealthcareParty | Patient | Device\n\nexport class IccDataOwnerXApi extends IccDataownerApi {\n private currentDataOwnerType: DataOwnerTypeEnum | undefined\n private currentDataOwnerHierarchyIds: string[] | undefined\n\n private get selfDataOwnerId(): string | undefined {\n if (!this.currentDataOwnerHierarchyIds) return undefined\n return this.currentDataOwnerHierarchyIds[this.currentDataOwnerHierarchyIds.length - 1]\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n }\n\n /**\n * Gets the public keys of a data owner to be used for encryption with RSA-OAEP+SHA-1, in hex format.\n * @param dataOwner a data owner.\n * @return the public keys for the data owner in hex format.\n */\n getHexPublicKeysWithSha1Of(dataOwner: DataOwnerOrStub): Set<string> {\n return hexPublicKeysWithSha1Of(dataOwner)\n }\n\n /**\n * Gets the public keys of a data owner to be used for encryption with RSA-OAEP+SHA-256, in hex format.\n * @param dataOwner a data owner.\n * @return the public keys for the data owner in hex format.\n */\n getHexPublicKeysWithSha256Of(dataOwner: DataOwnerOrStub): Set<string> {\n return hexPublicKeysWithSha256Of(dataOwner)\n }\n\n /**\n * Gets all public keys of a data owner to be used for encryption, in hex format. Note that this may include keys that should be used for different\n * encryption algorithms.\n */\n getHexPublicKeysOf(dataOwner: DataOwnerOrStub): Set<string> {\n return new Set([...this.getHexPublicKeysWithSha1Of(dataOwner), ...this.getHexPublicKeysWithSha256Of(dataOwner)])\n }\n\n async getCurrentDataOwnerStub(): Promise<CryptoActorStubWithType> {\n return CryptoActorStubWithType.fromDataOwner(await this.getCurrentDataOwner())\n }\n\n /**\n * If the logged user is a data owner get the current data owner. This information is cached without expiration, and will only be updated in case\n * of forced refresh.\n * @throws if the current user is not a data owner.\n */\n async getCurrentDataOwnerId(): Promise<string> {\n if (!this.currentDataOwnerHierarchyIds) {\n await this.getCurrentDataOwnerHierarchyIds()\n }\n return this.currentDataOwnerHierarchyIds![this.currentDataOwnerHierarchyIds!.length - 1]\n }\n\n /**\n * If the logged user is a data owner get its parent hierarchy. This information is cached without expiration, and will only be updated in case\n * of forced refresh.\n * The resulting array starts with the topmost parent (the only ancestor without a parent) and ends with the data owner itself.\n * @throws if the current user is not a data owner.\n */\n async getCurrentDataOwnerHierarchyIds(): Promise<string[]> {\n if (!this.currentDataOwnerHierarchyIds) {\n await this.forceLoadCurrentDataOwnerHierarchyAndCacheIds()\n }\n return [...this.currentDataOwnerHierarchyIds!]\n }\n\n /**\n * Get the hierarchy for the current data owner starting from the specified parent.\n * @throws an array starting at the topmost parent and ending at the provided parent id. If the provided id is not part of the hierarchy throws an\n * error.\n */\n async getCurrentDataOwnerHierarchyIdsFrom(parentId: string): Promise<string[]> {\n if (!this.currentDataOwnerHierarchyIds) {\n await this.getCurrentDataOwnerHierarchyIds()\n }\n const res = []\n for (const dataOwnerId of this.currentDataOwnerHierarchyIds!) {\n res.push(dataOwnerId)\n if (dataOwnerId === parentId) return res\n }\n throw new Error(`${parentId} is not part of the data owner hierarchy for the current user`)\n }\n\n /**\n * If the logged user is a data owner get the current data owner and all of his parents.\n * @throws if the current user is not a data owner.\n * @return the current data owner hierarchy, starting from the topmost parent to the current data owner.\n */\n async getCurrentDataOwnerHierarchy(): Promise<DataOwnerWithType[]> {\n if (!this.currentDataOwnerHierarchyIds) {\n return await this.forceLoadCurrentDataOwnerHierarchyAndCacheIds()\n } else return Promise.all(this.currentDataOwnerHierarchyIds!.map((id) => this.getDataOwner(id)))\n }\n\n /**\n * If the logged user is a data owner get the type of the current data owner. This information is cached.\n * @throws if the current user is not a data owner\n */\n async getCurrentDataOwnerType(): Promise<DataOwnerTypeEnum> {\n if (!this.currentDataOwnerHierarchyIds) {\n await this.forceLoadCurrentDataOwnerHierarchyAndCacheIds()\n }\n return this.currentDataOwnerType!\n }\n\n /**\n * Get the id of the data owner entity for a user.\n * @param user a user that is also a data owner.\n * @return the id of the data owner corresponding to the provided user.\n * @throws if the user is not a data owner.\n */\n getDataOwnerIdOf(user: User): string {\n const dataOwnerId = user.healthcarePartyId ?? user.patientId ?? user.deviceId\n if (dataOwnerId == undefined) {\n throw Error(`User ${user.id} is not a data owner`)\n }\n return dataOwnerId\n }\n\n /**\n * Get a data owner. Note that this does not decrpyt patient data owners.\n * @param ownerId id of the data owner to retrieve (patient, medical device, hcp, ...)\n * @return the data owner with the provided id\n * @throws if you have no access to the data owner. Use {@link getCryptoActorStub}.\n */\n async getDataOwner(ownerId: string): Promise<DataOwnerWithType> {\n return super.getDataOwner(ownerId).then((dowt) => {\n if (dowt.dataOwner.id === this.selfDataOwnerId) this.checkDataOwnerIntegrity(dowt.dataOwner)\n return dowt\n })\n }\n\n /**\n * Get a crypto actor stub for a data owner.\n * @param ownerId id of the data owner for which you want to retrieve the stub (patient, medical device, hcp, ...)\n * @return the crypto actor stub of the data owner with the provided id\n */\n async getCryptoActorStub(ownerId: string): Promise<CryptoActorStubWithType> {\n return super.getCryptoActorStub(ownerId).then((dowt) => {\n if (dowt.stub.id === this.selfDataOwnerId) this.checkDataOwnerIntegrity(dowt.stub)\n return dowt\n })\n }\n\n /**\n * Clears the cache of current data owner id and parent hierarchy ids. The hierarchy of a data owner should not normally change over time, so this\n * method should be rarely needed.\n */\n clearCurrentDataOwnerIdsCache() {\n this.currentDataOwnerHierarchyIds = undefined\n }\n\n private checkDataOwnerIntegrity(dataOwner: DataOwnerOrStub) {\n const keys = new Set([...this.getHexPublicKeysWithSha1Of(dataOwner), ...this.getHexPublicKeysWithSha256Of(dataOwner)])\n if (new Set(Array.from(keys).map((x) => fingerprintV2(x))).size != keys.size)\n throw new Error(\n `Different public keys for ${dataOwner.id} have the same fingerprint; this should not happen in normal circumstances. Please report this error to iCure.`\n )\n }\n\n private async forceLoadCurrentDataOwnerHierarchyAndCacheIds(): Promise<DataOwnerWithType[]> {\n let curr = await this.getCurrentDataOwner()\n this.checkDataOwnerIntegrity(curr.dataOwner)\n this.currentDataOwnerType = curr.type\n let res = [curr]\n while ((curr.dataOwner as HealthcareParty).parentId) {\n curr = await this.getDataOwner((curr.dataOwner as HealthcareParty).parentId!)\n res = [curr, ...res]\n }\n this.currentDataOwnerHierarchyIds = res.map((x) => x.dataOwner.id!)\n return res\n }\n}\n"]}
|
|
@@ -25,8 +25,8 @@ class IccDeviceXApi extends icc_api_1.IccDeviceApi {
|
|
|
25
25
|
this.userApi = userApi;
|
|
26
26
|
this.authApi = authApi;
|
|
27
27
|
}
|
|
28
|
-
subscribeToDeviceEvents(
|
|
29
|
-
return __awaiter(this,
|
|
28
|
+
subscribeToDeviceEvents(eventTypes_1, filter_1, eventFired_1) {
|
|
29
|
+
return __awaiter(this, arguments, void 0, function* (eventTypes, filter, eventFired, options = {}) {
|
|
30
30
|
return (0, websocket_1.subscribeToEntityEvents)(this.host, this.authApi, 'Device', eventTypes, filter, eventFired, options).then((rs) => new Connection_1.ConnectionImpl(rs));
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-device-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-device-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAmD;AAEnD,0EAA8F;AAE9F,4DAAsE;AACtE,iDAA8E;AAG9E,qCAAqC;AACrC,MAAa,aAAc,SAAQ,sBAAY;IAI7C,YACE,IAAY,EACZ,OAAkC,EAClC,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,OAAoB,EACpB,OAAmB,EACnB,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CA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CAAC,EAAE,CAAC,CAAC,CAAA;QACxC,CAAC;KAAA;CACF;AAtCD,sCAsCC","sourcesContent":["import {IccAuthApi, IccDeviceApi} from '../icc-api'\nimport {Device} from '../icc-api/model/Device'\nimport {AuthenticationProvider, NoAuthenticationProvider} from './auth/AuthenticationProvider'\nimport {AbstractFilter} from \"./filters/filters\"\nimport {Connection, ConnectionImpl} from \"../icc-api/model/Connection\"\nimport {subscribeToEntityEvents, SubscriptionOptions} from \"./utils/websocket\"\nimport {IccUserXApi} from \"./icc-user-x-api\"\n\n// noinspection JSUnusedGlobalSymbols\nexport class IccDeviceXApi extends IccDeviceApi {\n private readonly userApi: IccUserXApi\n private readonly authApi: IccAuthApi\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n userApi: IccUserXApi,\n authApi: IccAuthApi,\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.userApi = userApi\n this.authApi = authApi\n }\n\n async subscribeToDeviceEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Device> | undefined,\n eventFired: (dataSample: Device) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n return subscribeToEntityEvents(\n this.host,\n this.authApi,\n 'Device',\n eventTypes,\n filter,\n eventFired,\n options,\n ).then((rs) => new ConnectionImpl(rs))\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-doctemplate-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-doctemplate-x-api.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAM9C,uDAAgD;AAChD,4CAAwC;AACxC,0EAAgG;AAEhG,qCAAqC;AACrC,MAAa,kBAAmB,SAAQ,2BAAiB;IAKvD,YACE,I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AAC;gBAC3D,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAA;gBACpC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;gBACpC,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YACxB,CAAC;iBAAM,IAAI,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;gBACzI,OAAO,GAAG,CAAC,IAAI,CAAA;YACjB,CAAC;iBAAM,CAAC;gBACN,OAAO,KAAK,CAAA;YACd,CAAC;QACH,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC;CACF;AA1FD,gDA0FC","sourcesContent":["import { IccDoctemplateApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport { extend } from 'lodash'\nimport * as models from '../icc-api/model/models'\nimport { DocumentTemplate } from '../icc-api/model/models'\nimport { string2ua } from './utils/binary-utils'\nimport { XHR } from '../icc-api/api/XHR'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\n\n// noinspection JSUnusedGlobalSymbols\nexport class IccDoctemplateXApi extends IccDoctemplateApi {\n crypto: IccCryptoXApi\n authenticationProvider: AuthenticationProvider\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\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.authenticationProvider = authenticationProvider\n this.fetchImpl = fetchImpl\n }\n\n newInstance(user: models.User, template: string, c: any): Promise<DocumentTemplate> {\n return new Promise<DocumentTemplate>((resolve, reject) => {\n const documentTemplate: DocumentTemplate = {\n ...(c ?? {}),\n _type: 'org.taktik.icure.entities.DocumentTemplate',\n id: c?.id ?? this.crypto.primitives.randomUuid(),\n owner: c?.owner ?? user.id,\n created: c?.created ?? new Date().getTime(),\n modified: c?.modified ?? new Date().getTime(),\n guid: c?.guid ?? this.crypto.primitives.randomUuid(),\n group: c?.group ?? null,\n specialty: c?.specialty ?? null,\n attachment: c?.attachment ?? string2ua(template),\n mainUti: c?.mainUti ?? 'public.plain-text',\n }\n if (documentTemplate.group && documentTemplate.group.guid == null) {\n documentTemplate.group.guid = this.crypto.primitives.randomUuid()\n }\n\n //sauver l doctemplate vide\n\n if (template) {\n //save attachement\n }\n\n return resolve(documentTemplate)\n })\n }\n\n // noinspection JSUnusedLocalSymbols\n findAllByOwnerId(ownerId: string): Promise<Array<models.DocumentTemplate>> {\n return new Promise(function (resolve, reject) {\n reject(console.log('findByHCPartyPatientSecretFKeys not implemented in document API!'))\n })\n }\n\n // noinspection JSUnusedGlobalSymbols\n getAttachmentUrl(documentId: string, attachmentId: string) {\n return (\n this.host + '/doctemplate/{documentId}/attachment/{attachmentId}'.replace('{documentId}', documentId).replace('{attachmentId}', attachmentId)\n )\n }\n\n getAttachmentText(documentTemplateId: string, attachmentId: string): Promise<any | boolean> {\n const _body = null\n\n const _url =\n this.host +\n '/doctemplate/{documentTemplateId}/attachmentText/{attachmentId}'\n .replace('{documentTemplateId}', documentTemplateId + '')\n .replace('{attachmentId}', attachmentId + '') +\n '?ts=' +\n new Date().getTime()\n\n return XHR.sendCommand('GET', _url, this.headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => {\n if (doc.contentType.startsWith('application/octet-stream')) {\n const enc = new TextDecoder('utf-8')\n const arr = new Uint8Array(doc.body)\n return enc.decode(arr)\n } else if (doc.contentType.startsWith('text/plain') || doc.contentType.startsWith('text/html') || doc.contentType.startsWith('text/xml')) {\n return doc.body\n } else {\n return false\n }\n })\n .catch((err) => this.handleError(err))\n }\n}\n"]}
|