@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":"utils.js","sourceRoot":"","sources":["../../../icc-x-api/crypto/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wBAAwB;AACxB,sDAAsF;AAEtF,+BAA4C;AAC5C,oCAA+D;AAC/D,yDAAqD;AAKrD,qEAAiE;AACjE,wFAAoF;AAEpF,6EAAyE;AACzE,IAAO,uBAAuB,GAAG,uCAAkB,CAAC,uBAAuB,CAAA;AAE3E;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,SAAoB;;IAC5D,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAA,SAAS,CAAC,2BAA2B,mCAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAa,CAAC,CAAA;AAC7G,CAAC;AAFD,8DAEC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,SA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,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,YAAY,EAAE;QAC9C,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAA;KAClF;AACH,CAAC;AAJD,gEAIC","sourcesContent":["// Uses fp as node names\nimport { acyclic, graphFromEdges, StronglyConnectedGraph } from '../utils/graph-utils'\nimport { DataOwner, DataOwnerOrStub, IccDataOwnerXApi } from '../icc-data-owner-x-api'\nimport { RSAUtils, ShaVersion } from './RSA'\nimport { EntityWithDelegationTypeName, hex2ua } from '../utils'\nimport { Patient } from '../../icc-api/model/Patient'\nimport { ExtendedApisUtils } from './ExtendedApisUtils'\nimport { CryptoPrimitives } from './CryptoPrimitives'\nimport { EncryptedEntityWithType } from '../utils/EntityWithDelegationTypeName'\nimport { IccPatientApi } from '../../icc-api'\nimport { ShareMetadataBehaviour } from './ShareMetadataBehaviour'\nimport { EntityShareRequest } from '../../icc-api/model/requests/EntityShareRequest'\nimport { DataOwnerWithType } from '../../icc-api/model/DataOwnerWithType'\nimport { DataOwnerTypeEnum } from '../../icc-api/model/DataOwnerTypeEnum'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\n\n/**\n * Get the public keys of a data owner which should be used for RSA-OAEP with sha256.\n * @param dataOwner\n */\nexport function hexPublicKeysWithSha256Of(dataOwner: DataOwner) {\n return new Set([...(dataOwner.publicKeysForOaepWithSha256 ?? [])].filter((pubKey) => !!pubKey) as string[])\n}\n\n/**\n * Get the public keys of a data owner which should be used for RSA-OAEP with sha1.\n * @param dataOwner\n */\nexport function hexPublicKeysWithSha1Of(dataOwner: DataOwner) {\n return new Set(\n [dataOwner.publicKey, ...Object.keys(dataOwner.aesExchangeKeys ?? {}).filter((k) => k[0] != 'x')].filter((pubKey) => !!pubKey) as string[]\n )\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Get the transfer key graph for a data owner. Node names are the public key fingerprints of the data owner's keys, and an edge represents a key\n * which can be retrieved from another key using the transfer keys.\n * @param dataOwner a data owner.\n * @return a graph representing the possible key recovery paths using transfer keys for hte provided data owner.\n */\nexport function transferKeysFpGraphOf(dataOwner: DataOwner): StronglyConnectedGraph {\n const publicKeys = Array.from([...hexPublicKeysWithSha1Of(dataOwner), ...hexPublicKeysWithSha256Of(dataOwner)])\n const edges: [string, string][] = []\n Object.entries(dataOwner.transferKeys ?? {}).forEach(([from, tos]) => {\n Object.keys(tos).forEach((to) => {\n edges.push([fingerprintV1(from), fingerprintV1(to)])\n })\n })\n return acyclic(\n graphFromEdges(\n edges,\n publicKeys.map((x) => fingerprintV1(x))\n )\n )\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Get a map for converting public keys fingerprint to full public keys for the provided data owner.\n * @param dataOwner a data owner.\n * @param shaVersion gets only the keys that are generated with this SHA version (default: 'sha-1').\n * @return a map to convert fingerprints of the data owner into full public keys.\n */\nexport function fingerprintToPublicKeysMapOf(dataOwner: DataOwner, shaVersion: ShaVersion): { [fp: string]: string } {\n const publicKeys = shaVersion === 'sha-1' ? Array.from(hexPublicKeysWithSha1Of(dataOwner)) : Array.from(hexPublicKeysWithSha256Of(dataOwner))\n const res: { [fp: string]: string } = {}\n publicKeys.forEach((pk) => {\n res[fingerprintV1(pk)] = pk\n })\n return res\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Load many public keys in spki format.\n * @param rsa the rsa service\n * @param publicKeysSpkiHex public keys in spki format, hex encoded.\n * @param shaVersion the version of the Sha algorithm used in the keys generations. ()\n * @return public keys as crypto keys by their fingerprint.\n */\nexport async function loadPublicKeys(\n rsa: RSAUtils,\n publicKeysSpkiHex: string[],\n shaVersion: ShaVersion\n): Promise<{ [publicKeyFingerprint: string]: CryptoKey }> {\n return Object.fromEntries(\n await Promise.all(publicKeysSpkiHex.map(async (x) => [fingerprintV1(x), await rsa.importKey('spki', hex2ua(x), ['encrypt'], shaVersion)]))\n )\n}\n\n/**\n * @internal This method is intended only for internal use and may be changed without notice.\n * Creates a delegation for the current data owner if the data owner is an encrypted entity and there is no delegation to himself.\n * @return the updated self.\n */\nexport async function ensureDelegationForSelf(\n dataOwnerApi: IccDataOwnerXApi,\n xapi: ExtendedApisUtils,\n patientApi: IccPatientApi,\n cryptoPrimitives: CryptoPrimitives\n): Promise<DataOwnerWithType> {\n const self = await dataOwnerApi.getCurrentDataOwner()\n if (self.type === 'patient') {\n const patient = new Patient(self.dataOwner)\n const patientWithType: EncryptedEntityWithType = { entity: patient, type: EntityWithDelegationTypeName.Patient }\n const availableSecretIds = await xapi.secretIdsOf(patientWithType, undefined)\n if (availableSecretIds.length) {\n return self\n } else {\n if (xapi.hasEmptyEncryptionMetadata(patient)) {\n // This should not really happen, usually some user will have already initialised the patient and its encryption metadata.\n const updatedPatient = await xapi.entityWithInitialisedEncryptedMetadata(\n patient,\n EntityWithDelegationTypeName.Patient,\n undefined,\n undefined,\n true,\n {},\n undefined\n )\n return { dataOwner: await patientApi.modifyPatient(updatedPatient.updatedEntity), type: DataOwnerTypeEnum.Patient }\n } else {\n const updatedPatient = await xapi.simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: patient,\n type: EntityWithDelegationTypeName.Patient,\n },\n {\n [patient.id!]: {\n shareEncryptionKeys: ShareMetadataBehaviour.IF_AVAILABLE,\n shareOwningEntityIds: ShareMetadataBehaviour.NEVER,\n shareSecretIds: [cryptoPrimitives.randomUuid()],\n requestedPermissions: RequestedPermissionEnum.FULL_WRITE,\n },\n },\n (x) => patientApi.bulkSharePatients(x)\n )\n return { dataOwner: updatedPatient.updatedEntityOrThrow, type: DataOwnerTypeEnum.Patient }\n }\n }\n } else {\n return self\n }\n}\n\n/**\n * Search a public key in the data owner and returns the corresponding SHA version used to generate it or undefined if not found.\n * @param dataOwner the data owner.\n * @param publicKey the public key.\n * @return 'sha-1', 'sha-256', undefined\n */\nexport function getShaVersionForKey(dataOwner: DataOwnerOrStub, publicKey: string): ShaVersion | undefined {\n return dataOwner.publicKey === publicKey || Object.keys(dataOwner.aesExchangeKeys ?? {}).includes(publicKey)\n ? ShaVersion.Sha1\n : !!dataOwner.publicKeysForOaepWithSha256?.includes(publicKey)\n ? ShaVersion.Sha256\n : undefined\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Calculates the fingerprint from the hexadecimal representation of a SPKI key. The fingerprint is calculated as the last 16 bytes (32 characters)\n * of the SPKI key.\n * @param key the hexadecimal representation of the SPKI key.\n * @return the fingerprint.\n */\nexport function fingerprintV1(key: string): string {\n return key.slice(-32)\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Calculates the fingerprint from the hexadecimal representation of a SPKI key. The fingerprint is calculated as the last 16 bytes (32 characters) from which the\n * last 5 (10 characters) are removed because they are a constant of the SPKI format.\n * @param key the hexadecimal representation of the SPKI key.\n * @return the fingerprint.\n */\nexport function fingerprintV2(key: string): string {\n return key.slice(-32, -10)\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Converts the fingerprint of a key from a V1 format to a V2 format.\n * @param fp the fingerprint of the key in the V1 format.\n * @return the fingerprint of the key in the v2 format.\n */\nexport function fingerprintV1toV2(fp: string): string {\n // Conversion resilient to mistakes: if the fingerprint is already in V2 format it will be returned as is.\n return fp.slice(0, 22)\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param fp the fingerprint.\n * @return true if the fingerprint is in V1 format, false otherwise.\n */\nexport function fingerprintIsV1(fp: string): boolean {\n return fp.length === 32\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param fp the fingerprint.\n * @return true if the fingerprint is in V2 format, false otherwise.\n */\nexport function fingerprintIsV2(fp: string): boolean {\n return fp.length === 22\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param fp the fingerprint v2.\n * @return the fingerprint v1 using the standard tail.\n */\nexport function fingerprintV2ToStandardV1(fp: string): string {\n return fp + '0203010001'\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param publicKeyOrFpv1 a public key in spki format or a public key fp v1\n * @throws if the input does not terminate with 0203010001\n */\nexport function checkStandardPublicKeyTail(publicKeyOrFpv1: string) {\n if (publicKeyOrFpv1.slice(-10) != '0203010001') {\n throw new Error('Illegal state: generated public key should end with 0203010001')\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../icc-x-api/crypto/utils.ts"],"names":[],"mappings":";;;;;;;;;;;AAoBA,8DAEC;AAMD,0DAIC;AASD,sDAcC;AASD,oEAOC;AAUD,wCAQC;AAOD,0DAgDC;AAQD,kDAMC;AASD,sCAEC;AASD,sCAEC;AAQD,8CAGC;AAOD,0CAEC;AAOD,0CAEC;AAOD,8DAEC;AAOD,gEAIC;AArOD,wBAAwB;AACxB,sDAAsF;AAEtF,+BAA4C;AAC5C,oCAA+D;AAC/D,yDAAqD;AAKrD,qEAAiE;AACjE,wFAAoF;AAEpF,6EAAyE;AACzE,IAAO,uBAAuB,GAAG,uCAAkB,CAAC,uBAAuB,CAAA;AAE3E;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,SAAoB;;IAC5D,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAA,SAAS,CAAC,2BAA2B,mCAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAa,CAAC,CAAA;AAC7G,CAAC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,SAAoB;;IAC1D,OAAO,IAAI,GAAG,CACZ,CAAC,SAAS,CAAC,SAAS,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,MAAA,SAAS,CAAC,eAAe,mCAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,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D,CAAC,CAAC,gBAAU,CAAC,MAAM;YACnB,CAAC,CAAC,SAAS,CAAA;AACf,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAA;AACvB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;AAC5B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,EAAU;IAC1C,0GAA0G;IAC1G,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AACxB,CAAC;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAC,EAAU;IACxC,OAAO,EAAE,CAAC,MAAM,KAAK,EAAE,CAAA;AACzB,CAAC;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAC,EAAU;IACxC,OAAO,EAAE,CAAC,MAAM,KAAK,EAAE,CAAA;AACzB,CAAC;AAED;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,EAAU;IAClD,OAAO,EAAE,GAAG,YAAY,CAAA;AAC1B,CAAC;AAED;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,eAAuB;IAChE,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAA;IACnF,CAAC;AACH,CAAC","sourcesContent":["// Uses fp as node names\nimport { acyclic, graphFromEdges, StronglyConnectedGraph } from '../utils/graph-utils'\nimport { DataOwner, DataOwnerOrStub, IccDataOwnerXApi } from '../icc-data-owner-x-api'\nimport { RSAUtils, ShaVersion } from './RSA'\nimport { EntityWithDelegationTypeName, hex2ua } from '../utils'\nimport { Patient } from '../../icc-api/model/Patient'\nimport { ExtendedApisUtils } from './ExtendedApisUtils'\nimport { CryptoPrimitives } from './CryptoPrimitives'\nimport { EncryptedEntityWithType } from '../utils/EntityWithDelegationTypeName'\nimport { IccPatientApi } from '../../icc-api'\nimport { ShareMetadataBehaviour } from './ShareMetadataBehaviour'\nimport { EntityShareRequest } from '../../icc-api/model/requests/EntityShareRequest'\nimport { DataOwnerWithType } from '../../icc-api/model/DataOwnerWithType'\nimport { DataOwnerTypeEnum } from '../../icc-api/model/DataOwnerTypeEnum'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\n\n/**\n * Get the public keys of a data owner which should be used for RSA-OAEP with sha256.\n * @param dataOwner\n */\nexport function hexPublicKeysWithSha256Of(dataOwner: DataOwner) {\n return new Set([...(dataOwner.publicKeysForOaepWithSha256 ?? [])].filter((pubKey) => !!pubKey) as string[])\n}\n\n/**\n * Get the public keys of a data owner which should be used for RSA-OAEP with sha1.\n * @param dataOwner\n */\nexport function hexPublicKeysWithSha1Of(dataOwner: DataOwner) {\n return new Set(\n [dataOwner.publicKey, ...Object.keys(dataOwner.aesExchangeKeys ?? {}).filter((k) => k[0] != 'x')].filter((pubKey) => !!pubKey) as string[]\n )\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Get the transfer key graph for a data owner. Node names are the public key fingerprints of the data owner's keys, and an edge represents a key\n * which can be retrieved from another key using the transfer keys.\n * @param dataOwner a data owner.\n * @return a graph representing the possible key recovery paths using transfer keys for hte provided data owner.\n */\nexport function transferKeysFpGraphOf(dataOwner: DataOwner): StronglyConnectedGraph {\n const publicKeys = Array.from([...hexPublicKeysWithSha1Of(dataOwner), ...hexPublicKeysWithSha256Of(dataOwner)])\n const edges: [string, string][] = []\n Object.entries(dataOwner.transferKeys ?? {}).forEach(([from, tos]) => {\n Object.keys(tos).forEach((to) => {\n edges.push([fingerprintV1(from), fingerprintV1(to)])\n })\n })\n return acyclic(\n graphFromEdges(\n edges,\n publicKeys.map((x) => fingerprintV1(x))\n )\n )\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Get a map for converting public keys fingerprint to full public keys for the provided data owner.\n * @param dataOwner a data owner.\n * @param shaVersion gets only the keys that are generated with this SHA version (default: 'sha-1').\n * @return a map to convert fingerprints of the data owner into full public keys.\n */\nexport function fingerprintToPublicKeysMapOf(dataOwner: DataOwner, shaVersion: ShaVersion): { [fp: string]: string } {\n const publicKeys = shaVersion === 'sha-1' ? Array.from(hexPublicKeysWithSha1Of(dataOwner)) : Array.from(hexPublicKeysWithSha256Of(dataOwner))\n const res: { [fp: string]: string } = {}\n publicKeys.forEach((pk) => {\n res[fingerprintV1(pk)] = pk\n })\n return res\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Load many public keys in spki format.\n * @param rsa the rsa service\n * @param publicKeysSpkiHex public keys in spki format, hex encoded.\n * @param shaVersion the version of the Sha algorithm used in the keys generations. ()\n * @return public keys as crypto keys by their fingerprint.\n */\nexport async function loadPublicKeys(\n rsa: RSAUtils,\n publicKeysSpkiHex: string[],\n shaVersion: ShaVersion\n): Promise<{ [publicKeyFingerprint: string]: CryptoKey }> {\n return Object.fromEntries(\n await Promise.all(publicKeysSpkiHex.map(async (x) => [fingerprintV1(x), await rsa.importKey('spki', hex2ua(x), ['encrypt'], shaVersion)]))\n )\n}\n\n/**\n * @internal This method is intended only for internal use and may be changed without notice.\n * Creates a delegation for the current data owner if the data owner is an encrypted entity and there is no delegation to himself.\n * @return the updated self.\n */\nexport async function ensureDelegationForSelf(\n dataOwnerApi: IccDataOwnerXApi,\n xapi: ExtendedApisUtils,\n patientApi: IccPatientApi,\n cryptoPrimitives: CryptoPrimitives\n): Promise<DataOwnerWithType> {\n const self = await dataOwnerApi.getCurrentDataOwner()\n if (self.type === 'patient') {\n const patient = new Patient(self.dataOwner)\n const patientWithType: EncryptedEntityWithType = { entity: patient, type: EntityWithDelegationTypeName.Patient }\n const availableSecretIds = await xapi.secretIdsOf(patientWithType, undefined)\n if (availableSecretIds.length) {\n return self\n } else {\n if (xapi.hasEmptyEncryptionMetadata(patient)) {\n // This should not really happen, usually some user will have already initialised the patient and its encryption metadata.\n const updatedPatient = await xapi.entityWithInitialisedEncryptedMetadata(\n patient,\n EntityWithDelegationTypeName.Patient,\n undefined,\n undefined,\n true,\n {},\n undefined\n )\n return { dataOwner: await patientApi.modifyPatient(updatedPatient.updatedEntity), type: DataOwnerTypeEnum.Patient }\n } else {\n const updatedPatient = await xapi.simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: patient,\n type: EntityWithDelegationTypeName.Patient,\n },\n {\n [patient.id!]: {\n shareEncryptionKeys: ShareMetadataBehaviour.IF_AVAILABLE,\n shareOwningEntityIds: ShareMetadataBehaviour.NEVER,\n shareSecretIds: [cryptoPrimitives.randomUuid()],\n requestedPermissions: RequestedPermissionEnum.FULL_WRITE,\n },\n },\n (x) => patientApi.bulkSharePatients(x)\n )\n return { dataOwner: updatedPatient.updatedEntityOrThrow, type: DataOwnerTypeEnum.Patient }\n }\n }\n } else {\n return self\n }\n}\n\n/**\n * Search a public key in the data owner and returns the corresponding SHA version used to generate it or undefined if not found.\n * @param dataOwner the data owner.\n * @param publicKey the public key.\n * @return 'sha-1', 'sha-256', undefined\n */\nexport function getShaVersionForKey(dataOwner: DataOwnerOrStub, publicKey: string): ShaVersion | undefined {\n return dataOwner.publicKey === publicKey || Object.keys(dataOwner.aesExchangeKeys ?? {}).includes(publicKey)\n ? ShaVersion.Sha1\n : !!dataOwner.publicKeysForOaepWithSha256?.includes(publicKey)\n ? ShaVersion.Sha256\n : undefined\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Calculates the fingerprint from the hexadecimal representation of a SPKI key. The fingerprint is calculated as the last 16 bytes (32 characters)\n * of the SPKI key.\n * @param key the hexadecimal representation of the SPKI key.\n * @return the fingerprint.\n */\nexport function fingerprintV1(key: string): string {\n return key.slice(-32)\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Calculates the fingerprint from the hexadecimal representation of a SPKI key. The fingerprint is calculated as the last 16 bytes (32 characters) from which the\n * last 5 (10 characters) are removed because they are a constant of the SPKI format.\n * @param key the hexadecimal representation of the SPKI key.\n * @return the fingerprint.\n */\nexport function fingerprintV2(key: string): string {\n return key.slice(-32, -10)\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * Converts the fingerprint of a key from a V1 format to a V2 format.\n * @param fp the fingerprint of the key in the V1 format.\n * @return the fingerprint of the key in the v2 format.\n */\nexport function fingerprintV1toV2(fp: string): string {\n // Conversion resilient to mistakes: if the fingerprint is already in V2 format it will be returned as is.\n return fp.slice(0, 22)\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param fp the fingerprint.\n * @return true if the fingerprint is in V1 format, false otherwise.\n */\nexport function fingerprintIsV1(fp: string): boolean {\n return fp.length === 32\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param fp the fingerprint.\n * @return true if the fingerprint is in V2 format, false otherwise.\n */\nexport function fingerprintIsV2(fp: string): boolean {\n return fp.length === 22\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param fp the fingerprint v2.\n * @return the fingerprint v1 using the standard tail.\n */\nexport function fingerprintV2ToStandardV1(fp: string): string {\n return fp + '0203010001'\n}\n\n/**\n * @internal this function is meant only for internal use and may be changed without notice.\n * @param publicKeyOrFpv1 a public key in spki format or a public key fp v1\n * @throws if the input does not terminate with 0203010001\n */\nexport function checkStandardPublicKeyTail(publicKeyOrFpv1: string) {\n if (publicKeyOrFpv1.slice(-10) != '0203010001') {\n throw new Error('Illegal state: generated public key should end with 0203010001')\n }\n}\n"]}
|
|
@@ -49,9 +49,9 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
49
49
|
* and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.
|
|
50
50
|
* @return a new instance of access log.
|
|
51
51
|
*/
|
|
52
|
-
newInstance(
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
newInstance(user_1, patient_1, h_1) {
|
|
53
|
+
return __awaiter(this, arguments, void 0, function* (user, patient, h, options = {}) {
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
55
55
|
const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
56
56
|
const accessLog = Object.assign(Object.assign({}, (h !== null && h !== void 0 ? h : {})), { _type: 'org.taktik.icure.entities.AccessLog', id: (_a = h === null || h === void 0 ? void 0 : h.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = h === null || h === void 0 ? void 0 : h.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = h === null || h === void 0 ? void 0 : h.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), date: (_d = h === null || h === void 0 ? void 0 : h.date) !== null && _d !== void 0 ? _d : new Date().getTime(), responsible: (_e = h === null || h === void 0 ? void 0 : h.responsible) !== null && _e !== void 0 ? _e : (this.autofillAuthor ? dataOwnerId : undefined), author: (_f = h === null || h === void 0 ? void 0 : h.author) !== null && _f !== void 0 ? _f : (this.autofillAuthor ? user.id : undefined), codes: (_g = h === null || h === void 0 ? void 0 : h.codes) !== null && _g !== void 0 ? _g : [], tags: (_h = h === null || h === void 0 ? void 0 : h.tags) !== null && _h !== void 0 ? _h : [], user: (_j = h === null || h === void 0 ? void 0 : h.user) !== null && _j !== void 0 ? _j : user.id, accessType: (_k = h === null || h === void 0 ? void 0 : h.accessType) !== null && _k !== void 0 ? _k : 'USER_ACCESS' });
|
|
57
57
|
const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
@@ -77,9 +77,9 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
77
77
|
* and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.
|
|
78
78
|
* @return a new instance of access log.
|
|
79
79
|
*/
|
|
80
|
-
newInstanceNoPatient(
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
newInstanceNoPatient(user_1, h_1) {
|
|
81
|
+
return __awaiter(this, arguments, void 0, function* (user, h, options = {}) {
|
|
82
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
83
83
|
const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
84
84
|
const accessLog = Object.assign(Object.assign({}, (h !== null && h !== void 0 ? h : {})), { _type: 'org.taktik.icure.entities.AccessLog', id: (_a = h === null || h === void 0 ? void 0 : h.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = h === null || h === void 0 ? void 0 : h.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = h === null || h === void 0 ? void 0 : h.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), date: (_d = h === null || h === void 0 ? void 0 : h.date) !== null && _d !== void 0 ? _d : new Date().getTime(), responsible: (_e = h === null || h === void 0 ? void 0 : h.responsible) !== null && _e !== void 0 ? _e : (this.autofillAuthor ? dataOwnerId : undefined), author: (_f = h === null || h === void 0 ? void 0 : h.author) !== null && _f !== void 0 ? _f : (this.autofillAuthor ? user.id : undefined), codes: (_g = h === null || h === void 0 ? void 0 : h.codes) !== null && _g !== void 0 ? _g : [], tags: (_h = h === null || h === void 0 ? void 0 : h.tags) !== null && _h !== void 0 ? _h : [], user: (_j = h === null || h === void 0 ? void 0 : h.user) !== null && _j !== void 0 ? _j : user.id, accessType: (_k = h === null || h === void 0 ? void 0 : h.accessType) !== null && _k !== void 0 ? _k : 'USER_LOGIN' });
|
|
85
85
|
const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
@@ -109,8 +109,8 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
109
109
|
* @param patient (Promise)
|
|
110
110
|
* @param usingPost
|
|
111
111
|
*/
|
|
112
|
-
findBy(
|
|
113
|
-
return __awaiter(this,
|
|
112
|
+
findBy(hcpartyId_1, patient_1) {
|
|
113
|
+
return __awaiter(this, arguments, void 0, function* (hcpartyId, patient, usingPost = false) {
|
|
114
114
|
const extractedKeys = yield this.crypto.xapi.secretIdsOf({ entity: patient, type: utils_1.EntityWithDelegationTypeName.Patient }, hcpartyId);
|
|
115
115
|
const topmostParentId = (yield this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0];
|
|
116
116
|
return extractedKeys && extractedKeys.length > 0
|
|
@@ -260,8 +260,8 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
260
260
|
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
261
261
|
* @return the updated entity
|
|
262
262
|
*/
|
|
263
|
-
shareWith(
|
|
264
|
-
return __awaiter(this,
|
|
263
|
+
shareWith(delegateId_1, accessLog_1) {
|
|
264
|
+
return __awaiter(this, arguments, void 0, function* (delegateId, accessLog, options = {}) {
|
|
265
265
|
return this.shareWithMany(accessLog, { [delegateId]: options });
|
|
266
266
|
});
|
|
267
267
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-accesslog-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-accesslog-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA4C;AAG5C,oDAAsF;AACtF,4BAA2B;AAE3B,0EAAgG;AAChG,wEAAoE;AAKpE,mCAAqG;AAErG,kEAA8D;AAC9D,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAGzD,MAAa,gBAAiB,SAAQ,yBAAe;IAKnD,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,SAAS,CAAC,CAAC,CAAA;IAC/I,CAAC;IAED,YACE,IAAY,EACZ,OAAkC,EAClC,MAAqB,EACr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EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACvF,CAAC;KAAA;IAED,yBAAyB,CACvB,MAAiB;QAEjB,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,yBAAyB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,SAAS,EAAE,CAAC,CAAA;IACnI,CAAC;IAED,mBAAmB,CAAC,MAAiB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,SAAS,EAAE,EAAE,SAAS,CAAC,CAAA;IAC/G,CAAC;IAED,uCAAuC,CAAC,MAAiB,EAAE,SAAmB;QAC5E,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,iCAAiC,CAC7E,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,SAAS,EAAE,EACxD,SAAS,CACV,CAAA;IACH,CAAC;CACF;AAtdD,4CAsdC","sourcesContent":["import { IccAccesslogApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport * as models from '../icc-api/model/models'\nimport { AccessLog, ListOfIds, PaginatedListAccessLog } from '../icc-api/model/models'\nimport * as _ from 'lodash'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport { ShareResult } from './utils/ShareResult'\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedFieldsManifest, EntityWithDelegationTypeName, parseEncryptedFields } from './utils'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\n\nexport class IccAccesslogXApi extends IccAccesslogApi implements EncryptedEntityXApi<models.AccessLog> {\n private readonly encryptedFields: EncryptedFieldsManifest\n crypto: IccCryptoXApi\n dataOwnerApi: IccDataOwnerXApi\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.AccessLog))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\n private readonly autofillAuthor: boolean,\n cryptedKeys = ['detail', 'objectId'],\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.dataOwnerApi = dataOwnerApi\n this.encryptedFields = parseEncryptedFields(cryptedKeys, 'AccessLog.')\n }\n\n /**\n * Creates a new instance of access log with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this access log refers to.\n * @param h initialised data for the access log. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with\n * auto-delegations, in such case the access level specified here will be used.\n * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the access log. The default value will be a\n * secret id of patient known by the topmost parent in the current data owner hierarchy.\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 access log.\n */\n async newInstance(\n user: models.User,\n patient: models.Patient,\n h: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n alternateRootDelegation?: string\n } = {}\n ) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n const accessLog = {\n ...(h ?? {}),\n _type: 'org.taktik.icure.entities.AccessLog',\n id: h?.id ?? this.crypto.primitives.randomUuid(),\n created: h?.created ?? new Date().getTime(),\n modified: h?.modified ?? new Date().getTime(),\n date: h?.date ?? new Date().getTime(),\n responsible: h?.responsible ?? (this.autofillAuthor ? dataOwnerId : undefined),\n author: h?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: h?.codes ?? [],\n tags: h?.tags ?? [],\n user: h?.user ?? user.id,\n accessType: h?.accessType ?? 'USER_ACCESS',\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 ...Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.administrativeData ?? [])].map((x) => [x, AccessLevelEnum.WRITE])\n ),\n ...(options.additionalDelegates ?? {}),\n }\n return new AccessLog(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(\n accessLog,\n EntityWithDelegationTypeName.AccessLog,\n patient.id,\n sfk,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n .then((x) => x.updatedEntity)\n )\n }\n\n /**\n * Creates a new instance of access log with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param h initialised data for the access log. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with\n * auto-delegations, in such case the access level specified here will be used.\n * - 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 access log.\n */\n async newInstanceNoPatient(\n user: models.User,\n h: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n alternateRootDelegation?: string\n } = {}\n ) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n const accessLog = {\n ...(h ?? {}),\n _type: 'org.taktik.icure.entities.AccessLog',\n id: h?.id ?? this.crypto.primitives.randomUuid(),\n created: h?.created ?? new Date().getTime(),\n modified: h?.modified ?? new Date().getTime(),\n date: h?.date ?? new Date().getTime(),\n responsible: h?.responsible ?? (this.autofillAuthor ? dataOwnerId : undefined),\n author: h?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: h?.codes ?? [],\n tags: h?.tags ?? [],\n user: h?.user ?? user.id,\n accessType: h?.accessType ?? 'USER_LOGIN',\n }\n\n const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (ownerId !== (await this.dataOwnerApi.getCurrentDataOwnerId())) throw new Error('Can only initialise entities as current data owner.')\n const extraDelegations = {\n ...Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.administrativeData ?? [])].map((x) => [x, AccessLevelEnum.WRITE])\n ),\n ...(options.additionalDelegates ?? {}),\n }\n return new AccessLog(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(\n accessLog,\n EntityWithDelegationTypeName.AccessLog,\n undefined,\n undefined,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n .then((x) => x.updatedEntity)\n )\n }\n\n // noinspection JSUnusedGlobalSymbols\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 access logs with (allSecretForeignKeysDelimitedByComma, hcpartyId)\n *\n * After these painful steps, you have the access logs 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): Promise<models.AccessLog[]> {\n const extractedKeys = await this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }, hcpartyId)\n const topmostParentId = (await this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0]\n return extractedKeys && extractedKeys.length > 0\n ? usingPost\n ? this.findByHCPartyPatientSecretFKeysArray(hcpartyId!, _.uniq(extractedKeys))\n : this.findByHCPartyPatientSecretFKeys(hcpartyId!, _.uniq(extractedKeys).join(','))\n : Promise.resolve([])\n }\n\n /**\n * Same as `findBy` but it will only return the ids of the access logs. It can also filter the access logs where AccessLog.date 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): Promise<string[]> {\n const extractedKeys = await this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }, hcpartyId)\n return extractedKeys && extractedKeys.length > 0\n ? this.findAccessLogIdsByDataOwnerPatientDate(hcpartyId, _.uniq(extractedKeys), startDate, endDate, descending)\n : Promise.resolve([])\n }\n\n /**\n * @deprecated use {@link findAccessLogIdsByDataOwnerPatientDate} instead\n */\n async findByHCPartyPatientSecretFKeys(hcPartyId: string, secretFKeys: string): Promise<AccessLog[]> {\n const accessLogs = await super.findAccessLogsByHCPartyPatientForeignKeys(hcPartyId, secretFKeys)\n return await this.decrypt(hcPartyId, accessLogs)\n }\n\n /**\n * @deprecated use {@link findAccessLogIdsByDataOwnerPatientDate} instead\n */\n findByHCPartyPatientSecretFKeysArray(hcPartyId: string, secretFKeys: string[]): Promise<Array<AccessLog> | any> {\n return super.findAccessLogsByHCPartyPatientForeignKeysUsingPost(hcPartyId, secretFKeys).then((accesslogs) => this.decrypt(hcPartyId, accesslogs))\n }\n\n async decrypt(hcpId: string, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n return (await this.crypto.xapi.tryDecryptEntities(accessLogs, EntityWithDelegationTypeName.AccessLog, (json) => new AccessLog(json))).map(\n ({ entity }) => entity\n )\n }\n\n encrypt(user: models.User, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n const owner = this.dataOwnerApi.getDataOwnerIdOf(user)\n return this.encryptAs(owner, accessLogs)\n }\n\n private async encryptAs(dataOwner: string, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n return this.crypto.xapi.tryEncryptEntities(\n accessLogs,\n EntityWithDelegationTypeName.AccessLog,\n this.encryptedFields,\n false,\n false,\n (json) => new AccessLog(json)\n )\n }\n\n createAccessLog(body?: models.AccessLog): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n createAccessLogWithUser(user: models.User, body?: models.AccessLog): Promise<models.AccessLog | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((als) => super.createAccessLog(als[0]))\n .then((accessLog) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [accessLog]))\n .then((als) => als[0])\n : Promise.resolve()\n }\n\n getAccessLog(accessLogId: string): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n getAccessLogWithUser(user: models.User, accessLogId: string): Promise<models.AccessLog | any> {\n return super\n .getAccessLog(accessLogId)\n .then((accessLog) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [accessLog]))\n .then((als) => als[0])\n }\n\n async getAccessLogs(ids: ListOfIds): Promise<AccessLog[]> {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n getAccessLogsWithUser(user: models.User, ids: ListOfIds): Promise<AccessLog[]> {\n return super.getAccessLogs(ids).then((accessLogs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLogs))\n }\n\n listAccessLogs(fromEpoch?: number, toEpoch?: number, startKey?: number, startDocumentId?: string, limit?: number): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n listAccessLogsWithUser(\n user: models.User,\n fromEpoch?: number,\n toEpoch?: number,\n startKey?: number,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): Promise<PaginatedListAccessLog> {\n return super\n .listAccessLogs(fromEpoch, toEpoch, startKey, startDocumentId, limit, descending)\n .then((accessLog) =>\n this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLog.rows!).then((dr) => Object.assign(accessLog, { rows: dr }))\n )\n }\n\n modifyAccessLog(body?: models.AccessLog): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n async modifyAccessLogWithUser(user: models.User, body?: models.AccessLog): Promise<models.AccessLog | null> {\n return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, _.cloneDeep(body)) : null\n }\n\n private async modifyAs(owner: string, body: models.AccessLog): Promise<models.AccessLog> {\n return this.encryptAs(owner, [_.cloneDeep(body)])\n .then((als) => super.modifyAccessLog(als[0]))\n .then((accessLog) => this.decrypt(owner, [accessLog]))\n .then((als) => als[0])\n }\n\n findByUserAfterDate(\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n findByUserAfterDateWithUser(\n user: models.User,\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): Promise<models.AccessLog | any> {\n return super\n .findByUserAfterDate(userId, accessType, startDate, startKey, startDocumentId, limit, descending)\n .then((accessLog) =>\n this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLog.rows!).then((dr) => Object.assign(accessLog, { rows: dr }))\n )\n }\n\n /**\n * @param accessLog an access log\n * @return the id of the patient that the access log refers to, retrieved from the encrypted metadata (not from the decrypted entity body). Normally\n * there should only be one element in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(accessLog: AccessLog): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: accessLog, type: EntityWithDelegationTypeName.AccessLog }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given access log\n */\n async hasWriteAccess(accessLog: AccessLog): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: accessLog, type: EntityWithDelegationTypeName.AccessLog })\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * 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 access log.\n * @param accessLog the access log 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}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@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 accessLog: AccessLog,\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<AccessLog> {\n return this.shareWithMany(accessLog, { [delegateId]: options })\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param accessLog the access log 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}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@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 accessLog: AccessLog,\n delegates: {\n [delegateId: string]: {\n shareSecretId?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<AccessLog> {\n return (await this.tryShareWithMany(accessLog, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param accessLog the access log 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}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@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 accessLog: AccessLog,\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<AccessLog>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(accessLog, EntityWithDelegationTypeName.AccessLog)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyAs(self, entityWithEncryptionKey) : accessLog\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.AccessLog,\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.bulkShareAccessLogs(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: AccessLog\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.AccessLog })\n }\n\n getEncryptionKeysOf(entity: AccessLog): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.AccessLog }, undefined)\n }\n\n createDelegationDeAnonymizationMetadata(entity: AccessLog, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo(\n { entity, type: EntityWithDelegationTypeName.AccessLog },\n delegates\n )\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"icc-accesslog-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-accesslog-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA4C;AAG5C,oDAAsF;AACtF,4BAA2B;AAE3B,0EAAgG;AAChG,wEAAoE;AAKpE,mCAAqG;AAErG,kEAA8D;AAC9D,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAGzD,MAAa,gBAAiB,SAAQ,yBAAe;IAKnD,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,SAAS,CAAC,CAAC,CAAA;IAC/I,CAAC;IAED,YACE,IAAY,EACZ,OAAkC,EAClC,MAAqB,EACrB,YAA8B,EACb,cAAuB,EACxC,WAAW,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,EACpC,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KA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,yBAAyB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,SAAS,EAAE,CAAC,CAAA;IACnI,CAAC;IAED,mBAAmB,CAAC,MAAiB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,SAAS,EAAE,EAAE,SAAS,CAAC,CAAA;IAC/G,CAAC;IAED,uCAAuC,CAAC,MAAiB,EAAE,SAAmB;QAC5E,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,iCAAiC,CAC7E,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,SAAS,EAAE,EACxD,SAAS,CACV,CAAA;IACH,CAAC;CACF;AAtdD,4CAsdC","sourcesContent":["import { IccAccesslogApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport * as models from '../icc-api/model/models'\nimport { AccessLog, ListOfIds, PaginatedListAccessLog } from '../icc-api/model/models'\nimport * as _ from 'lodash'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport { ShareResult } from './utils/ShareResult'\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedFieldsManifest, EntityWithDelegationTypeName, parseEncryptedFields } from './utils'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\n\nexport class IccAccesslogXApi extends IccAccesslogApi implements EncryptedEntityXApi<models.AccessLog> {\n private readonly encryptedFields: EncryptedFieldsManifest\n crypto: IccCryptoXApi\n dataOwnerApi: IccDataOwnerXApi\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.AccessLog))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\n private readonly autofillAuthor: boolean,\n cryptedKeys = ['detail', 'objectId'],\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.dataOwnerApi = dataOwnerApi\n this.encryptedFields = parseEncryptedFields(cryptedKeys, 'AccessLog.')\n }\n\n /**\n * Creates a new instance of access log with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this access log refers to.\n * @param h initialised data for the access log. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with\n * auto-delegations, in such case the access level specified here will be used.\n * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the access log. The default value will be a\n * secret id of patient known by the topmost parent in the current data owner hierarchy.\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 access log.\n */\n async newInstance(\n user: models.User,\n patient: models.Patient,\n h: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n alternateRootDelegation?: string\n } = {}\n ) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n const accessLog = {\n ...(h ?? {}),\n _type: 'org.taktik.icure.entities.AccessLog',\n id: h?.id ?? this.crypto.primitives.randomUuid(),\n created: h?.created ?? new Date().getTime(),\n modified: h?.modified ?? new Date().getTime(),\n date: h?.date ?? new Date().getTime(),\n responsible: h?.responsible ?? (this.autofillAuthor ? dataOwnerId : undefined),\n author: h?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: h?.codes ?? [],\n tags: h?.tags ?? [],\n user: h?.user ?? user.id,\n accessType: h?.accessType ?? 'USER_ACCESS',\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 ...Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.administrativeData ?? [])].map((x) => [x, AccessLevelEnum.WRITE])\n ),\n ...(options.additionalDelegates ?? {}),\n }\n return new AccessLog(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(\n accessLog,\n EntityWithDelegationTypeName.AccessLog,\n patient.id,\n sfk,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n .then((x) => x.updatedEntity)\n )\n }\n\n /**\n * Creates a new instance of access log with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param h initialised data for the access log. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with\n * auto-delegations, in such case the access level specified here will be used.\n * - 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 access log.\n */\n async newInstanceNoPatient(\n user: models.User,\n h: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n alternateRootDelegation?: string\n } = {}\n ) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n const accessLog = {\n ...(h ?? {}),\n _type: 'org.taktik.icure.entities.AccessLog',\n id: h?.id ?? this.crypto.primitives.randomUuid(),\n created: h?.created ?? new Date().getTime(),\n modified: h?.modified ?? new Date().getTime(),\n date: h?.date ?? new Date().getTime(),\n responsible: h?.responsible ?? (this.autofillAuthor ? dataOwnerId : undefined),\n author: h?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: h?.codes ?? [],\n tags: h?.tags ?? [],\n user: h?.user ?? user.id,\n accessType: h?.accessType ?? 'USER_LOGIN',\n }\n\n const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (ownerId !== (await this.dataOwnerApi.getCurrentDataOwnerId())) throw new Error('Can only initialise entities as current data owner.')\n const extraDelegations = {\n ...Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.administrativeData ?? [])].map((x) => [x, AccessLevelEnum.WRITE])\n ),\n ...(options.additionalDelegates ?? {}),\n }\n return new AccessLog(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(\n accessLog,\n EntityWithDelegationTypeName.AccessLog,\n undefined,\n undefined,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n .then((x) => x.updatedEntity)\n )\n }\n\n // noinspection JSUnusedGlobalSymbols\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 access logs with (allSecretForeignKeysDelimitedByComma, hcpartyId)\n *\n * After these painful steps, you have the access logs 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): Promise<models.AccessLog[]> {\n const extractedKeys = await this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }, hcpartyId)\n const topmostParentId = (await this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0]\n return extractedKeys && extractedKeys.length > 0\n ? usingPost\n ? this.findByHCPartyPatientSecretFKeysArray(hcpartyId!, _.uniq(extractedKeys))\n : this.findByHCPartyPatientSecretFKeys(hcpartyId!, _.uniq(extractedKeys).join(','))\n : Promise.resolve([])\n }\n\n /**\n * Same as `findBy` but it will only return the ids of the access logs. It can also filter the access logs where AccessLog.date 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): Promise<string[]> {\n const extractedKeys = await this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }, hcpartyId)\n return extractedKeys && extractedKeys.length > 0\n ? this.findAccessLogIdsByDataOwnerPatientDate(hcpartyId, _.uniq(extractedKeys), startDate, endDate, descending)\n : Promise.resolve([])\n }\n\n /**\n * @deprecated use {@link findAccessLogIdsByDataOwnerPatientDate} instead\n */\n async findByHCPartyPatientSecretFKeys(hcPartyId: string, secretFKeys: string): Promise<AccessLog[]> {\n const accessLogs = await super.findAccessLogsByHCPartyPatientForeignKeys(hcPartyId, secretFKeys)\n return await this.decrypt(hcPartyId, accessLogs)\n }\n\n /**\n * @deprecated use {@link findAccessLogIdsByDataOwnerPatientDate} instead\n */\n findByHCPartyPatientSecretFKeysArray(hcPartyId: string, secretFKeys: string[]): Promise<Array<AccessLog> | any> {\n return super.findAccessLogsByHCPartyPatientForeignKeysUsingPost(hcPartyId, secretFKeys).then((accesslogs) => this.decrypt(hcPartyId, accesslogs))\n }\n\n async decrypt(hcpId: string, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n return (await this.crypto.xapi.tryDecryptEntities(accessLogs, EntityWithDelegationTypeName.AccessLog, (json) => new AccessLog(json))).map(\n ({ entity }) => entity\n )\n }\n\n encrypt(user: models.User, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n const owner = this.dataOwnerApi.getDataOwnerIdOf(user)\n return this.encryptAs(owner, accessLogs)\n }\n\n private async encryptAs(dataOwner: string, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n return this.crypto.xapi.tryEncryptEntities(\n accessLogs,\n EntityWithDelegationTypeName.AccessLog,\n this.encryptedFields,\n false,\n false,\n (json) => new AccessLog(json)\n )\n }\n\n createAccessLog(body?: models.AccessLog): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n createAccessLogWithUser(user: models.User, body?: models.AccessLog): Promise<models.AccessLog | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((als) => super.createAccessLog(als[0]))\n .then((accessLog) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [accessLog]))\n .then((als) => als[0])\n : Promise.resolve()\n }\n\n getAccessLog(accessLogId: string): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n getAccessLogWithUser(user: models.User, accessLogId: string): Promise<models.AccessLog | any> {\n return super\n .getAccessLog(accessLogId)\n .then((accessLog) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [accessLog]))\n .then((als) => als[0])\n }\n\n async getAccessLogs(ids: ListOfIds): Promise<AccessLog[]> {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n getAccessLogsWithUser(user: models.User, ids: ListOfIds): Promise<AccessLog[]> {\n return super.getAccessLogs(ids).then((accessLogs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLogs))\n }\n\n listAccessLogs(fromEpoch?: number, toEpoch?: number, startKey?: number, startDocumentId?: string, limit?: number): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n listAccessLogsWithUser(\n user: models.User,\n fromEpoch?: number,\n toEpoch?: number,\n startKey?: number,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): Promise<PaginatedListAccessLog> {\n return super\n .listAccessLogs(fromEpoch, toEpoch, startKey, startDocumentId, limit, descending)\n .then((accessLog) =>\n this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLog.rows!).then((dr) => Object.assign(accessLog, { rows: dr }))\n )\n }\n\n modifyAccessLog(body?: models.AccessLog): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n async modifyAccessLogWithUser(user: models.User, body?: models.AccessLog): Promise<models.AccessLog | null> {\n return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, _.cloneDeep(body)) : null\n }\n\n private async modifyAs(owner: string, body: models.AccessLog): Promise<models.AccessLog> {\n return this.encryptAs(owner, [_.cloneDeep(body)])\n .then((als) => super.modifyAccessLog(als[0]))\n .then((accessLog) => this.decrypt(owner, [accessLog]))\n .then((als) => als[0])\n }\n\n findByUserAfterDate(\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n findByUserAfterDateWithUser(\n user: models.User,\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): Promise<models.AccessLog | any> {\n return super\n .findByUserAfterDate(userId, accessType, startDate, startKey, startDocumentId, limit, descending)\n .then((accessLog) =>\n this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLog.rows!).then((dr) => Object.assign(accessLog, { rows: dr }))\n )\n }\n\n /**\n * @param accessLog an access log\n * @return the id of the patient that the access log refers to, retrieved from the encrypted metadata (not from the decrypted entity body). Normally\n * there should only be one element in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(accessLog: AccessLog): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: accessLog, type: EntityWithDelegationTypeName.AccessLog }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given access log\n */\n async hasWriteAccess(accessLog: AccessLog): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: accessLog, type: EntityWithDelegationTypeName.AccessLog })\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * 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 access log.\n * @param accessLog the access log 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}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@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 accessLog: AccessLog,\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<AccessLog> {\n return this.shareWithMany(accessLog, { [delegateId]: options })\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param accessLog the access log 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}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@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 accessLog: AccessLog,\n delegates: {\n [delegateId: string]: {\n shareSecretId?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<AccessLog> {\n return (await this.tryShareWithMany(accessLog, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param accessLog the access log 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}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@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 accessLog: AccessLog,\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<AccessLog>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(accessLog, EntityWithDelegationTypeName.AccessLog)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyAs(self, entityWithEncryptionKey) : accessLog\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.AccessLog,\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.bulkShareAccessLogs(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: AccessLog\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.AccessLog })\n }\n\n getEncryptionKeysOf(entity: AccessLog): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.AccessLog }, undefined)\n }\n\n createDelegationDeAnonymizationMetadata(entity: AccessLog, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo(\n { entity, type: EntityWithDelegationTypeName.AccessLog },\n delegates\n )\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-bekmehr-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-bekmehr-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,wCAA0C;AAI1C,uDAA0D;AAC1D,oDAAmF;AACnF,0EAAgG;AAoBhG,MAAa,cAAe,SAAQ,uBAAa;IAM/C,YACE,IAAY,EACZ,OAAkC,EAClC,MAAsB,EACtB,WAA4B,EAC5B,WAA4B,EAC5B,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,KAAK;QAET,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAA;QACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAE9B,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,S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CAAC,CAAC,CAAA;QACpH,CAAC,CAAC,CACL,CAAA;IACH,CAAC;IAED,6CAA6C,CAC3C,SAAiB,EACjB,iBAAyB,EACzB,QAAgB,EAChB,aAAqB,EACrB,OAAe,EACf,IAAuC,EACvC,WAAsB,EAAE;QAExB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACvB,CAAC,GAAG,EAAE,EAAE,CACN,IAAI,OAAO,CAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAChD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,GAAG,IAAI,CAAC,OAAO,0CAA0C,GAAG,EAAE,CAAC,CAAA;YAC5F,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE;gBAC9B,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,SAAS,CAAC;oBACb,UAAU,EAAE;wBACV,SAAS,EAAE,SAAS;wBACpB,QAAQ,EAAE,QAAQ;wBAClB,aAAa,EAAE,aAAa;wBAC5B,OAAO,EAAE,OAAO;wBAChB,IAAI,EAAE,IAAI;qBACX;iBACF,CAAC,CACH,CAAA;YACH,CAAC,CAAC,CAAA;YACF,sBAAsB;YACtB,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;QACpH,CAAC,CAAC,CACL,CAAA;IACH,CAAC;CACF;AApRD,wCAoRC","sourcesContent":["import * as models from '../icc-api/model/models'\nimport { IccBekmehrApi } from '../icc-api'\nimport { IccContactXApi } from './icc-contact-x-api'\nimport { IccDocumentXApi } from './icc-document-x-api'\nimport { IccHelementXApi } from './icc-helement-x-api'\nimport { ua2string, utf8_2ua } from './utils/binary-utils'\nimport { Contact, Document, HealthElement, Service } from '../icc-api/model/models'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\n\nexport type Patcher = ContactPatcher | HealthElementPatcher | DocumentPatcher | ServicePatcher\nexport interface ContactPatcher {\n type: 'ContactDto'\n patch: (contacts: Contact[]) => Promise<Contact[]>\n}\nexport interface HealthElementPatcher {\n type: 'HealthElementDto'\n patch: (patients: HealthElement[]) => Promise<HealthElement[]>\n}\nexport interface DocumentPatcher {\n type: 'DocumentDto'\n patch: (documents: Document[]) => Promise<Document[]>\n}\nexport interface ServicePatcher {\n type: 'ServiceDto'\n patch: (documents: Service[]) => Promise<Service[]>\n}\n\nexport class IccBekmehrXApi extends IccBekmehrApi {\n private readonly ctcApi: IccContactXApi\n private readonly helementApi: IccHelementXApi\n private readonly documentApi: IccDocumentXApi\n private readonly wssHost: string\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n ctcApi: IccContactXApi,\n helementApi: IccHelementXApi,\n documentApi: IccDocumentXApi,\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.ctcApi = ctcApi\n this.helementApi = helementApi\n this.documentApi = documentApi\n\n this.wssHost = new URL(this.host, typeof window !== 'undefined' ? window.location.href : undefined).href\n .replace(/^http/, 'ws')\n .replace(/\\/rest\\/v.+/, '/ws')\n }\n\n private async getJwt(): Promise<string> {\n const authService = this.authenticationProvider.getAuthService()\n if (!!authService.jwtGetter) {\n const tokens = await authService.jwtGetter()\n if (!tokens) {\n throw new Error('Missing JWT')\n }\n return tokens.token\n } else {\n throw new Error('The existing provider is not a JWT provider')\n }\n }\n\n socketEventListener(\n socket: WebSocket,\n healthcarePartyId: string,\n resolve: (value: Blob) => void,\n reject: (reason?: any) => void,\n patchers: Patcher[],\n progressCallback?: (progress: number) => void\n ) {\n const that = this\n\n const send = (command: string, uuid: string, body: any) => {\n const data = JSON.stringify({ command, uuid, body })\n socket.send(data.length > 65000 ? utf8_2ua(data).buffer : data)\n }\n\n const messageHandler = (msg: any, event: any) => {\n if (msg.command === 'decrypt') {\n if (msg.type === 'ContactDto') {\n that.ctcApi\n .decrypt(healthcarePartyId, msg.body)\n .then((res) =>\n patchers\n .filter((p) => p.type === 'ContactDto')\n .reduce(async (p, patcher) => (patcher as ContactPatcher).patch(await p), Promise.resolve(res))\n )\n .then((res) => send('decryptResponse', msg.uuid, res))\n } else if (msg.type === 'HealthElementDto') {\n that.helementApi\n .decrypt(healthcarePartyId, msg.body)\n .then((res) =>\n patchers\n .filter((p) => p.type === 'HealthElementDto')\n .reduce(async (p, patcher) => (patcher as HealthElementPatcher).patch(await p), Promise.resolve(res))\n )\n .then((res) => send('decryptResponse', msg.uuid, res))\n } else if (msg.type === 'DocumentDto') {\n that.documentApi\n .decrypt(\n healthcarePartyId,\n msg.body.map((d: JSON) => new Document(d))\n )\n .then((res) =>\n patchers\n .filter((p) => p.type === 'DocumentDto')\n .reduce(async (p, patcher) => (patcher as DocumentPatcher).patch(await p), Promise.resolve(res))\n )\n .then((res) =>\n send(\n 'decryptResponse',\n msg.uuid,\n res?.map((d) => {\n const de = d.decryptedAttachment\n const { encryptedAttachment, ...stripped } = d\n return de ? { ...stripped, decryptedAttachment: btoa(ua2string(de)) } : stripped\n })\n )\n )\n } else if (msg.type === 'ServiceDto') {\n that.ctcApi\n .decryptServices(healthcarePartyId, msg.body)\n .then((res) =>\n patchers\n .filter((p) => p.type === 'ServiceDto')\n .reduce(async (p, patcher) => (patcher as ServicePatcher).patch(await p), Promise.resolve(res))\n )\n .then((res) => send('decryptResponse', msg.uuid, res))\n }\n } else if (msg.command === 'progress') {\n if (progressCallback && msg.body && msg.body[0]) {\n progressCallback(msg.body[0].progress)\n }\n } else {\n console.error('error received from backend:' + event.data)\n reject('websocket error: ' + event.data)\n socket.close(4000, 'backend error')\n }\n }\n\n return (event: MessageEvent) => {\n if (typeof event.data === 'string') {\n const msg = JSON.parse(event.data)\n messageHandler(msg, event)\n } else {\n const blob: Blob = event.data\n const subBlob = blob.slice(0, 1)\n const br = new FileReader()\n br.onload = function (e) {\n const firstChar = e.target && new Uint8Array((e.target as any).result as ArrayBuffer)[0]\n\n if (firstChar === 0x7b) {\n const tr = new FileReader()\n tr.onload = function (e) {\n const msg = e.target && JSON.parse((e.target as any).result as string)\n messageHandler(msg, event)\n }\n tr.readAsBinaryString(blob)\n } else {\n resolve(blob)\n socket.close(1000, 'Ok')\n }\n }\n br.readAsArrayBuffer(subBlob)\n }\n }\n }\n\n generateSmfExportWithEncryptionSupport(\n patientId: string,\n healthcarePartyId: string,\n language: string,\n body: models.SoftwareMedicalFileExport,\n progressCallback?: (progress: number) => void,\n patchers: Patcher[] = []\n ): Promise<Blob | undefined> {\n return this.getJwt().then(\n (jwt) =>\n new Promise<Blob | undefined>((resolve, reject) => {\n const socket = new WebSocket(`${this.wssHost}/be_kmehr/generateSmf?jwt=${jwt}`)\n socket.addEventListener('open', function () {\n socket.send(\n JSON.stringify({\n parameters: { patientId: patientId, language: language, info: body },\n })\n )\n })\n // Listen for messages\n socket.addEventListener('message', this.socketEventListener(socket, healthcarePartyId, resolve, reject, patchers, progressCallback))\n })\n )\n }\n\n generateSumehrExportWithEncryptionSupport(\n patientId: string,\n healthcarePartyId: string,\n language: string,\n body: models.SumehrExportInfo,\n patchers: Patcher[] = []\n ): Promise<Blob | undefined> {\n return this.getJwt().then(\n (jwt) =>\n new Promise<Blob | undefined>((resolve, reject) => {\n const socket = new WebSocket(`${this.wssHost}/be_kmehr/generateSumehr?jwt=${jwt}`)\n socket.addEventListener('open', function () {\n socket.send(\n JSON.stringify({\n parameters: { patientId: patientId, language: language, info: body },\n })\n )\n })\n // Listen for messages\n socket.addEventListener('message', this.socketEventListener(socket, healthcarePartyId, resolve, reject, patchers))\n })\n )\n }\n\n generateSumehrV2ExportWithEncryptionSupport(\n patientId: string,\n healthcarePartyId: string,\n language: string,\n body: models.SumehrExportInfo,\n patchers: Patcher[] = []\n ): Promise<Blob | undefined> {\n return this.getJwt().then(\n (jwt) =>\n new Promise<Blob | undefined>((resolve, reject) => {\n const socket = new WebSocket(`${this.wssHost}/be_kmehr/generateSumehrV2?jwt=${jwt}`)\n socket.addEventListener('open', function () {\n socket.send(\n JSON.stringify({\n parameters: { patientId: patientId, language: language, info: body },\n })\n )\n })\n // Listen for messages\n socket.addEventListener('message', this.socketEventListener(socket, healthcarePartyId, resolve, reject, patchers))\n })\n )\n }\n\n generateDiaryNoteExportWithEncryptionSupport(\n patientId: string,\n healthcarePartyId: string,\n language: string,\n body: models.SumehrExportInfo,\n patchers: Patcher[] = []\n ): Promise<Blob | undefined> {\n return this.getJwt().then(\n (jwt) =>\n new Promise<Blob | undefined>((resolve, reject) => {\n const socket = new WebSocket(`${this.wssHost}/be_kmehr/generateDiaryNote?jwt=${jwt}`)\n socket.addEventListener('open', function () {\n socket.send(\n JSON.stringify({\n parameters: { patientId: patientId, language: language, info: body },\n })\n )\n })\n // Listen for messages\n socket.addEventListener('message', this.socketEventListener(socket, healthcarePartyId, resolve, reject, patchers))\n })\n )\n }\n\n generateMedicationSchemeWithEncryptionSupport(\n patientId: string,\n healthcarePartyId: string,\n language: string,\n recipientSafe: string,\n version: number,\n body: models.MedicationSchemeExportInfo,\n patchers: Patcher[] = []\n ): Promise<Blob | undefined> {\n return this.getJwt().then(\n (jwt) =>\n new Promise<Blob | undefined>((resolve, reject) => {\n const socket = new WebSocket(`${this.wssHost}/be_kmehr/generateMedicationScheme?jwt=${jwt}`)\n socket.addEventListener('open', function () {\n socket.send(\n JSON.stringify({\n parameters: {\n patientId: patientId,\n language: language,\n recipientSafe: recipientSafe,\n version: version,\n info: body,\n },\n })\n )\n })\n // Listen for messages\n socket.addEventListener('message', this.socketEventListener(socket, healthcarePartyId, resolve, reject, patchers))\n })\n )\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"icc-bekmehr-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-bekmehr-x-api.ts"],"names":[],"mappings":";;;;;;;;;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E,MAAM,EAAE,EAAE;YAChD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,GAAG,IAAI,CAAC,OAAO,0CAA0C,GAAG,EAAE,CAAC,CAAA;YAC5F,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE;gBAC9B,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,SAAS,CAAC;oBACb,UAAU,EAAE;wBACV,SAAS,EAAE,SAAS;wBACpB,QAAQ,EAAE,QAAQ;wBAClB,aAAa,EAAE,aAAa;wBAC5B,OAAO,EAAE,OAAO;wBAChB,IAAI,EAAE,IAAI;qBACX;iBACF,CAAC,CACH,CAAA;YACH,CAAC,CAAC,CAAA;YACF,sBAAsB;YACtB,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;QACpH,CAAC,CAAC,CACL,CAAA;IACH,CAAC;CACF;AApRD,wCAoRC","sourcesContent":["import * as models from '../icc-api/model/models'\nimport { IccBekmehrApi } from '../icc-api'\nimport { IccContactXApi } from './icc-contact-x-api'\nimport { IccDocumentXApi } from './icc-document-x-api'\nimport { IccHelementXApi } from './icc-helement-x-api'\nimport { ua2string, utf8_2ua } from './utils/binary-utils'\nimport { Contact, Document, HealthElement, Service } from '../icc-api/model/models'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\n\nexport type Patcher = ContactPatcher | HealthElementPatcher | DocumentPatcher | ServicePatcher\nexport interface ContactPatcher {\n type: 'ContactDto'\n patch: (contacts: Contact[]) => Promise<Contact[]>\n}\nexport interface HealthElementPatcher {\n type: 'HealthElementDto'\n patch: (patients: HealthElement[]) => Promise<HealthElement[]>\n}\nexport interface DocumentPatcher {\n type: 'DocumentDto'\n patch: (documents: Document[]) => Promise<Document[]>\n}\nexport interface ServicePatcher {\n type: 'ServiceDto'\n patch: (documents: Service[]) => Promise<Service[]>\n}\n\nexport class IccBekmehrXApi extends IccBekmehrApi {\n private readonly ctcApi: IccContactXApi\n private readonly helementApi: IccHelementXApi\n private readonly documentApi: IccDocumentXApi\n private readonly wssHost: string\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n ctcApi: IccContactXApi,\n helementApi: IccHelementXApi,\n documentApi: IccDocumentXApi,\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.ctcApi = ctcApi\n this.helementApi = helementApi\n this.documentApi = documentApi\n\n this.wssHost = new URL(this.host, typeof window !== 'undefined' ? window.location.href : undefined).href\n .replace(/^http/, 'ws')\n .replace(/\\/rest\\/v.+/, '/ws')\n }\n\n private async getJwt(): Promise<string> {\n const authService = this.authenticationProvider.getAuthService()\n if (!!authService.jwtGetter) {\n const tokens = await authService.jwtGetter()\n if (!tokens) {\n throw new Error('Missing JWT')\n }\n return tokens.token\n } else {\n throw new Error('The existing provider is not a JWT provider')\n }\n }\n\n socketEventListener(\n socket: WebSocket,\n healthcarePartyId: string,\n resolve: (value: Blob) => void,\n reject: (reason?: any) => void,\n patchers: Patcher[],\n progressCallback?: (progress: number) => void\n ) {\n const that = this\n\n const send = (command: string, uuid: string, body: any) => {\n const data = JSON.stringify({ command, uuid, body })\n socket.send(data.length > 65000 ? utf8_2ua(data).buffer : data)\n }\n\n const messageHandler = (msg: any, event: any) => {\n if (msg.command === 'decrypt') {\n if (msg.type === 'ContactDto') {\n that.ctcApi\n .decrypt(healthcarePartyId, msg.body)\n .then((res) =>\n patchers\n .filter((p) => p.type === 'ContactDto')\n .reduce(async (p, patcher) => (patcher as ContactPatcher).patch(await p), Promise.resolve(res))\n )\n .then((res) => send('decryptResponse', msg.uuid, res))\n } else if (msg.type === 'HealthElementDto') {\n that.helementApi\n .decrypt(healthcarePartyId, msg.body)\n .then((res) =>\n patchers\n .filter((p) => p.type === 'HealthElementDto')\n .reduce(async (p, patcher) => (patcher as HealthElementPatcher).patch(await p), Promise.resolve(res))\n )\n .then((res) => send('decryptResponse', msg.uuid, res))\n } else if (msg.type === 'DocumentDto') {\n that.documentApi\n .decrypt(\n healthcarePartyId,\n msg.body.map((d: JSON) => new Document(d))\n )\n .then((res) =>\n patchers\n .filter((p) => p.type === 'DocumentDto')\n .reduce(async (p, patcher) => (patcher as DocumentPatcher).patch(await p), Promise.resolve(res))\n )\n .then((res) =>\n send(\n 'decryptResponse',\n msg.uuid,\n res?.map((d) => {\n const de = d.decryptedAttachment\n const { encryptedAttachment, ...stripped } = d\n return de ? { ...stripped, decryptedAttachment: btoa(ua2string(de)) } : stripped\n })\n )\n )\n } else if (msg.type === 'ServiceDto') {\n that.ctcApi\n .decryptServices(healthcarePartyId, msg.body)\n .then((res) =>\n patchers\n .filter((p) => p.type === 'ServiceDto')\n .reduce(async (p, patcher) => (patcher as ServicePatcher).patch(await p), Promise.resolve(res))\n )\n .then((res) => send('decryptResponse', msg.uuid, res))\n }\n } else if (msg.command === 'progress') {\n if (progressCallback && msg.body && msg.body[0]) {\n progressCallback(msg.body[0].progress)\n }\n } else {\n console.error('error received from backend:' + event.data)\n reject('websocket error: ' + event.data)\n socket.close(4000, 'backend error')\n }\n }\n\n return (event: MessageEvent) => {\n if (typeof event.data === 'string') {\n const msg = JSON.parse(event.data)\n messageHandler(msg, event)\n } else {\n const blob: Blob = event.data\n const subBlob = blob.slice(0, 1)\n const br = new FileReader()\n br.onload = function (e) {\n const firstChar = e.target && new Uint8Array((e.target as any).result as ArrayBuffer)[0]\n\n if (firstChar === 0x7b) {\n const tr = new FileReader()\n tr.onload = function (e) {\n const msg = e.target && JSON.parse((e.target as any).result as string)\n messageHandler(msg, event)\n }\n tr.readAsBinaryString(blob)\n } else {\n resolve(blob)\n socket.close(1000, 'Ok')\n }\n }\n br.readAsArrayBuffer(subBlob)\n }\n }\n }\n\n generateSmfExportWithEncryptionSupport(\n patientId: string,\n healthcarePartyId: string,\n language: string,\n body: models.SoftwareMedicalFileExport,\n progressCallback?: (progress: number) => void,\n patchers: Patcher[] = []\n ): Promise<Blob | undefined> {\n return this.getJwt().then(\n (jwt) =>\n new Promise<Blob | undefined>((resolve, reject) => {\n const socket = new WebSocket(`${this.wssHost}/be_kmehr/generateSmf?jwt=${jwt}`)\n socket.addEventListener('open', function () {\n socket.send(\n JSON.stringify({\n parameters: { patientId: patientId, language: language, info: body },\n })\n )\n })\n // Listen for messages\n socket.addEventListener('message', this.socketEventListener(socket, healthcarePartyId, resolve, reject, patchers, progressCallback))\n })\n )\n }\n\n generateSumehrExportWithEncryptionSupport(\n patientId: string,\n healthcarePartyId: string,\n language: string,\n body: models.SumehrExportInfo,\n patchers: Patcher[] = []\n ): Promise<Blob | undefined> {\n return this.getJwt().then(\n (jwt) =>\n new Promise<Blob | undefined>((resolve, reject) => {\n const socket = new WebSocket(`${this.wssHost}/be_kmehr/generateSumehr?jwt=${jwt}`)\n socket.addEventListener('open', function () {\n socket.send(\n JSON.stringify({\n parameters: { patientId: patientId, language: language, info: body },\n })\n )\n })\n // Listen for messages\n socket.addEventListener('message', this.socketEventListener(socket, healthcarePartyId, resolve, reject, patchers))\n })\n )\n }\n\n generateSumehrV2ExportWithEncryptionSupport(\n patientId: string,\n healthcarePartyId: string,\n language: string,\n body: models.SumehrExportInfo,\n patchers: Patcher[] = []\n ): Promise<Blob | undefined> {\n return this.getJwt().then(\n (jwt) =>\n new Promise<Blob | undefined>((resolve, reject) => {\n const socket = new WebSocket(`${this.wssHost}/be_kmehr/generateSumehrV2?jwt=${jwt}`)\n socket.addEventListener('open', function () {\n socket.send(\n JSON.stringify({\n parameters: { patientId: patientId, language: language, info: body },\n })\n )\n })\n // Listen for messages\n socket.addEventListener('message', this.socketEventListener(socket, healthcarePartyId, resolve, reject, patchers))\n })\n )\n }\n\n generateDiaryNoteExportWithEncryptionSupport(\n patientId: string,\n healthcarePartyId: string,\n language: string,\n body: models.SumehrExportInfo,\n patchers: Patcher[] = []\n ): Promise<Blob | undefined> {\n return this.getJwt().then(\n (jwt) =>\n new Promise<Blob | undefined>((resolve, reject) => {\n const socket = new WebSocket(`${this.wssHost}/be_kmehr/generateDiaryNote?jwt=${jwt}`)\n socket.addEventListener('open', function () {\n socket.send(\n JSON.stringify({\n parameters: { patientId: patientId, language: language, info: body },\n })\n )\n })\n // Listen for messages\n socket.addEventListener('message', this.socketEventListener(socket, healthcarePartyId, resolve, reject, patchers))\n })\n )\n }\n\n generateMedicationSchemeWithEncryptionSupport(\n patientId: string,\n healthcarePartyId: string,\n language: string,\n recipientSafe: string,\n version: number,\n body: models.MedicationSchemeExportInfo,\n patchers: Patcher[] = []\n ): Promise<Blob | undefined> {\n return this.getJwt().then(\n (jwt) =>\n new Promise<Blob | undefined>((resolve, reject) => {\n const socket = new WebSocket(`${this.wssHost}/be_kmehr/generateMedicationScheme?jwt=${jwt}`)\n socket.addEventListener('open', function () {\n socket.send(\n JSON.stringify({\n parameters: {\n patientId: patientId,\n language: language,\n recipientSafe: recipientSafe,\n version: version,\n info: body,\n },\n })\n )\n })\n // Listen for messages\n socket.addEventListener('message', this.socketEventListener(socket, healthcarePartyId, resolve, reject, patchers))\n })\n )\n }\n}\n"]}
|
|
@@ -68,9 +68,9 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
68
68
|
* and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.
|
|
69
69
|
* @return a new instance of calendar item.
|
|
70
70
|
*/
|
|
71
|
-
newInstancePatient(
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
newInstancePatient(user_1, patient_1, ci_1) {
|
|
72
|
+
return __awaiter(this, arguments, void 0, function* (user, patient, ci, options = {}) {
|
|
73
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
74
74
|
const calendarItem = Object.assign(Object.assign({}, (ci !== null && ci !== void 0 ? ci : {})), { _type: 'org.taktik.icure.entities.CalendarItem', id: (_a = ci === null || ci === void 0 ? void 0 : ci.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = ci === null || ci === void 0 ? void 0 : ci.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = ci === null || ci === void 0 ? void 0 : ci.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), responsible: (_d = ci === null || ci === void 0 ? void 0 : ci.responsible) !== null && _d !== void 0 ? _d : (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined), author: (_e = ci === null || ci === void 0 ? void 0 : ci.author) !== null && _e !== void 0 ? _e : (this.autofillAuthor ? user.id : undefined), codes: (_f = ci === null || ci === void 0 ? void 0 : ci.codes) !== null && _f !== void 0 ? _f : [], tags: (_g = ci === null || ci === void 0 ? void 0 : ci.tags) !== null && _g !== void 0 ? _g : [] });
|
|
75
75
|
const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
76
76
|
if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
|
|
@@ -87,8 +87,8 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
87
87
|
/**
|
|
88
88
|
* @deprecated use {@link findIdsBy} instead.
|
|
89
89
|
*/
|
|
90
|
-
findBy(
|
|
91
|
-
return __awaiter(this,
|
|
90
|
+
findBy(hcpartyId_1, patient_1) {
|
|
91
|
+
return __awaiter(this, arguments, void 0, function* (hcpartyId, patient, usingPost = false) {
|
|
92
92
|
const extractedKeys = yield this.crypto.xapi.secretIdsOf({ entity: patient, type: utils_1.EntityWithDelegationTypeName.Patient }, hcpartyId);
|
|
93
93
|
const topmostParentId = (yield this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0];
|
|
94
94
|
return extractedKeys && extractedKeys.length > 0
|
|
@@ -314,8 +314,8 @@ class IccCalendarItemXApi extends icc_api_1.IccCalendarItemApi {
|
|
|
314
314
|
* @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
|
|
315
315
|
* the operation failed.
|
|
316
316
|
*/
|
|
317
|
-
shareWith(
|
|
318
|
-
return __awaiter(this,
|
|
317
|
+
shareWith(delegateId_1, calendarItem_1) {
|
|
318
|
+
return __awaiter(this, arguments, void 0, function* (delegateId, calendarItem, options = {}) {
|
|
319
319
|
return this.shareWithMany(calendarItem, { [delegateId]: options });
|
|
320
320
|
});
|
|
321
321
|
}
|