@icure/api 7.1.14 → 8.0.0-RC.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/icc-api/api/IccAccesslogApi.d.ts +12 -1
- package/icc-api/api/IccAccesslogApi.js +142 -98
- package/icc-api/api/IccAccesslogApi.js.map +1 -1
- package/icc-api/api/IccBemikronoApi.d.ts +81 -0
- package/icc-api/api/IccBemikronoApi.js +163 -0
- package/icc-api/api/IccBemikronoApi.js.map +1 -0
- package/icc-api/api/IccCalendarItemApi.d.ts +21 -1
- package/icc-api/api/IccCalendarItemApi.js +183 -117
- package/icc-api/api/IccCalendarItemApi.js.map +1 -1
- package/icc-api/api/IccClassificationApi.d.ts +21 -1
- package/icc-api/api/IccClassificationApi.js +119 -63
- package/icc-api/api/IccClassificationApi.js.map +1 -1
- package/icc-api/api/IccContactApi.d.ts +21 -1
- package/icc-api/api/IccContactApi.js +385 -294
- package/icc-api/api/IccContactApi.js.map +1 -1
- package/icc-api/api/IccDocumentApi.d.ts +32 -25
- package/icc-api/api/IccDocumentApi.js +264 -212
- package/icc-api/api/IccDocumentApi.js.map +1 -1
- package/icc-api/api/IccExchangeDataApi.d.ts +19 -0
- package/icc-api/api/IccExchangeDataApi.js +85 -0
- package/icc-api/api/IccExchangeDataApi.js.map +1 -0
- package/icc-api/api/IccExchangeDataMapApi.d.ts +18 -0
- package/icc-api/api/IccExchangeDataMapApi.js +65 -0
- package/icc-api/api/IccExchangeDataMapApi.js.map +1 -0
- package/icc-api/api/IccFormApi.d.ts +21 -1
- package/icc-api/api/IccFormApi.js +321 -229
- package/icc-api/api/IccFormApi.js.map +1 -1
- package/icc-api/api/IccHelementApi.d.ts +21 -1
- package/icc-api/api/IccHelementApi.js +207 -137
- package/icc-api/api/IccHelementApi.js.map +1 -1
- package/icc-api/api/IccInvoiceApi.d.ts +21 -1
- package/icc-api/api/IccInvoiceApi.js +404 -298
- package/icc-api/api/IccInvoiceApi.js.map +1 -1
- package/icc-api/api/IccMaintenanceTaskApi.d.ts +12 -1
- package/icc-api/api/IccMaintenanceTaskApi.js +79 -43
- package/icc-api/api/IccMaintenanceTaskApi.js.map +1 -1
- package/icc-api/api/IccMessageApi.d.ts +12 -1
- package/icc-api/api/IccMessageApi.js +257 -191
- package/icc-api/api/IccMessageApi.js.map +1 -1
- package/icc-api/api/IccPatientApi.d.ts +12 -1
- package/icc-api/api/IccPatientApi.js +447 -351
- package/icc-api/api/IccPatientApi.js.map +1 -1
- package/icc-api/api/IccReceiptApi.d.ts +22 -8
- package/icc-api/api/IccReceiptApi.js +121 -64
- package/icc-api/api/IccReceiptApi.js.map +1 -1
- package/icc-api/api/IccRestApiPath.js +1 -1
- package/icc-api/api/IccRestApiPath.js.map +1 -1
- package/icc-api/api/IccTimeTableApi.d.ts +12 -1
- package/icc-api/api/IccTimeTableApi.js +86 -48
- package/icc-api/api/IccTimeTableApi.js.map +1 -1
- package/icc-api/index.d.ts +1 -0
- package/icc-api/index.js +1 -0
- package/icc-api/index.js.map +1 -1
- package/icc-api/model/AccessLog.d.ts +4 -0
- package/icc-api/model/AccessLog.js +1 -0
- package/icc-api/model/AccessLog.js.map +1 -1
- package/icc-api/model/Article.d.ts +4 -0
- package/icc-api/model/Article.js +1 -0
- package/icc-api/model/Article.js.map +1 -1
- package/icc-api/model/CalendarItem.d.ts +4 -0
- package/icc-api/model/CalendarItem.js +1 -0
- package/icc-api/model/CalendarItem.js.map +1 -1
- package/icc-api/model/Classification.d.ts +4 -0
- package/icc-api/model/Classification.js +1 -0
- package/icc-api/model/Classification.js.map +1 -1
- package/icc-api/model/ClassificationTemplate.d.ts +2 -0
- package/icc-api/model/ClassificationTemplate.js.map +1 -1
- package/icc-api/model/Contact.d.ts +4 -0
- package/icc-api/model/Contact.js +1 -0
- package/icc-api/model/Contact.js.map +1 -1
- package/icc-api/model/Device.d.ts +4 -4
- package/icc-api/model/Device.js.map +1 -1
- package/icc-api/model/Document.d.ts +4 -0
- package/icc-api/model/Document.js +1 -0
- package/icc-api/model/Document.js.map +1 -1
- package/icc-api/model/ExchangeData.d.ts +61 -0
- package/icc-api/model/ExchangeData.js +12 -0
- package/icc-api/model/ExchangeData.js.map +1 -0
- package/icc-api/model/ExchangeDataMap.d.ts +21 -0
- package/icc-api/model/ExchangeDataMap.js +10 -0
- package/icc-api/model/ExchangeDataMap.js.map +1 -0
- package/icc-api/model/ExchangeDataMapCreationBatch.d.ts +13 -0
- package/icc-api/model/ExchangeDataMapCreationBatch.js +10 -0
- package/icc-api/model/ExchangeDataMapCreationBatch.js.map +1 -0
- package/icc-api/model/Form.d.ts +4 -0
- package/icc-api/model/Form.js +1 -0
- package/icc-api/model/Form.js.map +1 -1
- package/icc-api/model/HealthElement.d.ts +4 -0
- package/icc-api/model/HealthElement.js +1 -0
- package/icc-api/model/HealthElement.js.map +1 -1
- package/icc-api/model/HealthcareParty.d.ts +2 -2
- package/icc-api/model/HealthcareParty.js.map +1 -1
- package/icc-api/model/IcureStub.d.ts +2 -0
- package/icc-api/model/IcureStub.js.map +1 -1
- package/icc-api/model/Invoice.d.ts +4 -0
- package/icc-api/model/Invoice.js +1 -0
- package/icc-api/model/Invoice.js.map +1 -1
- package/icc-api/model/MaintenanceTask.d.ts +4 -0
- package/icc-api/model/MaintenanceTask.js +1 -0
- package/icc-api/model/MaintenanceTask.js.map +1 -1
- package/icc-api/model/Message.d.ts +4 -0
- package/icc-api/model/Message.js +1 -0
- package/icc-api/model/Message.js.map +1 -1
- package/icc-api/model/PaginatedListExchangeData.d.ts +9 -0
- package/icc-api/model/PaginatedListExchangeData.js +10 -0
- package/icc-api/model/PaginatedListExchangeData.js.map +1 -0
- package/icc-api/model/Patient.d.ts +6 -2
- package/icc-api/model/Patient.js +1 -0
- package/icc-api/model/Patient.js.map +1 -1
- package/icc-api/model/PatientByHcPartyGenderEducationProfession.d.ts +31 -0
- package/icc-api/model/PatientByHcPartyGenderEducationProfession.js +32 -0
- package/icc-api/model/PatientByHcPartyGenderEducationProfession.js.map +1 -0
- package/icc-api/model/Receipt.d.ts +4 -0
- package/icc-api/model/Receipt.js +1 -0
- package/icc-api/model/Receipt.js.map +1 -1
- package/icc-api/model/SecureDelegation.d.ts +52 -0
- package/icc-api/model/SecureDelegation.js +16 -0
- package/icc-api/model/SecureDelegation.js.map +1 -0
- package/icc-api/model/SecurityMetadata.d.ts +33 -0
- package/icc-api/model/SecurityMetadata.js +13 -0
- package/icc-api/model/SecurityMetadata.js.map +1 -0
- package/icc-api/model/Service.d.ts +2 -0
- package/icc-api/model/Service.js.map +1 -1
- package/icc-api/model/TimeTable.d.ts +4 -0
- package/icc-api/model/TimeTable.js +1 -0
- package/icc-api/model/TimeTable.js.map +1 -1
- package/icc-api/model/models.d.ts +20 -39
- package/icc-api/model/models.js +15 -37
- package/icc-api/model/models.js.map +1 -1
- package/icc-api/model/requests/EntityBulkShareResult.d.ts +28 -0
- package/icc-api/model/requests/EntityBulkShareResult.js +16 -0
- package/icc-api/model/requests/EntityBulkShareResult.js.map +1 -0
- package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.d.ts +10 -0
- package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js +17 -0
- package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js.map +1 -0
- package/icc-api/model/requests/EntityShareRequest.d.ts +110 -0
- package/icc-api/model/requests/EntityShareRequest.js +63 -0
- package/icc-api/model/requests/EntityShareRequest.js.map +1 -0
- package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.d.ts +54 -0
- package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js +24 -0
- package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js.map +1 -0
- package/icc-api/model/requests/MinimalEntityBulkShareResult.d.ts +23 -0
- package/icc-api/model/requests/MinimalEntityBulkShareResult.js +13 -0
- package/icc-api/model/requests/MinimalEntityBulkShareResult.js.map +1 -0
- package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.d.ts +21 -0
- package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.js +14 -0
- package/icc-api/model/requests/RejectedShareOrMetadataUpdateRequest.js.map +1 -0
- package/icc-x-api/basexapi/EncryptedEntityXApi.d.ts +3 -2
- package/icc-x-api/basexapi/EncryptedEntityXApi.js.map +1 -1
- package/icc-x-api/crypto/AES.js +1 -1
- package/icc-x-api/crypto/AES.js.map +1 -1
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.d.ts +16 -0
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js +41 -0
- package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js.map +1 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.d.ts +42 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.js +86 -0
- package/icc-x-api/crypto/AccessControlSecretUtils.js.map +1 -0
- package/icc-x-api/crypto/BaseExchangeDataManager.d.ts +146 -0
- package/icc-x-api/crypto/BaseExchangeDataManager.js +342 -0
- package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -0
- package/icc-x-api/crypto/BaseExchangeKeysManager.d.ts +0 -18
- package/icc-x-api/crypto/BaseExchangeKeysManager.js +11 -85
- package/icc-x-api/crypto/BaseExchangeKeysManager.js.map +1 -1
- package/icc-x-api/crypto/ConfidentialEntities.d.ts +26 -16
- package/icc-x-api/crypto/ConfidentialEntities.js +30 -17
- package/icc-x-api/crypto/ConfidentialEntities.js.map +1 -1
- package/icc-x-api/crypto/CryptoStrategies.d.ts +8 -1
- package/icc-x-api/crypto/CryptoStrategies.js.map +1 -1
- package/icc-x-api/crypto/ExchangeDataManager.d.ts +95 -0
- package/icc-x-api/crypto/ExchangeDataManager.js +493 -0
- package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -0
- package/icc-x-api/crypto/ExchangeDataMapManager.d.ts +32 -0
- package/icc-x-api/crypto/ExchangeDataMapManager.js +70 -0
- package/icc-x-api/crypto/ExchangeDataMapManager.js.map +1 -0
- package/icc-x-api/crypto/ExchangeKeysManager.d.ts +4 -16
- package/icc-x-api/crypto/ExchangeKeysManager.js +4 -62
- package/icc-x-api/crypto/ExchangeKeysManager.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtils.d.ts +336 -0
- package/icc-x-api/crypto/ExtendedApisUtils.js +3 -0
- package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -0
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +181 -0
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +562 -0
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -0
- package/icc-x-api/crypto/KeyRecovery.d.ts +5 -2
- package/icc-x-api/crypto/KeyRecovery.js +59 -29
- package/icc-x-api/crypto/KeyRecovery.js.map +1 -1
- package/icc-x-api/crypto/LegacyCryptoStrategies.d.ts +7 -2
- package/icc-x-api/crypto/LegacyCryptoStrategies.js +8 -1
- package/icc-x-api/crypto/LegacyCryptoStrategies.js.map +1 -1
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.d.ts +39 -0
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js +150 -0
- package/icc-x-api/crypto/LegacyDelegationSecurityMetadataDecryptor.js.map +1 -0
- package/icc-x-api/crypto/RSA.d.ts +34 -8
- package/icc-x-api/crypto/RSA.js +80 -13
- package/icc-x-api/crypto/RSA.js.map +1 -1
- package/icc-x-api/crypto/SecureDelegationsEncryption.d.ts +54 -0
- package/icc-x-api/crypto/SecureDelegationsEncryption.js +178 -0
- package/icc-x-api/crypto/SecureDelegationsEncryption.js.map +1 -0
- package/icc-x-api/crypto/SecureDelegationsManager.d.ts +66 -0
- package/icc-x-api/crypto/SecureDelegationsManager.js +261 -0
- package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -0
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.d.ts +37 -0
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js +294 -0
- package/icc-x-api/crypto/SecureDelegationsSecurityMetadataDecryptor.js.map +1 -0
- package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +114 -0
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js +98 -0
- package/icc-x-api/crypto/SecurityMetadataDecryptor.js.map +1 -0
- package/icc-x-api/crypto/ShamirKeysManager.d.ts +5 -5
- package/icc-x-api/crypto/ShamirKeysManager.js +6 -9
- package/icc-x-api/crypto/ShamirKeysManager.js.map +1 -1
- package/icc-x-api/crypto/TransferKeysManager.d.ts +8 -6
- package/icc-x-api/crypto/TransferKeysManager.js +75 -52
- package/icc-x-api/crypto/TransferKeysManager.js.map +1 -1
- package/icc-x-api/crypto/{KeyManager.d.ts → UserEncryptionKeysManager.d.ts} +4 -6
- package/icc-x-api/crypto/{KeyManager.js → UserEncryptionKeysManager.js} +43 -23
- package/icc-x-api/crypto/UserEncryptionKeysManager.js.map +1 -0
- package/icc-x-api/crypto/UserSignatureKeysManager.d.ts +26 -0
- package/icc-x-api/crypto/UserSignatureKeysManager.js +74 -0
- package/icc-x-api/crypto/UserSignatureKeysManager.js.map +1 -0
- package/icc-x-api/crypto/utils.d.ts +61 -11
- package/icc-x-api/crypto/utils.js +113 -44
- package/icc-x-api/crypto/utils.js.map +1 -1
- package/icc-x-api/filters/filters.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.d.ts +46 -11
- package/icc-x-api/icc-accesslog-x-api.js +75 -42
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +50 -14
- package/icc-x-api/icc-calendar-item-x-api.js +99 -49
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.d.ts +44 -9
- package/icc-x-api/icc-classification-x-api.js +56 -31
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +56 -32
- package/icc-x-api/icc-contact-x-api.js +95 -64
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +28 -334
- package/icc-x-api/icc-crypto-x-api.js +41 -765
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-data-owner-x-api.d.ts +20 -8
- package/icc-x-api/icc-data-owner-x-api.js +31 -10
- package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +48 -11
- package/icc-x-api/icc-document-x-api.js +111 -64
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +45 -10
- package/icc-x-api/icc-form-x-api.js +65 -35
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-hcparty-x-api.d.ts +2 -2
- package/icc-x-api/icc-hcparty-x-api.js +3 -3
- package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +55 -18
- package/icc-x-api/icc-helement-x-api.js +76 -41
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-icure-maintenance-x-api.d.ts +7 -2
- package/icc-x-api/icc-icure-maintenance-x-api.js +38 -27
- package/icc-x-api/icc-icure-maintenance-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.d.ts +50 -15
- package/icc-x-api/icc-invoice-x-api.js +63 -33
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.d.ts +53 -21
- package/icc-x-api/icc-maintenance-task-x-api.js +72 -35
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.d.ts +53 -15
- package/icc-x-api/icc-message-x-api.js +65 -36
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +84 -29
- package/icc-x-api/icc-patient-x-api.js +313 -378
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +44 -12
- package/icc-x-api/icc-receipt-x-api.js +67 -35
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.d.ts +43 -12
- package/icc-x-api/icc-time-table-x-api.js +56 -26
- package/icc-x-api/icc-time-table-x-api.js.map +1 -1
- package/icc-x-api/icc-user-x-api.d.ts +2 -2
- package/icc-x-api/icc-user-x-api.js +3 -3
- package/icc-x-api/icc-user-x-api.js.map +1 -1
- package/icc-x-api/index.d.ts +4 -2
- package/icc-x-api/index.js +154 -135
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/storage/DefaultStorageEntryKeysFactory.d.ts +2 -0
- package/icc-x-api/storage/DefaultStorageEntryKeysFactory.js +9 -2
- package/icc-x-api/storage/DefaultStorageEntryKeysFactory.js.map +1 -1
- package/icc-x-api/storage/IcureStorageFacade.d.ts +23 -2
- package/icc-x-api/storage/IcureStorageFacade.js +36 -2
- package/icc-x-api/storage/IcureStorageFacade.js.map +1 -1
- package/icc-x-api/storage/KeyStorageFacade.d.ts +12 -0
- package/icc-x-api/storage/KeyStorageFacade.js.map +1 -1
- package/icc-x-api/storage/KeyStorageImpl.d.ts +2 -0
- package/icc-x-api/storage/KeyStorageImpl.js +10 -0
- package/icc-x-api/storage/KeyStorageImpl.js.map +1 -1
- package/icc-x-api/storage/StorageEntryKeysFactory.d.ts +14 -1
- package/icc-x-api/storage/StorageEntryKeysFactory.js.map +1 -1
- package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +32 -0
- package/icc-x-api/utils/EntityWithDelegationTypeName.js +75 -0
- package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -0
- package/icc-x-api/utils/ShareResult.d.ts +74 -0
- package/icc-x-api/utils/ShareResult.js +61 -0
- package/icc-x-api/utils/ShareResult.js.map +1 -0
- package/icc-x-api/utils/binary-utils.d.ts +1 -0
- package/icc-x-api/utils/binary-utils.js +8 -1
- package/icc-x-api/utils/binary-utils.js.map +1 -1
- package/icc-x-api/utils/collection-utils.d.ts +5 -0
- package/icc-x-api/utils/collection-utils.js +26 -1
- package/icc-x-api/utils/collection-utils.js.map +1 -1
- package/icc-x-api/utils/crypto-utils.d.ts +4 -3
- package/icc-x-api/utils/crypto-utils.js +5 -4
- package/icc-x-api/utils/crypto-utils.js.map +1 -1
- package/icc-x-api/utils/lru-temporised-async-cache.d.ts +26 -3
- package/icc-x-api/utils/lru-temporised-async-cache.js +75 -15
- package/icc-x-api/utils/lru-temporised-async-cache.js.map +1 -1
- package/icc-x-api/utils/websocket.d.ts +10 -10
- package/icc-x-api/utils/websocket.js +18 -9
- package/icc-x-api/utils/websocket.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +2 -3
- package/icc-x-api/crypto/EntitiesEncryption.d.ts +0 -275
- package/icc-x-api/crypto/EntitiesEncryption.js +0 -734
- package/icc-x-api/crypto/EntitiesEncryption.js.map +0 -1
- package/icc-x-api/crypto/KeyManager.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../icc-x-api/filters/filters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAA+C;AAO/C,6DAAuD;AACvD,+CAAyC;AACzC,yDAAmD;AACnD,uFAAiF;AACjF,yFAAmF;AACnF,+FAAyF;AACzF,qFAA+E;AAC/E,yGAAmG;AACnG,2FAAqF;AAErF,uCAAoC;AACpC,qEAA+D;AAC/D,uHAAiH;AACjH,6DAAuD;AACvD,uGAAiG;AAGjG,qEAA+D;AAgB/D,mDAAgC;AAChC,qDAAkC;AAClC,+DAA4C;AAC5C,mDAAgC;AAChC,oDAAiC;AACjC,wEAAqD;AACrD,qDAAkC;AAClC,mDAAgC;AAChC,2DAAwC;AACxC,6EAA0D;AAC1D,sEAAmD;AACnD,8DAA2C;AAC3C,0DAAuC;AACvC,sDAAmC;AACnC,iEAA8C;AAC9C,4EAAyD;AACzD,kFAA+D;AAC/D,wEAAqD;AACrD,6DAA0C;AAC1C,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X,CACsB,CAAA;IAC3B,CAAC;IAED,KAAK;;QACH,OAAO,CAAA,MAAA,IAAI,CAAC,cAAc,oDAAI,KAAI,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAA;IACtD,CAAC;CACF","sourcesContent":["import {ConstantFilter} from './ConstantFilter'\nimport {Patient} from '../../icc-api/model/Patient'\nimport {AbstractFilterPatient} from '../../icc-api/model/AbstractFilterPatient'\nimport {AbstractFilterContact} from '../../icc-api/model/AbstractFilterContact'\nimport {AbstractFilterService} from '../../icc-api/model/AbstractFilterService'\nimport {Service} from '../../icc-api/model/Service'\nimport {Contact} from '../../icc-api/model/Contact'\nimport {IntersectionFilter} from './IntersectionFilter'\nimport {UnionFilter} from './UnionFilter'\nimport {ComplementFilter} from './ComplementFilter'\nimport {PatientByHcPartyAndActiveFilter} from './PatientByHcPartyAndActiveFilter'\nimport {PatientByHcPartyAndAddressFilter} from './PatientByHcPartyAndAddressFilter'\nimport {PatientByHcPartyAndExternalIdFilter} from './PatientByHcPartyAndExternalIdFilter'\nimport {PatientByHcPartyAndSsinsFilter} from './PatientByHcPartyAndSsinsFilter'\nimport {PatientByHcPartyDateOfBirthBetweenFilter} from './PatientByHcPartyDateOfBirthBetweenFilter'\nimport {PatientByHcPartyDateOfBirthFilter} from './PatientByHcPartyDateOfBirthFilter'\n\nimport {add, format} from 'date-fns'\nimport {PatientByHcPartyFilter} from './PatientByHcPartyFilter'\nimport {PatientByHcPartyGenderEducationProfessionFilter} from './PatientByHcPartyGenderEducationProfessionFilter'\nimport {PatientByIdsFilter} from './PatientByIdsFilter'\nimport {PatientByHcPartyNameContainsFuzzyFilter} from './PatientByHcPartyNameContainsFuzzyFilter'\n\nimport GenderEnum = Patient.GenderEnum\nimport {ContactByHcPartyFilter} from './ContactByHcPartyFilter'\nimport {Device} from '../../icc-api/model/Device'\nimport {AbstractFilterDevice} from '../../icc-api/model/AbstractFilterDevice'\nimport {MaintenanceTask} from '../../icc-api/model/MaintenanceTask'\nimport {AbstractFilterMaintenanceTask} from '../../icc-api/model/AbstractFilterMaintenanceTask'\nimport {Code} from '../../icc-api/model/Code'\nimport {AbstractFilterCode} from '../../icc-api/model/AbstractFilterCode'\nimport {HealthElement} from '../../icc-api/model/HealthElement'\nimport {AbstractFilterHealthElement} from '../../icc-api/model/AbstractFilterHealthElement'\nimport {Invoice} from '../../icc-api/model/Invoice'\nimport {AbstractFilterInvoice} from '../../icc-api/model/AbstractFilterInvoice'\nimport {User} from '../../icc-api/model/User'\nimport {AbstractFilterUser} from '../../icc-api/model/AbstractFilterUser'\nimport {HealthcareParty} from \"../../icc-api/model/HealthcareParty\"\nimport {AbstractFilterHealthcareParty} from \"../../icc-api/model/AbstractFilterHealthcareParty\"\n\nexport * from './AllCodesFilter'\nexport * from './AllDevicesFilter'\nexport * from './AllHealthcarePartiesFilter'\nexport * from './AllUsersFilter'\nexport * from './CodeByIdsFilter'\nexport * from './CodeByRegionTypeLabelLanguageFilter'\nexport * from './ComplementFilter'\nexport * from './ConstantFilter'\nexport * from './ContactByHcPartyFilter'\nexport * from './ContactByHcPartyPatientTagCodeDateFilter'\nexport * from './ContactByHcPartyTagCodeDateFilter'\nexport * from './ContactByServiceIdsFilter'\nexport * from './DeviceByHcPartyFilter'\nexport * from './DeviceByIdsFilter'\nexport * from './HealthElementByHcPartyFilter'\nexport * from './HealthElementByHcPartyIdentifiersFilter'\nexport * from './HealthElementByHcPartySecretForeignKeysFilter'\nexport * from './HealthElementByHcPartyTagCodeFilter'\nexport * from './HealthElementByIdsFilter'\nexport * from './HealthcarePartyByIdsFilter'\nexport * from './HealthcarePartyByNameFilter'\nexport * from './HealthcarePartyByTagCodeFilter'\nexport * from './IntersectionFilter'\nexport * from './InvoiceByHcPartyCodeDateFilter'\nexport * from './PatientByHcPartyAndActiveFilter'\nexport * from './PatientByHcPartyAndAddressFilter'\nexport * from './PatientByHcPartyAndExternalIdFilter'\nexport * from './PatientByHcPartyAndIdentifiersFilter'\nexport * from './PatientByHcPartyAndSsinFilter'\nexport * from './PatientByHcPartyAndSsinsFilter'\nexport * from './PatientByHcPartyDateOfBirthBetweenFilter'\nexport * from './PatientByHcPartyDateOfBirthFilter'\nexport * from './PatientByHcPartyFilter'\nexport * from './PatientByHcPartyGenderEducationProfessionFilter'\nexport * from './PatientByHcPartyNameContainsFuzzyFilter'\nexport * from './PatientByHcPartyNameFilter'\nexport * from './PatientByIdsFilter'\nexport * from './ServiceByContactsAndSubcontactsFilter'\nexport * from './ServiceByHcPartyFilter'\nexport * from './ServiceByHcPartyIdentifiersFilter'\nexport * from './ServiceByHcPartyHealthElementIdsFilter'\nexport * from './ServiceByHcPartyTagCodeDateFilter'\nexport * from './ServiceByIdsFilter'\nexport * from './ServiceBySecretForeignKeys'\nexport * from './UnionFilter'\nexport * from './UserByIdsFilter'\nexport * from './MaintenanceTaskByHcPartyAndIdentifiersFilter'\nexport * from './MaintenanceTaskByHcPartyAndTypeFilter'\nexport * from './MaintenanceTaskByIdsFilter'\nexport * from './MaintenanceTaskAfterDateFilter'\n\nexport class Filter {\n public static patient(): PatientFilterBuilder {\n return new PatientFilterBuilder()\n }\n}\n\nexport type AbstractFilter<T> =\n | (T extends Patient\n ? AbstractFilterPatient\n : T extends Contact\n ? AbstractFilterContact\n : T extends Service\n ? AbstractFilterService\n : T extends HealthcareParty\n ? AbstractFilterHealthcareParty\n : T extends Device\n ? AbstractFilterDevice\n : T extends MaintenanceTask\n ? AbstractFilterMaintenanceTask\n : T extends Code\n ? AbstractFilterCode\n : T extends HealthElement\n ? AbstractFilterHealthElement\n : T extends Invoice\n ? AbstractFilterInvoice\n : T extends User\n ? AbstractFilterUser\n : never)\n | ConstantFilter<T>\n | IntersectionFilter<T>\n | UnionFilter<T>\n | ComplementFilter<T>\n\nconst f: AbstractFilterContact = new ComplementFilter<Contact>(new ContactByHcPartyFilter({}), new ContactByHcPartyFilter({}))\n\nabstract class FilterBuilder<T> {\n // This is the current generator for the filter, when we call build(), filterProvider() is going to be called\n filterProvider?: () => AbstractFilter<T>\n // This is the method that is called each time we chain a filter to another filter. The default behaviour is to\n // return a FilterBuilder with the provider set to the last element in the chain, except when we use combination\n // operators like or()/and()/… . After one of those, the composer is set to a function that will return a FilterBuilder\n\n protected constructor(\n filterProvider?: () => AbstractFilter<T>,\n composer?: (thisFilterBuilder: FilterBuilder<T>, otherFilterBuilder: FilterBuilder<T>) => FilterBuilder<T>\n ) {\n this.filterProvider = filterProvider\n composer && (this.composer = composer)\n }\n\n // that combines the existing filterBuilder with the filter definition we just added.\n composer: (thisFilterBuilder: FilterBuilder<T>, otherFilterBuilder: FilterBuilder<T>) => FilterBuilder<T> = (\n thisFilterBuilder: FilterBuilder<T>,\n otherFilterBuilder: FilterBuilder<T>\n ) => otherFilterBuilder\n\n abstract build(): AbstractFilter<T>\n\n abstract clone(\n filterProvider?: () => AbstractFilter<T>,\n composer?: (thisFilterBuilder: FilterBuilder<T>, otherFilterBuilder: FilterBuilder<T>) => FilterBuilder<T>\n ): FilterBuilder<T>\n\n listOf(elements: T[]): FilterBuilder<T> {\n return this.clone(() => new ConstantFilter<T>(elements) as AbstractFilter<T>)\n }\n\n /**\n * There are two ways of doing and, or, …\n *\n * 1) for (...) or (...) we use the syntax ... .or((builder) => builder...)\n * ex: youngerThan(65).or((b) => b.olderThan(18).and().gender(M)) means any gender < 65 or male > 18\n * 2) for ((...) or ...) we use the syntax ... .or().…\n * ex: youngerThan(65).or().olderThan(18).and().gender(M) means males between 18 and 65\n *\n * When 1) is used we do not have to wait for anything to provide a resolved builder that can later be combined with extra elements in the chain.\n * In other words, we can build the current filter chain up to the or/and/… and we can build what is inside the or/and/… brackets and we can set\n * the filterProvider of the returned Builder to () => UnionFilter([leftHand.build(), innerBrackets.build()]).\n *\n * When 2) is used, things get more tricky because we will have to do an or/and/… between what we have on the leftHand and with what we do not have\n * yet on the right hand. What we do in that situation is to set the filterProvider() to undefined because calling build() without having provided a\n * rightHand doesn't make sense. We set a composer that is going to be called the next time we chain a filter.\n *\n * @param filterBuilderFactory\n */\n\n and(filterBuilderFactory?: (it: FilterBuilder<T>) => FilterBuilder<T>): FilterBuilder<T> {\n const combiner = (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () =>\n new IntersectionFilter<T>([leftHandFilter, rightHandFilter]) as AbstractFilter<T>\n\n return filterBuilderFactory ? this.makeEagerLeftRightFilterBuilder(filterBuilderFactory, combiner) : this.makeLazyLeftRightFilterBuilder(combiner)\n }\n\n or(filterBuilderFactory?: (it: FilterBuilder<T>) => FilterBuilder<T>): FilterBuilder<T> {\n const combiner = (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () =>\n new UnionFilter<T>([leftHandFilter, rightHandFilter]) as AbstractFilter<T>\n\n return filterBuilderFactory ? this.makeEagerLeftRightFilterBuilder(filterBuilderFactory, combiner) : this.makeLazyLeftRightFilterBuilder(combiner)\n }\n\n minus(filterBuilderFactory?: (it: FilterBuilder<T>) => FilterBuilder<T>): FilterBuilder<T> {\n const combiner = (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () =>\n new ComplementFilter<T>(leftHandFilter, rightHandFilter) as AbstractFilter<T>\n\n return filterBuilderFactory ? this.makeEagerLeftRightFilterBuilder(filterBuilderFactory, combiner) : this.makeLazyLeftRightFilterBuilder(combiner)\n }\n\n private makeLazyLeftRightFilterBuilder(\n leftHandRightHandFiltersCombiner: (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () => AbstractFilter<T>\n ) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const leftHandFilterBuilder: FilterBuilder<T> = this\n const leftHandFilter = leftHandFilterBuilder.build() // Freeze the leftHand filter\n\n return leftHandFilterBuilder.filterProvider\n ? this.clone(\n undefined, //filter provider is indeterminate until we have performed a composition\n (unused: FilterBuilder<T>, rightHandFilterBuilder: FilterBuilder<T>) => {\n // because we freeze the leftHand in the state it is right now, we are not going to use its value when the composition occurs\n const rightHandFilter = rightHandFilterBuilder.build()\n\n return rightHandFilter\n ? this.clone(leftHandRightHandFiltersCombiner(leftHandFilter, rightHandFilter), rightHandFilterBuilder.composer)\n : rightHandFilterBuilder //Can this happen ?\n }\n )\n : this\n }\n\n private makeEagerLeftRightFilterBuilder(\n rightHandFilterBuilderFactory: (it: FilterBuilder<T>) => FilterBuilder<T>,\n leftHandRightHandFiltersCombiner: (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () => AbstractFilter<T>\n ) {\n const rightHandFilterBuilder = rightHandFilterBuilderFactory(this)\n return this.filterProvider ? this.clone(leftHandRightHandFiltersCombiner(this.build(), rightHandFilterBuilder.build())) : this\n }\n}\n\nclass PatientFilterBuilder extends FilterBuilder<Patient> {\n hcpId?: string\n\n constructor(\n filterProvider?: () => AbstractFilter<Patient>,\n hcpId?: string,\n composer?: (thisFilterBuilder: FilterBuilder<Patient>, otherFilterBuilder: FilterBuilder<Patient>) => FilterBuilder<Patient>\n ) {\n super(filterProvider, composer)\n this.hcpId = hcpId\n }\n\n clone(\n filterProvider?: () => AbstractFilter<Patient>,\n composer?: (thisFilterBuilder: FilterBuilder<Patient>, otherFilterBuilder: FilterBuilder<Patient>) => FilterBuilder<Patient>\n ): FilterBuilder<Patient> {\n return new PatientFilterBuilder(filterProvider, this.hcpId, composer)\n }\n\n listOf(elements: Patient[]): PatientFilterBuilder {\n return new PatientFilterBuilder(() => new ConstantFilter<Patient>(elements) as AbstractFilter<Patient>)\n }\n\n and(filterBuilderFactory?: (it: PatientFilterBuilder) => PatientFilterBuilder): PatientFilterBuilder {\n return super.and(filterBuilderFactory as any) as PatientFilterBuilder\n }\n\n or(filterBuilderFactory?: (it: PatientFilterBuilder) => PatientFilterBuilder): PatientFilterBuilder {\n return super.or(filterBuilderFactory as any) as PatientFilterBuilder\n }\n\n minus(filterBuilderFactory?: (it: PatientFilterBuilder) => PatientFilterBuilder): PatientFilterBuilder {\n return super.minus(filterBuilderFactory as any) as PatientFilterBuilder\n }\n\n forHcp(hcpId: string): PatientFilterBuilder {\n return this.composer(this, new PatientFilterBuilder(this.filterProvider, hcpId)) as PatientFilterBuilder\n }\n\n all(): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyFilter({healthcarePartyId: this.hcpId}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n activePatients(): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyAndActiveFilter({healthcarePartyId: this.hcpId, active: true}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n inactivePatients(): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyAndActiveFilter({healthcarePartyId: this.hcpId, active: false}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n byAddress(searchString?: string, postalCode?: string, houseNumber?: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyAndAddressFilter({\n healthcarePartyId: this.hcpId,\n searchString,\n postalCode,\n houseNumber,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n withExternalId(externalId: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyAndExternalIdFilter({\n healthcarePartyId: this.hcpId,\n externalId: externalId,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n withSsins(ssins: string[]): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyAndSsinsFilter({healthcarePartyId: this.hcpId, ssins: ssins}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n withDateOfBirthBetween(from?: number, to?: number): PatientFilterBuilder {\n return this.composer(\n this,\n this.clone(\n () =>\n new PatientByHcPartyDateOfBirthBetweenFilter({\n healthcarePartyId: this.hcpId,\n minDateOfBirth: from,\n maxDateOfBirth: to,\n })\n )\n ) as PatientFilterBuilder\n }\n\n byDateOfBirth(dateOfBirth: number): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyDateOfBirthFilter({\n healthcarePartyId: this.hcpId,\n dateOfBirth: dateOfBirth,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n olderThan(age: number): PatientFilterBuilder {\n return this.withDateOfBirthBetween(10000101, parseInt(format(add(new Date(), {years: -age}), 'yyyyMMdd')))\n }\n\n youngerThan(age: number): PatientFilterBuilder {\n return this.withDateOfBirthBetween(parseInt(format(add(new Date(), {years: -age}), 'yyyyMMdd')), 99991231)\n }\n\n byGenderEducationProfession(gender?: GenderEnum, education?: string, profession?: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyGenderEducationProfessionFilter({\n healthcarePartyId: this.hcpId,\n gender: gender,\n education: education,\n profession: profession,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n byIds(ids: string[]): PatientFilterBuilder {\n return this.composer(this, new PatientFilterBuilder(() => new PatientByIdsFilter({ids: ids}), this.hcpId)) as PatientFilterBuilder\n }\n\n searchByName(name: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyNameContainsFuzzyFilter({\n healthcarePartyId: this.hcpId,\n searchString: name,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n build(): AbstractFilter<Patient> {\n return this.filterProvider?.() || this.all().build()\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../icc-x-api/filters/filters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAA+C;AAO/C,6DAAuD;AACvD,+CAAyC;AACzC,yDAAmD;AACnD,uFAAiF;AACjF,yFAAmF;AACnF,+FAAyF;AACzF,qFAA+E;AAC/E,yGAAmG;AACnG,2FAAqF;AAErF,uCAAoC;AACpC,qEAA+D;AAC/D,uHAAiH;AACjH,6DAAuD;AACvD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G,EAAE,GAAG,EAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAyB,CAAA;IACpI,CAAC;IAED,YAAY,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC,QAAQ,CAClB,IAAI,EACJ,IAAI,oBAAoB,CACtB,GAAG,EAAE,CACH,IAAI,iFAAuC,CAAC;YAC1C,iBAAiB,EAAE,IAAI,CAAC,KAAK;YAC7B,YAAY,EAAE,IAAI;SACnB,CAAC,EACJ,IAAI,CAAC,KAAK,CACX,CACsB,CAAA;IAC3B,CAAC;IAED,KAAK;;QACH,OAAO,CAAA,MAAA,IAAI,CAAC,cAAc,oDAAI,KAAI,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAA;IACtD,CAAC;CACF","sourcesContent":["import {ConstantFilter} from './ConstantFilter'\nimport {Patient} from '../../icc-api/model/Patient'\nimport {AbstractFilterPatient} from '../../icc-api/model/AbstractFilterPatient'\nimport {AbstractFilterContact} from '../../icc-api/model/AbstractFilterContact'\nimport {AbstractFilterService} from '../../icc-api/model/AbstractFilterService'\nimport {Service} from '../../icc-api/model/Service'\nimport {Contact} from '../../icc-api/model/Contact'\nimport {IntersectionFilter} from './IntersectionFilter'\nimport {UnionFilter} from './UnionFilter'\nimport {ComplementFilter} from './ComplementFilter'\nimport {PatientByHcPartyAndActiveFilter} from './PatientByHcPartyAndActiveFilter'\nimport {PatientByHcPartyAndAddressFilter} from './PatientByHcPartyAndAddressFilter'\nimport {PatientByHcPartyAndExternalIdFilter} from './PatientByHcPartyAndExternalIdFilter'\nimport {PatientByHcPartyAndSsinsFilter} from './PatientByHcPartyAndSsinsFilter'\nimport {PatientByHcPartyDateOfBirthBetweenFilter} from './PatientByHcPartyDateOfBirthBetweenFilter'\nimport {PatientByHcPartyDateOfBirthFilter} from './PatientByHcPartyDateOfBirthFilter'\n\nimport {add, format} from 'date-fns'\nimport {PatientByHcPartyFilter} from './PatientByHcPartyFilter'\nimport {PatientByHcPartyGenderEducationProfessionFilter} from './PatientByHcPartyGenderEducationProfessionFilter'\nimport {PatientByIdsFilter} from './PatientByIdsFilter'\nimport {PatientByHcPartyNameContainsFuzzyFilter} from './PatientByHcPartyNameContainsFuzzyFilter'\n\nimport GenderEnum = Patient.GenderEnum\nimport {ContactByHcPartyFilter} from './ContactByHcPartyFilter'\nimport {Device} from '../../icc-api/model/Device'\nimport {AbstractFilterDevice} from '../../icc-api/model/AbstractFilterDevice'\nimport {MaintenanceTask} from '../../icc-api/model/MaintenanceTask'\nimport {AbstractFilterMaintenanceTask} from '../../icc-api/model/AbstractFilterMaintenanceTask'\nimport {Code} from '../../icc-api/model/Code'\nimport {AbstractFilterCode} from '../../icc-api/model/AbstractFilterCode'\nimport {HealthElement} from '../../icc-api/model/HealthElement'\nimport {AbstractFilterHealthElement} from '../../icc-api/model/AbstractFilterHealthElement'\nimport {Invoice} from '../../icc-api/model/Invoice'\nimport {AbstractFilterInvoice} from '../../icc-api/model/AbstractFilterInvoice'\nimport {User} from '../../icc-api/model/User'\nimport {AbstractFilterUser} from '../../icc-api/model/AbstractFilterUser'\nimport {HealthcareParty} from \"../../icc-api/model/HealthcareParty\"\nimport {AbstractFilterHealthcareParty} from \"../../icc-api/model/AbstractFilterHealthcareParty\"\n\nexport * from './AllCodesFilter'\nexport * from './AllDevicesFilter'\nexport * from './AllHealthcarePartiesFilter'\nexport * from './AllUsersFilter'\nexport * from './CodeByIdsFilter'\nexport * from './CodeByRegionTypeLabelLanguageFilter'\nexport * from './ComplementFilter'\nexport * from './ConstantFilter'\nexport * from './ContactByHcPartyFilter'\nexport * from './ContactByHcPartyPatientTagCodeDateFilter'\nexport * from './ContactByHcPartyTagCodeDateFilter'\nexport * from './ContactByServiceIdsFilter'\nexport * from './DeviceByHcPartyFilter'\nexport * from './DeviceByIdsFilter'\nexport * from './HealthElementByHcPartyFilter'\nexport * from './HealthElementByHcPartyIdentifiersFilter'\nexport * from './HealthElementByHcPartySecretForeignKeysFilter'\nexport * from './HealthElementByHcPartyTagCodeFilter'\nexport * from './HealthElementByIdsFilter'\nexport * from './HealthcarePartyByIdsFilter'\nexport * from './HealthcarePartyByNameFilter'\nexport * from './HealthcarePartyByTagCodeFilter'\nexport * from './IntersectionFilter'\nexport * from './InvoiceByHcPartyCodeDateFilter'\nexport * from './PatientByHcPartyAndActiveFilter'\nexport * from './PatientByHcPartyAndAddressFilter'\nexport * from './PatientByHcPartyAndExternalIdFilter'\nexport * from './PatientByHcPartyAndIdentifiersFilter'\nexport * from './PatientByHcPartyAndSsinFilter'\nexport * from './PatientByHcPartyAndSsinsFilter'\nexport * from './PatientByHcPartyDateOfBirthBetweenFilter'\nexport * from './PatientByHcPartyDateOfBirthFilter'\nexport * from './PatientByHcPartyFilter'\nexport * from './PatientByHcPartyGenderEducationProfessionFilter'\nexport * from './PatientByHcPartyNameContainsFuzzyFilter'\nexport * from './PatientByHcPartyNameFilter'\nexport * from './PatientByIdsFilter'\nexport * from './ServiceByContactsAndSubcontactsFilter'\nexport * from './ServiceByHcPartyFilter'\nexport * from './ServiceByHcPartyIdentifiersFilter'\nexport * from './ServiceByHcPartyHealthElementIdsFilter'\nexport * from './ServiceByHcPartyTagCodeDateFilter'\nexport * from './ServiceByIdsFilter'\nexport * from './ServiceBySecretForeignKeys'\nexport * from './UnionFilter'\nexport * from './UserByIdsFilter'\nexport * from './MaintenanceTaskByHcPartyAndIdentifiersFilter'\nexport * from './MaintenanceTaskByHcPartyAndTypeFilter'\nexport * from './MaintenanceTaskByIdsFilter'\nexport * from './MaintenanceTaskAfterDateFilter'\n\nexport class Filter {\n public static patient(): PatientFilterBuilder {\n return new PatientFilterBuilder()\n }\n}\n\nexport type AbstractFilter<T> =\n | (T extends Patient\n ? AbstractFilterPatient\n : T extends Contact\n ? AbstractFilterContact\n : T extends Service\n ? AbstractFilterService\n : T extends HealthcareParty\n ? AbstractFilterHealthcareParty\n : T extends Device\n ? AbstractFilterDevice\n : T extends MaintenanceTask\n ? AbstractFilterMaintenanceTask\n : T extends Code\n ? AbstractFilterCode\n : T extends HealthElement\n ? AbstractFilterHealthElement\n : T extends Invoice\n ? AbstractFilterInvoice\n : T extends User\n ? AbstractFilterUser\n : never)\n | ConstantFilter<T>\n | IntersectionFilter<T>\n | UnionFilter<T>\n | ComplementFilter<T>\n\nconst f: AbstractFilterContact = new ComplementFilter<Contact>(new ContactByHcPartyFilter({}), new ContactByHcPartyFilter({}))\n\nabstract class FilterBuilder<T> {\n // This is the current generator for the filter, when we call build(), filterProvider() is going to be called\n filterProvider?: () => AbstractFilter<T>\n // This is the method that is called each time we chain a filter to another filter. The default behaviour is to\n // return a FilterBuilder with the provider set to the last element in the chain, except when we use combination\n // operators like or()/and()/… . After one of those, the composer is set to a function that will return a FilterBuilder\n\n protected constructor(\n filterProvider?: () => AbstractFilter<T>,\n composer?: (thisFilterBuilder: FilterBuilder<T>, otherFilterBuilder: FilterBuilder<T>) => FilterBuilder<T>\n ) {\n this.filterProvider = filterProvider\n composer && (this.composer = composer)\n }\n\n // that combines the existing filterBuilder with the filter definition we just added.\n composer: (thisFilterBuilder: FilterBuilder<T>, otherFilterBuilder: FilterBuilder<T>) => FilterBuilder<T> = (\n thisFilterBuilder: FilterBuilder<T>,\n otherFilterBuilder: FilterBuilder<T>\n ) => otherFilterBuilder\n\n abstract build(): AbstractFilter<T>\n\n abstract clone(\n filterProvider?: () => AbstractFilter<T>,\n composer?: (thisFilterBuilder: FilterBuilder<T>, otherFilterBuilder: FilterBuilder<T>) => FilterBuilder<T>\n ): FilterBuilder<T>\n\n listOf(elements: T[]): FilterBuilder<T> {\n return this.clone(() => new ConstantFilter<T>(elements) as AbstractFilter<T>)\n }\n\n /**\n * There are two ways of doing and, or, …\n *\n * 1) for (...) or (...) we use the syntax ... .or((builder) => builder...)\n * ex: youngerThan(65).or((b) => b.olderThan(18).and().gender(M)) means any gender < 65 or male > 18\n * 2) for ((...) or ...) we use the syntax ... .or().…\n * ex: youngerThan(65).or().olderThan(18).and().gender(M) means males between 18 and 65\n *\n * When 1) is used we do not have to wait for anything to provide a resolved builder that can later be combined with extra elements in the chain.\n * In other words, we can build the current filter chain up to the or/and/… and we can build what is inside the or/and/… brackets and we can set\n * the filterProvider of the returned Builder to () => UnionFilter([leftHand.build(), innerBrackets.build()]).\n *\n * When 2) is used, things get more tricky because we will have to do an or/and/… between what we have on the leftHand and with what we do not have\n * yet on the right hand. What we do in that situation is to set the filterProvider() to undefined because calling build() without having provided a\n * rightHand doesn't make sense. We set a composer that is going to be called the next time we chain a filter.\n *\n * @param filterBuilderFactory\n */\n\n and(filterBuilderFactory?: (it: FilterBuilder<T>) => FilterBuilder<T>): FilterBuilder<T> {\n const combiner = (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () =>\n new IntersectionFilter<T>([leftHandFilter, rightHandFilter]) as AbstractFilter<T>\n\n return filterBuilderFactory ? this.makeEagerLeftRightFilterBuilder(filterBuilderFactory, combiner) : this.makeLazyLeftRightFilterBuilder(combiner)\n }\n\n or(filterBuilderFactory?: (it: FilterBuilder<T>) => FilterBuilder<T>): FilterBuilder<T> {\n const combiner = (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () =>\n new UnionFilter<T>([leftHandFilter, rightHandFilter]) as AbstractFilter<T>\n\n return filterBuilderFactory ? this.makeEagerLeftRightFilterBuilder(filterBuilderFactory, combiner) : this.makeLazyLeftRightFilterBuilder(combiner)\n }\n\n minus(filterBuilderFactory?: (it: FilterBuilder<T>) => FilterBuilder<T>): FilterBuilder<T> {\n const combiner = (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () =>\n new ComplementFilter<T>(leftHandFilter, rightHandFilter) as AbstractFilter<T>\n\n return filterBuilderFactory ? this.makeEagerLeftRightFilterBuilder(filterBuilderFactory, combiner) : this.makeLazyLeftRightFilterBuilder(combiner)\n }\n\n private makeLazyLeftRightFilterBuilder(\n leftHandRightHandFiltersCombiner: (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () => AbstractFilter<T>\n ) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const leftHandFilterBuilder: FilterBuilder<T> = this\n const leftHandFilter = leftHandFilterBuilder.build() // Freeze the leftHand filter\n\n return leftHandFilterBuilder.filterProvider\n ? this.clone(\n undefined, //filter provider is indeterminate until we have performed a composition\n (unused: FilterBuilder<T>, rightHandFilterBuilder: FilterBuilder<T>) => {\n // because we freeze the leftHand in the state it is right now, we are not going to use its value when the composition occurs\n const rightHandFilter = rightHandFilterBuilder.build()\n\n return rightHandFilter\n ? this.clone(leftHandRightHandFiltersCombiner(leftHandFilter, rightHandFilter), rightHandFilterBuilder.composer)\n : rightHandFilterBuilder //Can this happen ?\n }\n )\n : this\n }\n\n private makeEagerLeftRightFilterBuilder(\n rightHandFilterBuilderFactory: (it: FilterBuilder<T>) => FilterBuilder<T>,\n leftHandRightHandFiltersCombiner: (leftHandFilter: AbstractFilter<T>, rightHandFilter: AbstractFilter<T>) => () => AbstractFilter<T>\n ) {\n const rightHandFilterBuilder = rightHandFilterBuilderFactory(this)\n return this.filterProvider ? this.clone(leftHandRightHandFiltersCombiner(this.build(), rightHandFilterBuilder.build())) : this\n }\n}\n\nclass PatientFilterBuilder extends FilterBuilder<Patient> {\n hcpId?: string\n\n constructor(\n filterProvider?: () => AbstractFilter<Patient>,\n hcpId?: string,\n composer?: (thisFilterBuilder: FilterBuilder<Patient>, otherFilterBuilder: FilterBuilder<Patient>) => FilterBuilder<Patient>\n ) {\n super(filterProvider, composer)\n this.hcpId = hcpId\n }\n\n clone(\n filterProvider?: () => AbstractFilter<Patient>,\n composer?: (thisFilterBuilder: FilterBuilder<Patient>, otherFilterBuilder: FilterBuilder<Patient>) => FilterBuilder<Patient>\n ): FilterBuilder<Patient> {\n return new PatientFilterBuilder(filterProvider, this.hcpId, composer)\n }\n\n listOf(elements: Patient[]): PatientFilterBuilder {\n return new PatientFilterBuilder(() => new ConstantFilter<Patient>(elements) as AbstractFilter<Patient>)\n }\n\n and(filterBuilderFactory?: (it: PatientFilterBuilder) => PatientFilterBuilder): PatientFilterBuilder {\n return super.and(filterBuilderFactory as any) as PatientFilterBuilder\n }\n\n or(filterBuilderFactory?: (it: PatientFilterBuilder) => PatientFilterBuilder): PatientFilterBuilder {\n return super.or(filterBuilderFactory as any) as PatientFilterBuilder\n }\n\n minus(filterBuilderFactory?: (it: PatientFilterBuilder) => PatientFilterBuilder): PatientFilterBuilder {\n return super.minus(filterBuilderFactory as any) as PatientFilterBuilder\n }\n\n forHcp(hcpId: string): PatientFilterBuilder {\n return this.composer(this, new PatientFilterBuilder(this.filterProvider, hcpId)) as PatientFilterBuilder\n }\n\n all(): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyFilter({ healthcarePartyId: this.hcpId }), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n activePatients(): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyAndActiveFilter({healthcarePartyId: this.hcpId, active: true}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n inactivePatients(): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyAndActiveFilter({healthcarePartyId: this.hcpId, active: false}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n byAddress(searchString?: string, postalCode?: string, houseNumber?: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyAndAddressFilter({\n healthcarePartyId: this.hcpId,\n searchString,\n postalCode,\n houseNumber,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n withExternalId(externalId: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyAndExternalIdFilter({\n healthcarePartyId: this.hcpId,\n externalId: externalId,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n withSsins(ssins: string[]): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(() => new PatientByHcPartyAndSsinsFilter({healthcarePartyId: this.hcpId, ssins: ssins}), this.hcpId)\n ) as PatientFilterBuilder\n }\n\n withDateOfBirthBetween(from?: number, to?: number): PatientFilterBuilder {\n return this.composer(\n this,\n this.clone(\n () =>\n new PatientByHcPartyDateOfBirthBetweenFilter({\n healthcarePartyId: this.hcpId,\n minDateOfBirth: from,\n maxDateOfBirth: to,\n })\n )\n ) as PatientFilterBuilder\n }\n\n byDateOfBirth(dateOfBirth: number): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyDateOfBirthFilter({\n healthcarePartyId: this.hcpId,\n dateOfBirth: dateOfBirth,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n olderThan(age: number): PatientFilterBuilder {\n return this.withDateOfBirthBetween(10000101, parseInt(format(add(new Date(), {years: -age}), 'yyyyMMdd')))\n }\n\n youngerThan(age: number): PatientFilterBuilder {\n return this.withDateOfBirthBetween(parseInt(format(add(new Date(), {years: -age}), 'yyyyMMdd')), 99991231)\n }\n\n byGenderEducationProfession(gender?: GenderEnum, education?: string, profession?: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyGenderEducationProfessionFilter({\n healthcarePartyId: this.hcpId,\n gender: gender,\n education: education,\n profession: profession,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n byIds(ids: string[]): PatientFilterBuilder {\n return this.composer(this, new PatientFilterBuilder(() => new PatientByIdsFilter({ids: ids}), this.hcpId)) as PatientFilterBuilder\n }\n\n searchByName(name: string): PatientFilterBuilder {\n return this.composer(\n this,\n new PatientFilterBuilder(\n () =>\n new PatientByHcPartyNameContainsFuzzyFilter({\n healthcarePartyId: this.hcpId,\n searchString: name,\n }),\n this.hcpId\n )\n ) as PatientFilterBuilder\n }\n\n build(): AbstractFilter<Patient> {\n return this.filterProvider?.() || this.all().build()\n }\n}\n"]}
|
|
@@ -4,7 +4,13 @@ import * as models from '../icc-api/model/models';
|
|
|
4
4
|
import { AccessLog, PaginatedListAccessLog } from '../icc-api/model/models';
|
|
5
5
|
import { IccDataOwnerXApi } from './icc-data-owner-x-api';
|
|
6
6
|
import { AuthenticationProvider } from './auth/AuthenticationProvider';
|
|
7
|
+
import { SecureDelegation } from '../icc-api/model/SecureDelegation';
|
|
8
|
+
import AccessLevelEnum = SecureDelegation.AccessLevelEnum;
|
|
7
9
|
import { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour';
|
|
10
|
+
import { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest';
|
|
11
|
+
import RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum;
|
|
12
|
+
import { ShareResult } from './utils/ShareResult';
|
|
13
|
+
import { XHR } from '../icc-api/api/XHR';
|
|
8
14
|
import { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi';
|
|
9
15
|
export interface AccessLogWithPatientId extends AccessLog {
|
|
10
16
|
patientId: string;
|
|
@@ -13,6 +19,7 @@ export declare class IccAccesslogXApi extends IccAccesslogApi implements Encrypt
|
|
|
13
19
|
private readonly encryptedFields;
|
|
14
20
|
crypto: IccCryptoXApi;
|
|
15
21
|
dataOwnerApi: IccDataOwnerXApi;
|
|
22
|
+
get headers(): Promise<Array<XHR.Header>>;
|
|
16
23
|
constructor(host: string, headers: {
|
|
17
24
|
[key: string]: string;
|
|
18
25
|
}, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, cryptedKeys?: string[], authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
|
|
@@ -25,15 +32,14 @@ export declare class IccAccesslogXApi extends IccAccesslogApi implements Encrypt
|
|
|
25
32
|
* @param options optional parameters:
|
|
26
33
|
* - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
|
|
27
34
|
* 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
|
|
28
|
-
* auto-delegations, in such case the access level specified here will be used.
|
|
29
|
-
* access will be possible.
|
|
35
|
+
* auto-delegations, in such case the access level specified here will be used.
|
|
30
36
|
* - 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
|
|
31
37
|
* secret id of patient known by the topmost parent in the current data owner hierarchy.
|
|
32
38
|
* @return a new instance of access log.
|
|
33
39
|
*/
|
|
34
40
|
newInstance(user: models.User, patient: models.Patient, h: any, options?: {
|
|
35
41
|
additionalDelegates?: {
|
|
36
|
-
[dataOwnerId: string]:
|
|
42
|
+
[dataOwnerId: string]: AccessLevelEnum;
|
|
37
43
|
};
|
|
38
44
|
preferredSfk?: string;
|
|
39
45
|
}): Promise<models.AccessLog>;
|
|
@@ -78,9 +84,13 @@ export declare class IccAccesslogXApi extends IccAccesslogApi implements Encrypt
|
|
|
78
84
|
* there should only be one element in the returned array, but in case of entity merges there could be multiple values.
|
|
79
85
|
*/
|
|
80
86
|
decryptPatientIdOf(accessLog: AccessLog): Promise<string[]>;
|
|
87
|
+
/**
|
|
88
|
+
* @return if the logged data owner has write access to the content of the given access log
|
|
89
|
+
*/
|
|
90
|
+
hasWriteAccess(accessLog: AccessLog): Promise<boolean>;
|
|
81
91
|
/**
|
|
82
92
|
* 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
|
|
83
|
-
* encrypted content.
|
|
93
|
+
* encrypted content, with read-only or read-write permissions.
|
|
84
94
|
* @param delegateId the id of the data owner which will be granted access to the access log.
|
|
85
95
|
* @param accessLog the access log to share.
|
|
86
96
|
* @param options optional parameters to customize the sharing behaviour:
|
|
@@ -89,35 +99,60 @@ export declare class IccAccesslogXApi extends IccAccesslogApi implements Encrypt
|
|
|
89
99
|
* - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would
|
|
90
100
|
* 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
|
|
91
101
|
* encrypted data of the access log (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
92
|
-
*
|
|
102
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
103
|
+
* @return the updated entity
|
|
93
104
|
*/
|
|
94
105
|
shareWith(delegateId: string, accessLog: AccessLog, options?: {
|
|
106
|
+
requestedPermissions?: RequestedPermissionEnum;
|
|
95
107
|
shareEncryptionKey?: ShareMetadataBehaviour;
|
|
96
108
|
sharePatientId?: ShareMetadataBehaviour;
|
|
97
109
|
}): Promise<AccessLog>;
|
|
98
110
|
/**
|
|
99
111
|
* 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
|
|
100
|
-
* encrypted content.
|
|
112
|
+
* encrypted content, with read-only or read-write permissions.
|
|
101
113
|
* @param accessLog the access log to share.
|
|
102
|
-
* @param delegates
|
|
114
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
103
115
|
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
104
116
|
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
105
117
|
* - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would
|
|
106
118
|
* 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
|
|
107
119
|
* encrypted data of the access log (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
108
|
-
*
|
|
120
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
121
|
+
* @return the updated entity
|
|
109
122
|
*/
|
|
110
123
|
shareWithMany(accessLog: AccessLog, delegates: {
|
|
111
124
|
[delegateId: string]: {
|
|
125
|
+
requestedPermissions?: RequestedPermissionEnum;
|
|
112
126
|
shareEncryptionKey?: ShareMetadataBehaviour;
|
|
113
127
|
sharePatientId?: ShareMetadataBehaviour;
|
|
114
128
|
};
|
|
115
129
|
}): Promise<AccessLog>;
|
|
116
|
-
|
|
130
|
+
/**
|
|
131
|
+
* 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
|
|
132
|
+
* encrypted content, with read-only or read-write permissions.
|
|
133
|
+
* @param accessLog the access log to share.
|
|
134
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
135
|
+
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
136
|
+
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
137
|
+
* - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would
|
|
138
|
+
* 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
|
|
139
|
+
* encrypted data of the access log (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
140
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
141
|
+
* @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
|
|
142
|
+
* the operation failed.
|
|
143
|
+
*/
|
|
144
|
+
tryShareWithMany(accessLog: AccessLog, delegates: {
|
|
145
|
+
[delegateId: string]: {
|
|
146
|
+
requestedPermissions?: RequestedPermissionEnum;
|
|
147
|
+
shareEncryptionKey?: ShareMetadataBehaviour;
|
|
148
|
+
sharePatientId?: ShareMetadataBehaviour;
|
|
149
|
+
};
|
|
150
|
+
}): Promise<ShareResult<AccessLog>>;
|
|
151
|
+
getDataOwnersWithAccessTo(entity: AccessLog): Promise<{
|
|
117
152
|
permissionsByDataOwnerId: {
|
|
118
|
-
[
|
|
153
|
+
[p: string]: AccessLevelEnum;
|
|
119
154
|
};
|
|
120
155
|
hasUnknownAnonymousDataOwners: boolean;
|
|
121
156
|
}>;
|
|
122
|
-
getEncryptionKeysOf(entity:
|
|
157
|
+
getEncryptionKeysOf(entity: AccessLog): Promise<string[]>;
|
|
123
158
|
}
|
|
@@ -14,8 +14,13 @@ const icc_api_1 = require("../icc-api");
|
|
|
14
14
|
const models_1 = require("../icc-api/model/models");
|
|
15
15
|
const _ = require("lodash");
|
|
16
16
|
const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
|
|
17
|
+
const SecureDelegation_1 = require("../icc-api/model/SecureDelegation");
|
|
18
|
+
var AccessLevelEnum = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
|
|
17
19
|
const utils_1 = require("./utils");
|
|
18
20
|
class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
21
|
+
get headers() {
|
|
22
|
+
return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, 'AccessLog'));
|
|
23
|
+
}
|
|
19
24
|
constructor(host, headers, crypto, dataOwnerApi, cryptedKeys = ['detail', 'objectId'], authenticationProvider = new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl = typeof window !== 'undefined'
|
|
20
25
|
? window.fetch
|
|
21
26
|
: typeof self !== 'undefined'
|
|
@@ -35,8 +40,7 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
35
40
|
* @param options optional parameters:
|
|
36
41
|
* - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
|
|
37
42
|
* 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
|
|
38
|
-
* auto-delegations, in such case the access level specified here will be used.
|
|
39
|
-
* access will be possible.
|
|
43
|
+
* auto-delegations, in such case the access level specified here will be used.
|
|
40
44
|
* - 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
|
|
41
45
|
* secret id of patient known by the topmost parent in the current data owner hierarchy.
|
|
42
46
|
* @return a new instance of access log.
|
|
@@ -49,16 +53,12 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
49
53
|
const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
50
54
|
if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
|
|
51
55
|
throw new Error('Can only initialise entities as current data owner.');
|
|
52
|
-
const sfk = (_m = options.preferredSfk) !== null && _m !== void 0 ? _m : (yield this.crypto.confidential.getAnySecretIdSharedWithParents(patient));
|
|
56
|
+
const sfk = (_m = options.preferredSfk) !== null && _m !== void 0 ? _m : (yield this.crypto.confidential.getAnySecretIdSharedWithParents({ entity: patient, type: 'Patient' }));
|
|
53
57
|
if (!sfk)
|
|
54
58
|
throw new Error(`Couldn't find any sfk of parent patient ${patient.id}`);
|
|
55
|
-
const extraDelegations = [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
...((_s = (_r = user.autoDelegations) === null || _r === void 0 ? void 0 : _r.administrativeData) !== null && _s !== void 0 ? _s : []),
|
|
59
|
-
];
|
|
60
|
-
return new models_1.AccessLog(yield this.crypto.entities
|
|
61
|
-
.entityWithInitialisedEncryptedMetadata(accessLog, patient.id, sfk, true, extraDelegations)
|
|
59
|
+
const extraDelegations = Object.assign(Object.assign({}, Object.fromEntries([...((_p = (_o = user.autoDelegations) === null || _o === void 0 ? void 0 : _o.all) !== null && _p !== void 0 ? _p : []), ...((_r = (_q = user.autoDelegations) === null || _q === void 0 ? void 0 : _q.administrativeData) !== null && _r !== void 0 ? _r : [])].map((x) => [x, AccessLevelEnum.WRITE]))), ((_s = options.additionalDelegates) !== null && _s !== void 0 ? _s : {}));
|
|
60
|
+
return new models_1.AccessLog(yield this.crypto.xapi
|
|
61
|
+
.entityWithInitialisedEncryptedMetadata(accessLog, 'AccessLog', patient.id, sfk, true, false, extraDelegations)
|
|
62
62
|
.then((x) => x.updatedEntity));
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -82,12 +82,12 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
82
82
|
*/
|
|
83
83
|
findBy(hcpartyId, patient, usingPost = false) {
|
|
84
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
const extractedKeys = yield this.crypto.
|
|
85
|
+
const extractedKeys = yield this.crypto.xapi.secretIdsOf({ entity: patient, type: 'Patient' }, hcpartyId);
|
|
86
86
|
const topmostParentId = (yield this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0];
|
|
87
87
|
return extractedKeys && extractedKeys.length > 0
|
|
88
88
|
? usingPost
|
|
89
|
-
? this.findByHCPartyPatientSecretFKeysArray(
|
|
90
|
-
: this.findByHCPartyPatientSecretFKeys(
|
|
89
|
+
? this.findByHCPartyPatientSecretFKeysArray(hcpartyId, _.uniq(extractedKeys))
|
|
90
|
+
: this.findByHCPartyPatientSecretFKeys(hcpartyId, _.uniq(extractedKeys).join(','))
|
|
91
91
|
: Promise.resolve([]);
|
|
92
92
|
});
|
|
93
93
|
}
|
|
@@ -104,13 +104,14 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
104
104
|
return super.findAccessLogsByHCPartyPatientForeignKeysUsingPost(hcPartyId, secretFKeys).then((accesslogs) => this.decrypt(hcPartyId, accesslogs));
|
|
105
105
|
}
|
|
106
106
|
decrypt(hcpId, accessLogs) {
|
|
107
|
-
return Promise.all(accessLogs.map((x) => this.crypto.
|
|
107
|
+
return Promise.all(accessLogs.map((x) => this.crypto.xapi.decryptEntity(x, 'AccessLog', (json) => new models_1.AccessLog(json)).then(({ entity }) => entity)));
|
|
108
108
|
}
|
|
109
109
|
encrypt(user, accessLogs) {
|
|
110
|
-
|
|
110
|
+
const owner = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
111
|
+
return this.encryptAs(owner, accessLogs);
|
|
111
112
|
}
|
|
112
113
|
encryptAs(dataOwner, accessLogs) {
|
|
113
|
-
return Promise.all(accessLogs.map((x) => this.crypto.
|
|
114
|
+
return Promise.all(accessLogs.map((x) => this.crypto.xapi.tryEncryptEntity(x, 'AccessLog', this.encryptedFields, false, false, (json) => new models_1.AccessLog(json))));
|
|
114
115
|
}
|
|
115
116
|
createAccessLog(body) {
|
|
116
117
|
throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption');
|
|
@@ -148,11 +149,16 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
148
149
|
return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user), _.cloneDeep(body)) : null;
|
|
149
150
|
});
|
|
150
151
|
}
|
|
151
|
-
modifyAs(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
modifyAs(owner, body) {
|
|
153
|
+
const _super = Object.create(null, {
|
|
154
|
+
modifyAccessLog: { get: () => super.modifyAccessLog }
|
|
155
|
+
});
|
|
156
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
return this.encryptAs(owner, [_.cloneDeep(body)])
|
|
158
|
+
.then((als) => _super.modifyAccessLog.call(this, als[0]))
|
|
159
|
+
.then((accessLog) => this.decrypt(owner, [accessLog]))
|
|
160
|
+
.then((als) => als[0]);
|
|
161
|
+
});
|
|
156
162
|
}
|
|
157
163
|
findByUserAfterDate(userId, accessType, startDate, startKey, startDocumentId, limit, descending) {
|
|
158
164
|
throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption');
|
|
@@ -174,7 +180,7 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
174
180
|
const currentLimit = limit - foundAccessLogs.length;
|
|
175
181
|
const { rows: logs, nextKeyPair: newNextKeyPair } = (yield _super.findByUserAfterDate.call(this, userId, 'USER_ACCESS', startDate, nextKeyPair && JSON.stringify(nextKeyPair.startKey), nextKeyPair && nextKeyPair.startKeyDocId, numberRequestedAccessLogs, true));
|
|
176
182
|
const logsWithPatientId = yield this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user), logs).then((decryptedLogs) => Promise.all(_.map(decryptedLogs, (decryptedLog) => {
|
|
177
|
-
return this.crypto.
|
|
183
|
+
return this.crypto.xapi.owningEntityIdsOf({ entity: decryptedLog, type: 'AccessLog' }, user.healthcarePartyId).then((keys) => (Object.assign(Object.assign({}, decryptedLog), { patientId: _.head(keys) })));
|
|
178
184
|
})));
|
|
179
185
|
const uniqueLogs = _.chain(logsWithPatientId)
|
|
180
186
|
.reject((log) => _.some(foundAccessLogs, ({ patientId }) => patientId === log.patientId))
|
|
@@ -202,12 +208,20 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
202
208
|
*/
|
|
203
209
|
decryptPatientIdOf(accessLog) {
|
|
204
210
|
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
-
return this.crypto.
|
|
211
|
+
return this.crypto.xapi.owningEntityIdsOf({ entity: accessLog, type: 'AccessLog' }, undefined);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* @return if the logged data owner has write access to the content of the given access log
|
|
216
|
+
*/
|
|
217
|
+
hasWriteAccess(accessLog) {
|
|
218
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
+
return this.crypto.xapi.hasWriteAccess({ entity: accessLog, type: 'AccessLog' });
|
|
206
220
|
});
|
|
207
221
|
}
|
|
208
222
|
/**
|
|
209
223
|
* 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
|
|
210
|
-
* encrypted content.
|
|
224
|
+
* encrypted content, with read-only or read-write permissions.
|
|
211
225
|
* @param delegateId the id of the data owner which will be granted access to the access log.
|
|
212
226
|
* @param accessLog the access log to share.
|
|
213
227
|
* @param options optional parameters to customize the sharing behaviour:
|
|
@@ -216,7 +230,8 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
216
230
|
* - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would
|
|
217
231
|
* 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
|
|
218
232
|
* encrypted data of the access log (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
219
|
-
*
|
|
233
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
234
|
+
* @return the updated entity
|
|
220
235
|
*/
|
|
221
236
|
shareWith(delegateId, accessLog, options = {}) {
|
|
222
237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -225,42 +240,60 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
225
240
|
}
|
|
226
241
|
/**
|
|
227
242
|
* 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
|
|
228
|
-
* encrypted content.
|
|
243
|
+
* encrypted content, with read-only or read-write permissions.
|
|
229
244
|
* @param accessLog the access log to share.
|
|
230
|
-
* @param delegates
|
|
245
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
231
246
|
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
232
247
|
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
233
248
|
* - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would
|
|
234
249
|
* 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
|
|
235
250
|
* encrypted data of the access log (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
236
|
-
*
|
|
251
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
252
|
+
* @return the updated entity
|
|
237
253
|
*/
|
|
238
254
|
shareWithMany(accessLog, delegates) {
|
|
255
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
256
|
+
return (yield this.tryShareWithMany(accessLog, delegates)).updatedEntityOrThrow;
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* 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
|
|
261
|
+
* encrypted content, with read-only or read-write permissions.
|
|
262
|
+
* @param accessLog the access log to share.
|
|
263
|
+
* @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
|
|
264
|
+
* - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
|
|
265
|
+
* content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
266
|
+
* - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would
|
|
267
|
+
* 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
|
|
268
|
+
* encrypted data of the access log (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
|
|
269
|
+
* - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
|
|
270
|
+
* @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
|
|
271
|
+
* the operation failed.
|
|
272
|
+
*/
|
|
273
|
+
tryShareWithMany(accessLog, delegates) {
|
|
239
274
|
return __awaiter(this, void 0, void 0, function* () {
|
|
240
275
|
const self = yield this.dataOwnerApi.getCurrentDataOwnerId();
|
|
241
|
-
|
|
276
|
+
// All entities should have an encryption key.
|
|
277
|
+
const entityWithEncryptionKey = yield this.crypto.xapi.ensureEncryptionKeysInitialised(accessLog, 'AccessLog');
|
|
278
|
+
const updatedEntity = entityWithEncryptionKey ? yield this.modifyAs(self, entityWithEncryptionKey) : accessLog;
|
|
279
|
+
return this.crypto.xapi
|
|
280
|
+
.simpleShareOrUpdateEncryptedEntityMetadata({ entity: updatedEntity, type: 'AccessLog' }, true, Object.fromEntries(Object.entries(delegates).map(([delegateId, options]) => [
|
|
242
281
|
delegateId,
|
|
243
282
|
{
|
|
244
|
-
|
|
283
|
+
requestedPermissions: options.requestedPermissions,
|
|
284
|
+
shareEncryptionKeys: options.shareEncryptionKey,
|
|
245
285
|
shareOwningEntityIds: options.sharePatientId,
|
|
286
|
+
shareSecretIds: undefined,
|
|
246
287
|
},
|
|
247
|
-
])))
|
|
248
|
-
|
|
249
|
-
return yield this.modifyAs(self, extended);
|
|
250
|
-
}
|
|
251
|
-
else
|
|
252
|
-
return accessLog;
|
|
288
|
+
])), (x) => this.bulkShareAccessLogs(x))
|
|
289
|
+
.then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])));
|
|
253
290
|
});
|
|
254
291
|
}
|
|
255
292
|
getDataOwnersWithAccessTo(entity) {
|
|
256
|
-
return
|
|
257
|
-
return yield this.crypto.entities.getDataOwnersWithAccessTo(entity);
|
|
258
|
-
});
|
|
293
|
+
return this.crypto.xapi.getDataOwnersWithAccessTo({ entity, type: 'AccessLog' });
|
|
259
294
|
}
|
|
260
295
|
getEncryptionKeysOf(entity) {
|
|
261
|
-
return
|
|
262
|
-
return yield this.crypto.entities.encryptionKeysOf(entity);
|
|
263
|
-
});
|
|
296
|
+
return this.crypto.xapi.encryptionKeysOf({ entity, type: 'AccessLog' }, undefined);
|
|
264
297
|
}
|
|
265
298
|
}
|
|
266
299
|
exports.IccAccesslogXApi = IccAccesslogXApi;
|