@icure/api 8.11.0 → 8.12.0
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/IccUserApi.d.ts +1 -1
- package/icc-api/api/IccUserApi.js +2 -2
- package/icc-api/api/IccUserApi.js.map +1 -1
- package/icc-api/model/HealthElement.d.ts +5 -0
- package/icc-api/model/HealthElement.js.map +1 -1
- package/icc-api/model/HealthElementQualifiedLink.d.ts +31 -0
- package/icc-api/model/HealthElementQualifiedLink.js +26 -0
- package/icc-api/model/HealthElementQualifiedLink.js.map +1 -0
- package/icc-api/model/models.d.ts +1 -0
- package/icc-api/model/models.js +1 -0
- package/icc-api/model/models.js.map +1 -1
- package/icc-x-api/filters/HealthElementByAssociationIdFilter.d.ts +23 -0
- package/icc-x-api/filters/HealthElementByAssociationIdFilter.js +30 -0
- package/icc-x-api/filters/HealthElementByAssociationIdFilter.js.map +1 -0
- package/icc-x-api/filters/HealthElementByQualifiedLinkFilter.d.ts +24 -0
- package/icc-x-api/filters/HealthElementByQualifiedLinkFilter.js +30 -0
- package/icc-x-api/filters/HealthElementByQualifiedLinkFilter.js.map +1 -0
- package/icc-x-api/filters/filters.d.ts +2 -0
- package/icc-x-api/filters/filters.js +2 -0
- package/icc-x-api/filters/filters.js.map +1 -1
- package/package.json +1 -1
- package/test/benchmarks/lzma-benchmark.spec.d.ts +0 -1
- package/test/benchmarks/lzma-benchmark.spec.js +0 -131
- package/test/benchmarks/lzma-benchmark.spec.js.map +0 -1
- package/test/benchmarks/lzma-compat.spec.d.ts +0 -1
- package/test/benchmarks/lzma-compat.spec.js +0 -187
- package/test/benchmarks/lzma-compat.spec.js.map +0 -1
- package/test/benchmarks/playwright.config.d.ts +0 -2
- package/test/benchmarks/playwright.config.js +0 -18
- package/test/benchmarks/playwright.config.js.map +0 -1
- package/test/icc-api/api/IccAgendaApi.d.ts +0 -1
- package/test/icc-api/api/IccAgendaApi.js +0 -64
- package/test/icc-api/api/IccAgendaApi.js.map +0 -1
- package/test/icc-api/api/IccAnonymousAccessApi.d.ts +0 -1
- package/test/icc-api/api/IccAnonymousAccessApi.js +0 -58
- package/test/icc-api/api/IccAnonymousAccessApi.js.map +0 -1
- package/test/icc-api/api/IccCalendarItemApi.d.ts +0 -1
- package/test/icc-api/api/IccCalendarItemApi.js +0 -67
- package/test/icc-api/api/IccCalendarItemApi.js.map +0 -1
- package/test/icc-api/api/IccCalendarItemTypeApi.d.ts +0 -1
- package/test/icc-api/api/IccCalendarItemTypeApi.js +0 -96
- package/test/icc-api/api/IccCalendarItemTypeApi.js.map +0 -1
- package/test/icc-api/api/IccCodeApi.d.ts +0 -1
- package/test/icc-api/api/IccCodeApi.js +0 -38
- package/test/icc-api/api/IccCodeApi.js.map +0 -1
- package/test/icc-api/api/IccDocumentApi.d.ts +0 -1
- package/test/icc-api/api/IccDocumentApi.js +0 -199
- package/test/icc-api/api/IccDocumentApi.js.map +0 -1
- package/test/icc-api/api/IccGroupApi.d.ts +0 -1
- package/test/icc-api/api/IccGroupApi.js +0 -50
- package/test/icc-api/api/IccGroupApi.js.map +0 -1
- package/test/icc-api/api/IccKeywordApi.d.ts +0 -1
- package/test/icc-api/api/IccKeywordApi.js +0 -64
- package/test/icc-api/api/IccKeywordApi.js.map +0 -1
- package/test/icc-api/api/IccMedicalLocationApi.d.ts +0 -1
- package/test/icc-api/api/IccMedicalLocationApi.js +0 -64
- package/test/icc-api/api/IccMedicalLocationApi.js.map +0 -1
- package/test/icc-api/api/IccPlaceApi.d.ts +0 -1
- package/test/icc-api/api/IccPlaceApi.js +0 -64
- package/test/icc-api/api/IccPlaceApi.js.map +0 -1
- package/test/icc-api/api/IccRecoveryDataApi.d.ts +0 -1
- package/test/icc-api/api/IccRecoveryDataApi.js +0 -95
- package/test/icc-api/api/IccRecoveryDataApi.js.map +0 -1
- package/test/icc-api/api/IccRoleApi.d.ts +0 -1
- package/test/icc-api/api/IccRoleApi.js +0 -34
- package/test/icc-api/api/IccRoleApi.js.map +0 -1
- package/test/icc-api/api/IccUserApi.d.ts +0 -1
- package/test/icc-api/api/IccUserApi.js +0 -96
- package/test/icc-api/api/IccUserApi.js.map +0 -1
- package/test/icc-api/e2e/IccCalendarItemApi.d.ts +0 -1
- package/test/icc-api/e2e/IccCalendarItemApi.js +0 -46
- package/test/icc-api/e2e/IccCalendarItemApi.js.map +0 -1
- package/test/icc-api/model/modelHelpersTest.d.ts +0 -1
- package/test/icc-api/model/modelHelpersTest.js +0 -45
- package/test/icc-api/model/modelHelpersTest.js.map +0 -1
- package/test/icc-x-api/auth/group-switch-test.d.ts +0 -1
- package/test/icc-x-api/auth/group-switch-test.js +0 -81
- package/test/icc-x-api/auth/group-switch-test.js.map +0 -1
- package/test/icc-x-api/auth/jwt-concurrency-test.d.ts +0 -2
- package/test/icc-x-api/auth/jwt-concurrency-test.js +0 -112
- package/test/icc-x-api/auth/jwt-concurrency-test.js.map +0 -1
- package/test/icc-x-api/auth/jwt-provider-test.d.ts +0 -1
- package/test/icc-x-api/auth/jwt-provider-test.js +0 -197
- package/test/icc-x-api/auth/jwt-provider-test.js.map +0 -1
- package/test/icc-x-api/auth/smart-auth-provider-test.d.ts +0 -1
- package/test/icc-x-api/auth/smart-auth-provider-test.js +0 -224
- package/test/icc-x-api/auth/smart-auth-provider-test.js.map +0 -1
- package/test/icc-x-api/autofix-anonymity-test.d.ts +0 -1
- package/test/icc-x-api/autofix-anonymity-test.js +0 -122
- package/test/icc-x-api/autofix-anonymity-test.js.map +0 -1
- package/test/icc-x-api/confidential-entities-test.d.ts +0 -1
- package/test/icc-x-api/confidential-entities-test.js +0 -168
- package/test/icc-x-api/confidential-entities-test.js.map +0 -1
- package/test/icc-x-api/crud/comprehensive-crud-test.d.ts +0 -1
- package/test/icc-x-api/crud/comprehensive-crud-test.js +0 -276
- package/test/icc-x-api/crud/comprehensive-crud-test.js.map +0 -1
- package/test/icc-x-api/crud/entities-crud-test-interface.d.ts +0 -16
- package/test/icc-x-api/crud/entities-crud-test-interface.js +0 -407
- package/test/icc-x-api/crud/entities-crud-test-interface.js.map +0 -1
- package/test/icc-x-api/crypto/anonymous-delegations-test.d.ts +0 -1
- package/test/icc-x-api/crypto/anonymous-delegations-test.js +0 -587
- package/test/icc-x-api/crypto/anonymous-delegations-test.js.map +0 -1
- package/test/icc-x-api/crypto/concurrency.d.ts +0 -1
- package/test/icc-x-api/crypto/concurrency.js +0 -35
- package/test/icc-x-api/crypto/concurrency.js.map +0 -1
- package/test/icc-x-api/crypto/crypto-utils.d.ts +0 -1
- package/test/icc-x-api/crypto/crypto-utils.js +0 -79
- package/test/icc-x-api/crypto/crypto-utils.js.map +0 -1
- package/test/icc-x-api/crypto/cryptoTest.d.ts +0 -2
- package/test/icc-x-api/crypto/cryptoTest.js +0 -402
- package/test/icc-x-api/crypto/cryptoTest.js.map +0 -1
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.d.ts +0 -1
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js +0 -166
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js.map +0 -1
- package/test/icc-x-api/crypto/exchange-data-manager-test.d.ts +0 -1
- package/test/icc-x-api/crypto/exchange-data-manager-test.js +0 -674
- package/test/icc-x-api/crypto/exchange-data-manager-test.js.map +0 -1
- package/test/icc-x-api/crypto/full-crypto-test.d.ts +0 -1
- package/test/icc-x-api/crypto/full-crypto-test.js +0 -454
- package/test/icc-x-api/crypto/full-crypto-test.js.map +0 -1
- package/test/icc-x-api/crypto/legacy-metadata-migration-test.d.ts +0 -1
- package/test/icc-x-api/crypto/legacy-metadata-migration-test.js +0 -379
- package/test/icc-x-api/crypto/legacy-metadata-migration-test.js.map +0 -1
- package/test/icc-x-api/crypto/secure-delegations-manager-test.d.ts +0 -1
- package/test/icc-x-api/crypto/secure-delegations-manager-test.js +0 -278
- package/test/icc-x-api/crypto/secure-delegations-manager-test.js.map +0 -1
- package/test/icc-x-api/crypto/shamir.d.ts +0 -2
- package/test/icc-x-api/crypto/shamir.js +0 -167
- package/test/icc-x-api/crypto/shamir.js.map +0 -1
- package/test/icc-x-api/crypto/share-deduplication-test.d.ts +0 -1
- package/test/icc-x-api/crypto/share-deduplication-test.js +0 -250
- package/test/icc-x-api/crypto/share-deduplication-test.js.map +0 -1
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.d.ts +0 -1
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js +0 -71
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js.map +0 -1
- package/test/icc-x-api/crypto/soft-deleted-data-owners.d.ts +0 -2
- package/test/icc-x-api/crypto/soft-deleted-data-owners.js +0 -113
- package/test/icc-x-api/crypto/soft-deleted-data-owners.js.map +0 -1
- package/test/icc-x-api/crypto/user-encryption-keys-manager-test.d.ts +0 -1
- package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js +0 -246
- package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js.map +0 -1
- package/test/icc-x-api/entity-with-attachments-api-test.d.ts +0 -1
- package/test/icc-x-api/entity-with-attachments-api-test.js +0 -142
- package/test/icc-x-api/entity-with-attachments-api-test.js.map +0 -1
- package/test/icc-x-api/filters/filters.d.ts +0 -1
- package/test/icc-x-api/filters/filters.js +0 -49
- package/test/icc-x-api/filters/filters.js.map +0 -1
- package/test/icc-x-api/filters/healthelement.d.ts +0 -1
- package/test/icc-x-api/filters/healthelement.js +0 -333
- package/test/icc-x-api/filters/healthelement.js.map +0 -1
- package/test/icc-x-api/icc-accesslog-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-accesslog-x-api.js +0 -106
- package/test/icc-x-api/icc-accesslog-x-api.js.map +0 -1
- package/test/icc-x-api/icc-application-settings-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-application-settings-x-api.js +0 -91
- package/test/icc-x-api/icc-application-settings-x-api.js.map +0 -1
- package/test/icc-x-api/icc-auth-api.d.ts +0 -1
- package/test/icc-x-api/icc-auth-api.js +0 -47
- package/test/icc-x-api/icc-auth-api.js.map +0 -1
- package/test/icc-x-api/icc-calendar-item-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-calendar-item-x-api.js +0 -150
- package/test/icc-x-api/icc-calendar-item-x-api.js.map +0 -1
- package/test/icc-x-api/icc-code-x-api-test.d.ts +0 -1
- package/test/icc-x-api/icc-code-x-api-test.js +0 -74
- package/test/icc-x-api/icc-code-x-api-test.js.map +0 -1
- package/test/icc-x-api/icc-contact-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-contact-x-api.js +0 -355
- package/test/icc-x-api/icc-contact-x-api.js.map +0 -1
- package/test/icc-x-api/icc-document-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-document-x-api.js +0 -76
- package/test/icc-x-api/icc-document-x-api.js.map +0 -1
- package/test/icc-x-api/icc-form-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-form-x-api.js +0 -413
- package/test/icc-x-api/icc-form-x-api.js.map +0 -1
- package/test/icc-x-api/icc-hcparty-x-api-test.d.ts +0 -1
- package/test/icc-x-api/icc-hcparty-x-api-test.js +0 -43
- package/test/icc-x-api/icc-hcparty-x-api-test.js.map +0 -1
- package/test/icc-x-api/icc-helement-x-api-test.d.ts +0 -1
- package/test/icc-x-api/icc-helement-x-api-test.js +0 -155
- package/test/icc-x-api/icc-helement-x-api-test.js.map +0 -1
- package/test/icc-x-api/icc-invoice-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-invoice-x-api.js +0 -99
- package/test/icc-x-api/icc-invoice-x-api.js.map +0 -1
- package/test/icc-x-api/icc-maintenance-task-x-api-test.d.ts +0 -1
- package/test/icc-x-api/icc-maintenance-task-x-api-test.js +0 -222
- package/test/icc-x-api/icc-maintenance-task-x-api-test.js.map +0 -1
- package/test/icc-x-api/icc-message-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-message-x-api.js +0 -54
- package/test/icc-x-api/icc-message-x-api.js.map +0 -1
- package/test/icc-x-api/icc-patient-x-api-test.d.ts +0 -1
- package/test/icc-x-api/icc-patient-x-api-test.js +0 -209
- package/test/icc-x-api/icc-patient-x-api-test.js.map +0 -1
- package/test/icc-x-api/icc-recovery-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-recovery-x-api.js +0 -175
- package/test/icc-x-api/icc-recovery-x-api.js.map +0 -1
- package/test/icc-x-api/icc-topic-x-api.d.ts +0 -1
- package/test/icc-x-api/icc-topic-x-api.js +0 -269
- package/test/icc-x-api/icc-topic-x-api.js.map +0 -1
- package/test/icc-x-api/icc-user-x-api-test.d.ts +0 -1
- package/test/icc-x-api/icc-user-x-api-test.js +0 -99
- package/test/icc-x-api/icc-user-x-api-test.js.map +0 -1
- package/test/icc-x-api/keyless-api.d.ts +0 -1
- package/test/icc-x-api/keyless-api.js +0 -125
- package/test/icc-x-api/keyless-api.js.map +0 -1
- package/test/icc-x-api/patient-user.d.ts +0 -2
- package/test/icc-x-api/patient-user.js +0 -103
- package/test/icc-x-api/patient-user.js.map +0 -1
- package/test/icc-x-api/storage/storage.d.ts +0 -1
- package/test/icc-x-api/storage/storage.js +0 -48
- package/test/icc-x-api/storage/storage.js.map +0 -1
- package/test/icc-x-api/test-api-no-parent.d.ts +0 -1
- package/test/icc-x-api/test-api-no-parent.js +0 -79
- package/test/icc-x-api/test-api-no-parent.js.map +0 -1
- package/test/icc-x-api/test-legacy-data-support.d.ts +0 -1
- package/test/icc-x-api/test-legacy-data-support.js +0 -375
- package/test/icc-x-api/test-legacy-data-support.js.map +0 -1
- package/test/icc-x-api/utils/date-encode-test.d.ts +0 -1
- package/test/icc-x-api/utils/date-encode-test.js +0 -150
- package/test/icc-x-api/utils/date-encode-test.js.map +0 -1
- package/test/icc-x-api/utils/graph-test.d.ts +0 -1
- package/test/icc-x-api/utils/graph-test.js +0 -54
- package/test/icc-x-api/utils/graph-test.js.map +0 -1
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.d.ts +0 -1
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.js +0 -364
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.js.map +0 -1
- package/test/icc-x-api/utils/lzma-benchmark-test.d.ts +0 -1
- package/test/icc-x-api/utils/lzma-benchmark-test.js +0 -132
- package/test/icc-x-api/utils/lzma-benchmark-test.js.map +0 -1
- package/test/icc-x-api/utils/lzma-compat-test.d.ts +0 -1
- package/test/icc-x-api/utils/lzma-compat-test.js +0 -218
- package/test/icc-x-api/utils/lzma-compat-test.js.map +0 -1
- package/test/icc-x-api/utils/mutex-test.d.ts +0 -1
- package/test/icc-x-api/utils/mutex-test.js +0 -114
- package/test/icc-x-api/utils/mutex-test.js.map +0 -1
- package/test/icc-x-api/utils/to-moment-test.d.ts +0 -1
- package/test/icc-x-api/utils/to-moment-test.js +0 -110
- package/test/icc-x-api/utils/to-moment-test.js.map +0 -1
- package/test/support/CSM-185.d.ts +0 -1
- package/test/support/CSM-185.js +0 -124
- package/test/support/CSM-185.js.map +0 -1
- package/test/support/CSM-243.d.ts +0 -1
- package/test/support/CSM-243.js +0 -120
- package/test/support/CSM-243.js.map +0 -1
- package/test/support/CSM-543.d.ts +0 -1
- package/test/support/CSM-543.js +0 -164
- package/test/support/CSM-543.js.map +0 -1
- package/test/support/CSM-729.d.ts +0 -1
- package/test/support/CSM-729.js +0 -225
- package/test/support/CSM-729.js.map +0 -1
- package/test/support/CSM-814.d.ts +0 -1
- package/test/support/CSM-814.js +0 -475
- package/test/support/CSM-814.js.map +0 -1
- package/test/support/CSM-87.d.ts +0 -0
- package/test/support/CSM-87.js +0 -21
- package/test/support/CSM-87.js.map +0 -1
- package/test/support/CSM-93.d.ts +0 -1
- package/test/support/CSM-93.js +0 -112
- package/test/support/CSM-93.js.map +0 -1
- package/test/utils/FakeDataOwnerApi.d.ts +0 -32
- package/test/utils/FakeDataOwnerApi.js +0 -136
- package/test/utils/FakeDataOwnerApi.js.map +0 -1
- package/test/utils/FakeEncryptionKeysManager.d.ts +0 -36
- package/test/utils/FakeEncryptionKeysManager.js +0 -97
- package/test/utils/FakeEncryptionKeysManager.js.map +0 -1
- package/test/utils/FakeExchangeDataApi.d.ts +0 -32
- package/test/utils/FakeExchangeDataApi.js +0 -92
- package/test/utils/FakeExchangeDataApi.js.map +0 -1
- package/test/utils/FakeExchangeDataManager.d.ts +0 -48
- package/test/utils/FakeExchangeDataManager.js +0 -82
- package/test/utils/FakeExchangeDataManager.js.map +0 -1
- package/test/utils/FakeExchangeDataMapManager.d.ts +0 -12
- package/test/utils/FakeExchangeDataMapManager.js +0 -38
- package/test/utils/FakeExchangeDataMapManager.js.map +0 -1
- package/test/utils/FakeGenericApi.d.ts +0 -16
- package/test/utils/FakeGenericApi.js +0 -65
- package/test/utils/FakeGenericApi.js.map +0 -1
- package/test/utils/KeylessCryptoStrategies.d.ts +0 -23
- package/test/utils/KeylessCryptoStrategies.js +0 -26
- package/test/utils/KeylessCryptoStrategies.js.map +0 -1
- package/test/utils/TestApi.d.ts +0 -3
- package/test/utils/TestApi.js +0 -30
- package/test/utils/TestApi.js.map +0 -1
- package/test/utils/TestCollectionUtils.d.ts +0 -1
- package/test/utils/TestCollectionUtils.js +0 -310
- package/test/utils/TestCollectionUtils.js.map +0 -1
- package/test/utils/TestCryptoStrategies.d.ts +0 -42
- package/test/utils/TestCryptoStrategies.js +0 -80
- package/test/utils/TestCryptoStrategies.js.map +0 -1
- package/test/utils/TestStorage.d.ts +0 -23
- package/test/utils/TestStorage.js +0 -61
- package/test/utils/TestStorage.js.map +0 -1
- package/test/utils/roles.d.ts +0 -14
- package/test/utils/roles.js +0 -345
- package/test/utils/roles.js.map +0 -1
- package/test/utils/test_utils.d.ts +0 -87
- package/test/utils/test_utils.js +0 -452
- package/test/utils/test_utils.js.map +0 -1
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const mocha_1 = require("mocha");
|
|
13
|
-
require("isomorphic-fetch");
|
|
14
|
-
const chai_1 = require("chai");
|
|
15
|
-
const crypto_1 = require("crypto");
|
|
16
|
-
const test_utils_1 = require("../../utils/test_utils");
|
|
17
|
-
const types_1 = require("@icure/test-setup/types");
|
|
18
|
-
const HealthElement_1 = require("../../../icc-api/model/HealthElement");
|
|
19
|
-
const Patient_1 = require("../../../icc-api/model/Patient");
|
|
20
|
-
const CodeStub_1 = require("../../../icc-api/model/CodeStub");
|
|
21
|
-
const Identifier_1 = require("../../../icc-api/model/Identifier");
|
|
22
|
-
const HealthElementByHcPartyTagFilter_1 = require("../../../icc-x-api/filters/HealthElementByHcPartyTagFilter");
|
|
23
|
-
const HealthElementByHcPartyCodeFilter_1 = require("../../../icc-x-api/filters/HealthElementByHcPartyCodeFilter");
|
|
24
|
-
const HealthElementByHcPartyIdentifiersVersioningFilter_1 = require("../../../icc-x-api/filters/HealthElementByHcPartyIdentifiersVersioningFilter");
|
|
25
|
-
const HealthElementByHcPartyStatusVersioningFilter_1 = require("../../../icc-x-api/filters/HealthElementByHcPartyStatusVersioningFilter");
|
|
26
|
-
const VersionFiltering_1 = require("../../../icc-x-api/filters/VersionFiltering");
|
|
27
|
-
(0, test_utils_1.setLocalStorage)(fetch);
|
|
28
|
-
let env;
|
|
29
|
-
function initHcpApiAndPatient() {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const { api, user } = yield (0, test_utils_1.createNewHcpApi)(env);
|
|
32
|
-
const patient = yield api.patientApi.createPatientWithUser(user, yield api.patientApi.newInstance(user, new Patient_1.Patient({
|
|
33
|
-
id: (0, crypto_1.randomUUID)(),
|
|
34
|
-
firstName: 'Test',
|
|
35
|
-
lastName: 'Patient',
|
|
36
|
-
})));
|
|
37
|
-
return { api, user, patient };
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
describe('HealthElement Filters Tests', () => {
|
|
41
|
-
(0, mocha_1.before)(function () {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
this.timeout(600000);
|
|
44
|
-
const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
|
|
45
|
-
env = yield initializer.execute((0, types_1.getEnvVariables)());
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
it('HealthElementByHcPartyTagFilter with VersionFiltering.LATEST should return correct health elements', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
-
// Given - Create a new HCP and initialize the api
|
|
50
|
-
const { api, user, patient } = yield initHcpApiAndPatient();
|
|
51
|
-
const hcpId = user.healthcarePartyId;
|
|
52
|
-
// Target tag to search for
|
|
53
|
-
const targetTagType = 'CD-LIFECYCLE';
|
|
54
|
-
const targetTagCode = 'active';
|
|
55
|
-
const matchingTag = new CodeStub_1.CodeStub({ id: `${targetTagType}|${targetTagCode}|1`, type: targetTagType, code: targetTagCode, version: '1' });
|
|
56
|
-
const nonMatchingTag = new CodeStub_1.CodeStub({ id: 'CD-LIFECYCLE|inactive|1', type: 'CD-LIFECYCLE', code: 'inactive', version: '1' });
|
|
57
|
-
// Helper to create and save a health element
|
|
58
|
-
function createHealthElement(opts) {
|
|
59
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
const he = yield api.healthcareElementApi.newInstance(user, patient, new HealthElement_1.HealthElement({
|
|
61
|
-
id: (0, crypto_1.randomUUID)(),
|
|
62
|
-
healthElementId: opts.healthElementId,
|
|
63
|
-
tags: opts.tags,
|
|
64
|
-
modified: opts.modified,
|
|
65
|
-
note: 'Test health element',
|
|
66
|
-
}));
|
|
67
|
-
return api.healthcareElementApi.createHealthElementWithUser(user, he);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
// 1. A health element with the matching tag and no healthElementId
|
|
71
|
-
const he1 = yield createHealthElement({ tags: [matchingTag] });
|
|
72
|
-
// 2. A health element with the matching tag and a healthElementId
|
|
73
|
-
const he2HealthElementId = (0, crypto_1.randomUUID)();
|
|
74
|
-
const he2 = yield createHealthElement({ tags: [matchingTag], healthElementId: he2HealthElementId });
|
|
75
|
-
// 3. Two health elements with same healthElementId, different modified times:
|
|
76
|
-
// 3a. lowest modified has matching tag
|
|
77
|
-
// 3b. highest modified does not have matching tag (this is the latest version)
|
|
78
|
-
const he3HealthElementId = (0, crypto_1.randomUUID)();
|
|
79
|
-
const he3a = yield createHealthElement({
|
|
80
|
-
tags: [matchingTag],
|
|
81
|
-
healthElementId: he3HealthElementId,
|
|
82
|
-
modified: 1000,
|
|
83
|
-
});
|
|
84
|
-
const he3b = yield createHealthElement({
|
|
85
|
-
tags: [nonMatchingTag],
|
|
86
|
-
healthElementId: he3HealthElementId,
|
|
87
|
-
modified: 2000,
|
|
88
|
-
});
|
|
89
|
-
// 4. Two health elements with same healthElementId, different modified times:
|
|
90
|
-
// 4a. lowest modified does not have matching tag
|
|
91
|
-
// 4b. highest modified has matching tag (this is the latest version)
|
|
92
|
-
const he4HealthElementId = (0, crypto_1.randomUUID)();
|
|
93
|
-
const he4a = yield createHealthElement({
|
|
94
|
-
tags: [nonMatchingTag],
|
|
95
|
-
healthElementId: he4HealthElementId,
|
|
96
|
-
modified: 1000,
|
|
97
|
-
});
|
|
98
|
-
const he4b = yield createHealthElement({
|
|
99
|
-
tags: [matchingTag],
|
|
100
|
-
healthElementId: he4HealthElementId,
|
|
101
|
-
modified: 2000,
|
|
102
|
-
});
|
|
103
|
-
// 5. A health element without the matching tag and no healthElementId
|
|
104
|
-
const he5 = yield createHealthElement({ tags: [nonMatchingTag] });
|
|
105
|
-
// 6. A health element without the matching tag and a healthElementId
|
|
106
|
-
const he6HealthElementId = (0, crypto_1.randomUUID)();
|
|
107
|
-
const he6 = yield createHealthElement({ tags: [nonMatchingTag], healthElementId: he6HealthElementId });
|
|
108
|
-
// When - Use the filter with match method
|
|
109
|
-
const filter = new HealthElementByHcPartyTagFilter_1.HealthElementByHcPartyTagFilter({
|
|
110
|
-
healthcarePartyId: hcpId,
|
|
111
|
-
tagType: targetTagType,
|
|
112
|
-
tagCode: targetTagCode,
|
|
113
|
-
versionFiltering: VersionFiltering_1.VersionFiltering.LATEST,
|
|
114
|
-
});
|
|
115
|
-
const matchedIds = yield api.healthcareElementApi.matchHealthElementsBy(filter);
|
|
116
|
-
// Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6
|
|
117
|
-
(0, chai_1.expect)(matchedIds).to.have.members([he1.id, he2.id, he4b.id]);
|
|
118
|
-
}));
|
|
119
|
-
it('HealthElementByHcPartyCodeFilter with VersionFiltering.LATEST should return correct health elements', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
120
|
-
// Given - Create a new HCP and initialize the api
|
|
121
|
-
const { api, user, patient } = yield initHcpApiAndPatient();
|
|
122
|
-
const hcpId = user.healthcarePartyId;
|
|
123
|
-
// Target code to search for
|
|
124
|
-
const targetCodeType = 'SNOMED';
|
|
125
|
-
const targetCodeCode = '38341003';
|
|
126
|
-
const matchingCode = new CodeStub_1.CodeStub({ id: `${targetCodeType}|${targetCodeCode}|2`, type: targetCodeType, code: targetCodeCode, version: '2' });
|
|
127
|
-
const nonMatchingCode = new CodeStub_1.CodeStub({ id: 'SNOMED|73211009|2', type: 'SNOMED', code: '73211009', version: '2' });
|
|
128
|
-
// Helper to create and save a health element
|
|
129
|
-
function createHealthElement(opts) {
|
|
130
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
const he = yield api.healthcareElementApi.newInstance(user, patient, new HealthElement_1.HealthElement({
|
|
132
|
-
id: (0, crypto_1.randomUUID)(),
|
|
133
|
-
healthElementId: opts.healthElementId,
|
|
134
|
-
codes: opts.codes,
|
|
135
|
-
modified: opts.modified,
|
|
136
|
-
note: 'Test health element',
|
|
137
|
-
}));
|
|
138
|
-
return api.healthcareElementApi.createHealthElementWithUser(user, he);
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
// 1. A health element with the matching code and no healthElementId
|
|
142
|
-
const he1 = yield createHealthElement({ codes: [matchingCode] });
|
|
143
|
-
// 2. A health element with the matching code and a healthElementId
|
|
144
|
-
const he2HealthElementId = (0, crypto_1.randomUUID)();
|
|
145
|
-
const he2 = yield createHealthElement({ codes: [matchingCode], healthElementId: he2HealthElementId });
|
|
146
|
-
// 3. Two health elements with same healthElementId, different modified times:
|
|
147
|
-
// 3a. lowest modified has matching code
|
|
148
|
-
// 3b. highest modified does not have matching code (this is the latest version)
|
|
149
|
-
const he3HealthElementId = (0, crypto_1.randomUUID)();
|
|
150
|
-
const he3a = yield createHealthElement({
|
|
151
|
-
codes: [matchingCode],
|
|
152
|
-
healthElementId: he3HealthElementId,
|
|
153
|
-
modified: 1000,
|
|
154
|
-
});
|
|
155
|
-
const he3b = yield createHealthElement({
|
|
156
|
-
codes: [nonMatchingCode],
|
|
157
|
-
healthElementId: he3HealthElementId,
|
|
158
|
-
modified: 2000,
|
|
159
|
-
});
|
|
160
|
-
// 4. Two health elements with same healthElementId, different modified times:
|
|
161
|
-
// 4a. lowest modified does not have matching code
|
|
162
|
-
// 4b. highest modified has matching code (this is the latest version)
|
|
163
|
-
const he4HealthElementId = (0, crypto_1.randomUUID)();
|
|
164
|
-
const he4a = yield createHealthElement({
|
|
165
|
-
codes: [nonMatchingCode],
|
|
166
|
-
healthElementId: he4HealthElementId,
|
|
167
|
-
modified: 1000,
|
|
168
|
-
});
|
|
169
|
-
const he4b = yield createHealthElement({
|
|
170
|
-
codes: [matchingCode],
|
|
171
|
-
healthElementId: he4HealthElementId,
|
|
172
|
-
modified: 2000,
|
|
173
|
-
});
|
|
174
|
-
// 5. A health element without the matching code and no healthElementId
|
|
175
|
-
const he5 = yield createHealthElement({ codes: [nonMatchingCode] });
|
|
176
|
-
// 6. A health element without the matching code and a healthElementId
|
|
177
|
-
const he6HealthElementId = (0, crypto_1.randomUUID)();
|
|
178
|
-
const he6 = yield createHealthElement({ codes: [nonMatchingCode], healthElementId: he6HealthElementId });
|
|
179
|
-
// When - Use the filter with match method
|
|
180
|
-
const filter = new HealthElementByHcPartyCodeFilter_1.HealthElementByHcPartyCodeFilter({
|
|
181
|
-
healthcarePartyId: hcpId,
|
|
182
|
-
codeType: targetCodeType,
|
|
183
|
-
codeCode: targetCodeCode,
|
|
184
|
-
versionFiltering: VersionFiltering_1.VersionFiltering.LATEST,
|
|
185
|
-
});
|
|
186
|
-
const matchedIds = yield api.healthcareElementApi.matchHealthElementsBy(filter);
|
|
187
|
-
// Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6
|
|
188
|
-
(0, chai_1.expect)(matchedIds).to.have.members([he1.id, he2.id, he4b.id]);
|
|
189
|
-
}));
|
|
190
|
-
it('HealthElementByHcPartyIdentifiersVersioningFilter with VersionFiltering.LATEST should return correct health elements', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
191
|
-
// Given - Create a new HCP and initialize the api
|
|
192
|
-
const { api, user, patient } = yield initHcpApiAndPatient();
|
|
193
|
-
const hcpId = user.healthcarePartyId;
|
|
194
|
-
// Target identifier to search for
|
|
195
|
-
const matchingIdentifier = new Identifier_1.Identifier({
|
|
196
|
-
system: 'https://www.ehealth.fgov.be/standards/kmehr/id/ehealth',
|
|
197
|
-
value: 'test-identifier-123',
|
|
198
|
-
});
|
|
199
|
-
const nonMatchingIdentifier = new Identifier_1.Identifier({
|
|
200
|
-
system: 'https://www.ehealth.fgov.be/standards/kmehr/id/ehealth',
|
|
201
|
-
value: 'other-identifier-456',
|
|
202
|
-
});
|
|
203
|
-
// Helper to create and save a health element
|
|
204
|
-
function createHealthElement(opts) {
|
|
205
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
-
const he = yield api.healthcareElementApi.newInstance(user, patient, new HealthElement_1.HealthElement({
|
|
207
|
-
id: (0, crypto_1.randomUUID)(),
|
|
208
|
-
healthElementId: opts.healthElementId,
|
|
209
|
-
identifiers: opts.identifiers,
|
|
210
|
-
modified: opts.modified,
|
|
211
|
-
note: 'Test health element',
|
|
212
|
-
}));
|
|
213
|
-
return api.healthcareElementApi.createHealthElementWithUser(user, he);
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
// 1. A health element with the matching identifier and no healthElementId
|
|
217
|
-
const he1 = yield createHealthElement({ identifiers: [matchingIdentifier] });
|
|
218
|
-
// 2. A health element with the matching identifier and a healthElementId
|
|
219
|
-
const he2HealthElementId = (0, crypto_1.randomUUID)();
|
|
220
|
-
const he2 = yield createHealthElement({ identifiers: [matchingIdentifier], healthElementId: he2HealthElementId });
|
|
221
|
-
// 3. Two health elements with same healthElementId, different modified times:
|
|
222
|
-
// 3a. lowest modified has matching identifier
|
|
223
|
-
// 3b. highest modified does not have matching identifier (this is the latest version)
|
|
224
|
-
const he3HealthElementId = (0, crypto_1.randomUUID)();
|
|
225
|
-
const he3a = yield createHealthElement({
|
|
226
|
-
identifiers: [matchingIdentifier],
|
|
227
|
-
healthElementId: he3HealthElementId,
|
|
228
|
-
modified: 1000,
|
|
229
|
-
});
|
|
230
|
-
const he3b = yield createHealthElement({
|
|
231
|
-
identifiers: [nonMatchingIdentifier],
|
|
232
|
-
healthElementId: he3HealthElementId,
|
|
233
|
-
modified: 2000,
|
|
234
|
-
});
|
|
235
|
-
// 4. Two health elements with same healthElementId, different modified times:
|
|
236
|
-
// 4a. lowest modified does not have matching identifier
|
|
237
|
-
// 4b. highest modified has matching identifier (this is the latest version)
|
|
238
|
-
const he4HealthElementId = (0, crypto_1.randomUUID)();
|
|
239
|
-
const he4a = yield createHealthElement({
|
|
240
|
-
identifiers: [nonMatchingIdentifier],
|
|
241
|
-
healthElementId: he4HealthElementId,
|
|
242
|
-
modified: 1000,
|
|
243
|
-
});
|
|
244
|
-
const he4b = yield createHealthElement({
|
|
245
|
-
identifiers: [matchingIdentifier],
|
|
246
|
-
healthElementId: he4HealthElementId,
|
|
247
|
-
modified: 2000,
|
|
248
|
-
});
|
|
249
|
-
// 5. A health element without the matching identifier and no healthElementId
|
|
250
|
-
const he5 = yield createHealthElement({ identifiers: [nonMatchingIdentifier] });
|
|
251
|
-
// 6. A health element without the matching identifier and a healthElementId
|
|
252
|
-
const he6HealthElementId = (0, crypto_1.randomUUID)();
|
|
253
|
-
const he6 = yield createHealthElement({ identifiers: [nonMatchingIdentifier], healthElementId: he6HealthElementId });
|
|
254
|
-
// When - Use the filter with match method
|
|
255
|
-
const filter = new HealthElementByHcPartyIdentifiersVersioningFilter_1.HealthElementByHcPartyIdentifiersVersioningFilter({
|
|
256
|
-
hcPartyId: hcpId,
|
|
257
|
-
identifiers: [matchingIdentifier],
|
|
258
|
-
versionFiltering: VersionFiltering_1.VersionFiltering.LATEST,
|
|
259
|
-
});
|
|
260
|
-
const matchedIds = yield api.healthcareElementApi.matchHealthElementsBy(filter);
|
|
261
|
-
// Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6
|
|
262
|
-
(0, chai_1.expect)(matchedIds).to.have.members([he1.id, he2.id, he4b.id]);
|
|
263
|
-
}));
|
|
264
|
-
it('HealthElementByHcPartyStatusVersioningFilter with VersionFiltering.LATEST should return correct health elements', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
265
|
-
// Given - Create a new HCP and initialize the api
|
|
266
|
-
const { api, user, patient } = yield initHcpApiAndPatient();
|
|
267
|
-
const hcpId = user.healthcarePartyId;
|
|
268
|
-
// Target status to search for (bit 0: active=0/inactive=1, bit 1: relevant=0/irrelevant=1, bit 2: present=0/absent=1)
|
|
269
|
-
const matchingStatus = 0; // active, relevant, present
|
|
270
|
-
const nonMatchingStatus = 1; // inactive, relevant, present
|
|
271
|
-
// Helper to create and save a health element
|
|
272
|
-
function createHealthElement(opts) {
|
|
273
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
-
const he = yield api.healthcareElementApi.newInstance(user, patient, new HealthElement_1.HealthElement({
|
|
275
|
-
id: (0, crypto_1.randomUUID)(),
|
|
276
|
-
healthElementId: opts.healthElementId,
|
|
277
|
-
status: opts.status,
|
|
278
|
-
modified: opts.modified,
|
|
279
|
-
note: 'Test health element',
|
|
280
|
-
}));
|
|
281
|
-
return api.healthcareElementApi.createHealthElementWithUser(user, he);
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
// 1. A health element with the matching status and no healthElementId
|
|
285
|
-
const he1 = yield createHealthElement({ status: matchingStatus });
|
|
286
|
-
// 2. A health element with the matching status and a healthElementId
|
|
287
|
-
const he2HealthElementId = (0, crypto_1.randomUUID)();
|
|
288
|
-
const he2 = yield createHealthElement({ status: matchingStatus, healthElementId: he2HealthElementId });
|
|
289
|
-
// 3. Two health elements with same healthElementId, different modified times:
|
|
290
|
-
// 3a. lowest modified has matching status
|
|
291
|
-
// 3b. highest modified does not have matching status (this is the latest version)
|
|
292
|
-
const he3HealthElementId = (0, crypto_1.randomUUID)();
|
|
293
|
-
const he3a = yield createHealthElement({
|
|
294
|
-
status: matchingStatus,
|
|
295
|
-
healthElementId: he3HealthElementId,
|
|
296
|
-
modified: 1000,
|
|
297
|
-
});
|
|
298
|
-
const he3b = yield createHealthElement({
|
|
299
|
-
status: nonMatchingStatus,
|
|
300
|
-
healthElementId: he3HealthElementId,
|
|
301
|
-
modified: 2000,
|
|
302
|
-
});
|
|
303
|
-
// 4. Two health elements with same healthElementId, different modified times:
|
|
304
|
-
// 4a. lowest modified does not have matching status
|
|
305
|
-
// 4b. highest modified has matching status (this is the latest version)
|
|
306
|
-
const he4HealthElementId = (0, crypto_1.randomUUID)();
|
|
307
|
-
const he4a = yield createHealthElement({
|
|
308
|
-
status: nonMatchingStatus,
|
|
309
|
-
healthElementId: he4HealthElementId,
|
|
310
|
-
modified: 1000,
|
|
311
|
-
});
|
|
312
|
-
const he4b = yield createHealthElement({
|
|
313
|
-
status: matchingStatus,
|
|
314
|
-
healthElementId: he4HealthElementId,
|
|
315
|
-
modified: 2000,
|
|
316
|
-
});
|
|
317
|
-
// 5. A health element without the matching status and no healthElementId
|
|
318
|
-
const he5 = yield createHealthElement({ status: nonMatchingStatus });
|
|
319
|
-
// 6. A health element without the matching status and a healthElementId
|
|
320
|
-
const he6HealthElementId = (0, crypto_1.randomUUID)();
|
|
321
|
-
const he6 = yield createHealthElement({ status: nonMatchingStatus, healthElementId: he6HealthElementId });
|
|
322
|
-
// When - Use the filter with match method
|
|
323
|
-
const filter = new HealthElementByHcPartyStatusVersioningFilter_1.HealthElementByHcPartyStatusVersioningFilter({
|
|
324
|
-
hcPartyId: hcpId,
|
|
325
|
-
status: matchingStatus,
|
|
326
|
-
versionFiltering: VersionFiltering_1.VersionFiltering.LATEST,
|
|
327
|
-
});
|
|
328
|
-
const matchedIds = yield api.healthcareElementApi.matchHealthElementsBy(filter);
|
|
329
|
-
// Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6
|
|
330
|
-
(0, chai_1.expect)(matchedIds).to.have.members([he1.id, he2.id, he4b.id]);
|
|
331
|
-
}));
|
|
332
|
-
});
|
|
333
|
-
//# sourceMappingURL=healthelement.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"healthelement.js","sourceRoot":"","sources":["../../../../test/icc-x-api/filters/healthelement.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAA8B;AAC9B,4BAAyB;AACzB,+BAA6B;AAC7B,mCAAmC;AACnC,uDAAoG;AACpG,mDAAmE;AACnE,wEAAoE;AACpE,4DAAwD;AACxD,8DAA0D;AAC1D,kEAA8D;AAC9D,gHAA4G;AAC5G,kHAA8G;AAC9G,oJAAgJ;AAChJ,0IAAsI;AACt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nimport { randomUUID } from 'crypto'\nimport { getEnvironmentInitializer, setLocalStorage, createNewHcpApi } from '../../utils/test_utils'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\nimport { HealthElement } from '../../../icc-api/model/HealthElement'\nimport { Patient } from '../../../icc-api/model/Patient'\nimport { CodeStub } from '../../../icc-api/model/CodeStub'\nimport { Identifier } from '../../../icc-api/model/Identifier'\nimport { HealthElementByHcPartyTagFilter } from '../../../icc-x-api/filters/HealthElementByHcPartyTagFilter'\nimport { HealthElementByHcPartyCodeFilter } from '../../../icc-x-api/filters/HealthElementByHcPartyCodeFilter'\nimport { HealthElementByHcPartyIdentifiersVersioningFilter } from '../../../icc-x-api/filters/HealthElementByHcPartyIdentifiersVersioningFilter'\nimport { HealthElementByHcPartyStatusVersioningFilter } from '../../../icc-x-api/filters/HealthElementByHcPartyStatusVersioningFilter'\nimport { VersionFiltering } from '../../../icc-x-api/filters/VersionFiltering'\n\nsetLocalStorage(fetch)\nlet env: TestVars\n\nasync function initHcpApiAndPatient() {\n const { api, user } = await createNewHcpApi(env)\n\n const patient = await api.patientApi.createPatientWithUser(\n user,\n await api.patientApi.newInstance(\n user,\n new Patient({\n id: randomUUID(),\n firstName: 'Test',\n lastName: 'Patient',\n })\n )\n )\n\n return { api, user, patient }\n}\n\ndescribe('HealthElement Filters Tests', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n it('HealthElementByHcPartyTagFilter with VersionFiltering.LATEST should return correct health elements', async () => {\n // Given - Create a new HCP and initialize the api\n const { api, user, patient } = await initHcpApiAndPatient()\n const hcpId = user.healthcarePartyId!\n\n // Target tag to search for\n const targetTagType = 'CD-LIFECYCLE'\n const targetTagCode = 'active'\n const matchingTag = new CodeStub({ id: `${targetTagType}|${targetTagCode}|1`, type: targetTagType, code: targetTagCode, version: '1' })\n const nonMatchingTag = new CodeStub({ id: 'CD-LIFECYCLE|inactive|1', type: 'CD-LIFECYCLE', code: 'inactive', version: '1' })\n\n // Helper to create and save a health element\n async function createHealthElement(opts: { tags: CodeStub[]; healthElementId?: string; modified?: number }): Promise<HealthElement> {\n const he = await api.healthcareElementApi.newInstance(\n user,\n patient,\n new HealthElement({\n id: randomUUID(),\n healthElementId: opts.healthElementId,\n tags: opts.tags,\n modified: opts.modified,\n note: 'Test health element',\n })\n )\n return api.healthcareElementApi.createHealthElementWithUser(user, he)\n }\n\n // 1. A health element with the matching tag and no healthElementId\n const he1 = await createHealthElement({ tags: [matchingTag] })\n\n // 2. A health element with the matching tag and a healthElementId\n const he2HealthElementId = randomUUID()\n const he2 = await createHealthElement({ tags: [matchingTag], healthElementId: he2HealthElementId })\n\n // 3. Two health elements with same healthElementId, different modified times:\n // 3a. lowest modified has matching tag\n // 3b. highest modified does not have matching tag (this is the latest version)\n const he3HealthElementId = randomUUID()\n const he3a = await createHealthElement({\n tags: [matchingTag],\n healthElementId: he3HealthElementId,\n modified: 1000,\n })\n const he3b = await createHealthElement({\n tags: [nonMatchingTag],\n healthElementId: he3HealthElementId,\n modified: 2000,\n })\n\n // 4. Two health elements with same healthElementId, different modified times:\n // 4a. lowest modified does not have matching tag\n // 4b. highest modified has matching tag (this is the latest version)\n const he4HealthElementId = randomUUID()\n const he4a = await createHealthElement({\n tags: [nonMatchingTag],\n healthElementId: he4HealthElementId,\n modified: 1000,\n })\n const he4b = await createHealthElement({\n tags: [matchingTag],\n healthElementId: he4HealthElementId,\n modified: 2000,\n })\n\n // 5. A health element without the matching tag and no healthElementId\n const he5 = await createHealthElement({ tags: [nonMatchingTag] })\n\n // 6. A health element without the matching tag and a healthElementId\n const he6HealthElementId = randomUUID()\n const he6 = await createHealthElement({ tags: [nonMatchingTag], healthElementId: he6HealthElementId })\n\n // When - Use the filter with match method\n const filter = new HealthElementByHcPartyTagFilter({\n healthcarePartyId: hcpId,\n tagType: targetTagType,\n tagCode: targetTagCode,\n versionFiltering: VersionFiltering.LATEST,\n })\n\n const matchedIds = await api.healthcareElementApi.matchHealthElementsBy(filter)\n\n // Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6\n expect(matchedIds).to.have.members([he1.id, he2.id, he4b.id])\n })\n\n it('HealthElementByHcPartyCodeFilter with VersionFiltering.LATEST should return correct health elements', async () => {\n // Given - Create a new HCP and initialize the api\n const { api, user, patient } = await initHcpApiAndPatient()\n const hcpId = user.healthcarePartyId!\n\n // Target code to search for\n const targetCodeType = 'SNOMED'\n const targetCodeCode = '38341003'\n const matchingCode = new CodeStub({ id: `${targetCodeType}|${targetCodeCode}|2`, type: targetCodeType, code: targetCodeCode, version: '2' })\n const nonMatchingCode = new CodeStub({ id: 'SNOMED|73211009|2', type: 'SNOMED', code: '73211009', version: '2' })\n\n // Helper to create and save a health element\n async function createHealthElement(opts: { codes: CodeStub[]; healthElementId?: string; modified?: number }): Promise<HealthElement> {\n const he = await api.healthcareElementApi.newInstance(\n user,\n patient,\n new HealthElement({\n id: randomUUID(),\n healthElementId: opts.healthElementId,\n codes: opts.codes,\n modified: opts.modified,\n note: 'Test health element',\n })\n )\n return api.healthcareElementApi.createHealthElementWithUser(user, he)\n }\n\n // 1. A health element with the matching code and no healthElementId\n const he1 = await createHealthElement({ codes: [matchingCode] })\n\n // 2. A health element with the matching code and a healthElementId\n const he2HealthElementId = randomUUID()\n const he2 = await createHealthElement({ codes: [matchingCode], healthElementId: he2HealthElementId })\n\n // 3. Two health elements with same healthElementId, different modified times:\n // 3a. lowest modified has matching code\n // 3b. highest modified does not have matching code (this is the latest version)\n const he3HealthElementId = randomUUID()\n const he3a = await createHealthElement({\n codes: [matchingCode],\n healthElementId: he3HealthElementId,\n modified: 1000,\n })\n const he3b = await createHealthElement({\n codes: [nonMatchingCode],\n healthElementId: he3HealthElementId,\n modified: 2000,\n })\n\n // 4. Two health elements with same healthElementId, different modified times:\n // 4a. lowest modified does not have matching code\n // 4b. highest modified has matching code (this is the latest version)\n const he4HealthElementId = randomUUID()\n const he4a = await createHealthElement({\n codes: [nonMatchingCode],\n healthElementId: he4HealthElementId,\n modified: 1000,\n })\n const he4b = await createHealthElement({\n codes: [matchingCode],\n healthElementId: he4HealthElementId,\n modified: 2000,\n })\n\n // 5. A health element without the matching code and no healthElementId\n const he5 = await createHealthElement({ codes: [nonMatchingCode] })\n\n // 6. A health element without the matching code and a healthElementId\n const he6HealthElementId = randomUUID()\n const he6 = await createHealthElement({ codes: [nonMatchingCode], healthElementId: he6HealthElementId })\n\n // When - Use the filter with match method\n const filter = new HealthElementByHcPartyCodeFilter({\n healthcarePartyId: hcpId,\n codeType: targetCodeType,\n codeCode: targetCodeCode,\n versionFiltering: VersionFiltering.LATEST,\n })\n\n const matchedIds = await api.healthcareElementApi.matchHealthElementsBy(filter)\n\n // Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6\n expect(matchedIds).to.have.members([he1.id, he2.id, he4b.id])\n })\n\n it('HealthElementByHcPartyIdentifiersVersioningFilter with VersionFiltering.LATEST should return correct health elements', async () => {\n // Given - Create a new HCP and initialize the api\n const { api, user, patient } = await initHcpApiAndPatient()\n const hcpId = user.healthcarePartyId!\n\n // Target identifier to search for\n const matchingIdentifier = new Identifier({\n system: 'https://www.ehealth.fgov.be/standards/kmehr/id/ehealth',\n value: 'test-identifier-123',\n })\n const nonMatchingIdentifier = new Identifier({\n system: 'https://www.ehealth.fgov.be/standards/kmehr/id/ehealth',\n value: 'other-identifier-456',\n })\n\n // Helper to create and save a health element\n async function createHealthElement(opts: { identifiers: Identifier[]; healthElementId?: string; modified?: number }): Promise<HealthElement> {\n const he = await api.healthcareElementApi.newInstance(\n user,\n patient,\n new HealthElement({\n id: randomUUID(),\n healthElementId: opts.healthElementId,\n identifiers: opts.identifiers,\n modified: opts.modified,\n note: 'Test health element',\n })\n )\n return api.healthcareElementApi.createHealthElementWithUser(user, he)\n }\n\n // 1. A health element with the matching identifier and no healthElementId\n const he1 = await createHealthElement({ identifiers: [matchingIdentifier] })\n\n // 2. A health element with the matching identifier and a healthElementId\n const he2HealthElementId = randomUUID()\n const he2 = await createHealthElement({ identifiers: [matchingIdentifier], healthElementId: he2HealthElementId })\n\n // 3. Two health elements with same healthElementId, different modified times:\n // 3a. lowest modified has matching identifier\n // 3b. highest modified does not have matching identifier (this is the latest version)\n const he3HealthElementId = randomUUID()\n const he3a = await createHealthElement({\n identifiers: [matchingIdentifier],\n healthElementId: he3HealthElementId,\n modified: 1000,\n })\n const he3b = await createHealthElement({\n identifiers: [nonMatchingIdentifier],\n healthElementId: he3HealthElementId,\n modified: 2000,\n })\n\n // 4. Two health elements with same healthElementId, different modified times:\n // 4a. lowest modified does not have matching identifier\n // 4b. highest modified has matching identifier (this is the latest version)\n const he4HealthElementId = randomUUID()\n const he4a = await createHealthElement({\n identifiers: [nonMatchingIdentifier],\n healthElementId: he4HealthElementId,\n modified: 1000,\n })\n const he4b = await createHealthElement({\n identifiers: [matchingIdentifier],\n healthElementId: he4HealthElementId,\n modified: 2000,\n })\n\n // 5. A health element without the matching identifier and no healthElementId\n const he5 = await createHealthElement({ identifiers: [nonMatchingIdentifier] })\n\n // 6. A health element without the matching identifier and a healthElementId\n const he6HealthElementId = randomUUID()\n const he6 = await createHealthElement({ identifiers: [nonMatchingIdentifier], healthElementId: he6HealthElementId })\n\n // When - Use the filter with match method\n const filter = new HealthElementByHcPartyIdentifiersVersioningFilter({\n hcPartyId: hcpId,\n identifiers: [matchingIdentifier],\n versionFiltering: VersionFiltering.LATEST,\n })\n\n const matchedIds = await api.healthcareElementApi.matchHealthElementsBy(filter)\n\n // Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6\n expect(matchedIds).to.have.members([he1.id, he2.id, he4b.id])\n })\n\n it('HealthElementByHcPartyStatusVersioningFilter with VersionFiltering.LATEST should return correct health elements', async () => {\n // Given - Create a new HCP and initialize the api\n const { api, user, patient } = await initHcpApiAndPatient()\n const hcpId = user.healthcarePartyId!\n\n // Target status to search for (bit 0: active=0/inactive=1, bit 1: relevant=0/irrelevant=1, bit 2: present=0/absent=1)\n const matchingStatus = 0 // active, relevant, present\n const nonMatchingStatus = 1 // inactive, relevant, present\n\n // Helper to create and save a health element\n async function createHealthElement(opts: { status: number; healthElementId?: string; modified?: number }): Promise<HealthElement> {\n const he = await api.healthcareElementApi.newInstance(\n user,\n patient,\n new HealthElement({\n id: randomUUID(),\n healthElementId: opts.healthElementId,\n status: opts.status,\n modified: opts.modified,\n note: 'Test health element',\n })\n )\n return api.healthcareElementApi.createHealthElementWithUser(user, he)\n }\n\n // 1. A health element with the matching status and no healthElementId\n const he1 = await createHealthElement({ status: matchingStatus })\n\n // 2. A health element with the matching status and a healthElementId\n const he2HealthElementId = randomUUID()\n const he2 = await createHealthElement({ status: matchingStatus, healthElementId: he2HealthElementId })\n\n // 3. Two health elements with same healthElementId, different modified times:\n // 3a. lowest modified has matching status\n // 3b. highest modified does not have matching status (this is the latest version)\n const he3HealthElementId = randomUUID()\n const he3a = await createHealthElement({\n status: matchingStatus,\n healthElementId: he3HealthElementId,\n modified: 1000,\n })\n const he3b = await createHealthElement({\n status: nonMatchingStatus,\n healthElementId: he3HealthElementId,\n modified: 2000,\n })\n\n // 4. Two health elements with same healthElementId, different modified times:\n // 4a. lowest modified does not have matching status\n // 4b. highest modified has matching status (this is the latest version)\n const he4HealthElementId = randomUUID()\n const he4a = await createHealthElement({\n status: nonMatchingStatus,\n healthElementId: he4HealthElementId,\n modified: 1000,\n })\n const he4b = await createHealthElement({\n status: matchingStatus,\n healthElementId: he4HealthElementId,\n modified: 2000,\n })\n\n // 5. A health element without the matching status and no healthElementId\n const he5 = await createHealthElement({ status: nonMatchingStatus })\n\n // 6. A health element without the matching status and a healthElementId\n const he6HealthElementId = randomUUID()\n const he6 = await createHealthElement({ status: nonMatchingStatus, healthElementId: he6HealthElementId })\n\n // When - Use the filter with match method\n const filter = new HealthElementByHcPartyStatusVersioningFilter({\n hcPartyId: hcpId,\n status: matchingStatus,\n versionFiltering: VersionFiltering.LATEST,\n })\n\n const matchedIds = await api.healthcareElementApi.matchHealthElementsBy(filter)\n\n // Then - Should find 1, 2, 4b and not 3a, 3b, 4a, 5, 6\n expect(matchedIds).to.have.members([he1.id, he2.id, he4b.id])\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'isomorphic-fetch';
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
require("isomorphic-fetch");
|
|
13
|
-
const test_utils_1 = require("../utils/test_utils");
|
|
14
|
-
const mocha_1 = require("mocha");
|
|
15
|
-
const icc_x_api_1 = require("../../icc-x-api");
|
|
16
|
-
const icc_api_1 = require("../../icc-api");
|
|
17
|
-
const types_1 = require("@icure/test-setup/types");
|
|
18
|
-
const chai_1 = require("chai");
|
|
19
|
-
var initApi = test_utils_1.TestUtils.initApi;
|
|
20
|
-
const Patient_1 = require("../../icc-api/model/Patient");
|
|
21
|
-
const crypto_1 = require("crypto");
|
|
22
|
-
const AccessLog_1 = require("../../icc-api/model/AccessLog");
|
|
23
|
-
const chai_2 = require("chai");
|
|
24
|
-
const icc_x_api_2 = require("../../icc-x-api");
|
|
25
|
-
(0, test_utils_1.setLocalStorage)(fetch);
|
|
26
|
-
let env;
|
|
27
|
-
describe('icc-x-accesslog-api Tests', () => {
|
|
28
|
-
(0, mocha_1.before)(function () {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
this.timeout(600000);
|
|
31
|
-
const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
|
|
32
|
-
env = yield initializer.execute((0, types_1.getEnvVariables)());
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
function createPatient(patientApiForHcp, hcpUser) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
return patientApiForHcp.createPatientWithUser(hcpUser, yield patientApiForHcp.newInstance(hcpUser, new Patient_1.Patient({
|
|
38
|
-
id: (0, crypto_1.randomUUID)(),
|
|
39
|
-
firstName: 'John',
|
|
40
|
-
lastName: 'Snow',
|
|
41
|
-
note: 'Winter is coming',
|
|
42
|
-
})));
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
it('Test', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
// Given
|
|
47
|
-
const username = env.dataOwnerDetails[test_utils_1.hcp1Username].user;
|
|
48
|
-
const password = env.dataOwnerDetails[test_utils_1.hcp1Username].password;
|
|
49
|
-
const authProvider = new icc_x_api_2.BasicAuthenticationProvider(username, password);
|
|
50
|
-
const userApi = new icc_x_api_1.IccUserXApi(env.iCureUrl, {}, authProvider, null, fetch);
|
|
51
|
-
const accessLogApi = new icc_api_1.IccAccesslogApi(env.iCureUrl, {}, authProvider, fetch);
|
|
52
|
-
const currentUser = yield userApi.getCurrentUser();
|
|
53
|
-
yield accessLogApi.findByUserAfterDate(currentUser.id);
|
|
54
|
-
}));
|
|
55
|
-
it('Test findBy', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
-
// Given
|
|
57
|
-
const apis = yield initApi(env, test_utils_1.hcp1Username);
|
|
58
|
-
const hcpUser = yield apis.userApi.getCurrentUser();
|
|
59
|
-
const patient = (yield createPatient(apis.patientApi, hcpUser));
|
|
60
|
-
const accessLog = new AccessLog_1.AccessLog({
|
|
61
|
-
id: (0, crypto_1.randomUUID)(),
|
|
62
|
-
_type: 'org.taktik.icure.entities.AccessLog',
|
|
63
|
-
created: new Date().getTime(),
|
|
64
|
-
modified: new Date().getTime(),
|
|
65
|
-
date: +new Date(),
|
|
66
|
-
responsible: hcpUser.healthcarePartyId,
|
|
67
|
-
author: hcpUser.id,
|
|
68
|
-
codes: [],
|
|
69
|
-
tags: [],
|
|
70
|
-
user: hcpUser.id,
|
|
71
|
-
patient: patient.id,
|
|
72
|
-
accessType: 'USER_ACCESS',
|
|
73
|
-
});
|
|
74
|
-
const accessLogToCreate = yield apis.accessLogApi.newInstance(hcpUser, patient, accessLog);
|
|
75
|
-
const createdAccessLog = yield apis.accessLogApi.createAccessLogWithUser(hcpUser, accessLogToCreate);
|
|
76
|
-
const foundItems = yield apis.accessLogApi.findBy(hcpUser.healthcarePartyId, patient, false);
|
|
77
|
-
const foundItemsUsingPost = yield apis.accessLogApi.findBy(hcpUser.healthcarePartyId, patient, true);
|
|
78
|
-
(0, chai_2.assert)(foundItems.length == 1, 'Found items should be 1');
|
|
79
|
-
(0, chai_2.assert)(foundItems[0].id == createdAccessLog.id, 'Found item should be the same as the created one');
|
|
80
|
-
(0, chai_2.assert)(foundItemsUsingPost.length == 1, 'Found items using post should be 1');
|
|
81
|
-
(0, chai_2.assert)(foundItemsUsingPost[0].id == createdAccessLog.id, 'Found item using post should be the same as the created one');
|
|
82
|
-
}));
|
|
83
|
-
it('Share with should work as expected', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
-
const api1 = yield initApi(env, test_utils_1.hcp1Username);
|
|
85
|
-
const user1 = yield api1.userApi.getCurrentUser();
|
|
86
|
-
const api2 = yield initApi(env, test_utils_1.hcp2Username);
|
|
87
|
-
const user2 = yield api2.userApi.getCurrentUser();
|
|
88
|
-
const samplePatient = yield api1.patientApi.createPatientWithUser(user1, yield api1.patientApi.newInstance(user1, { firstName: 'Gigio', lastName: 'Bagigio' }));
|
|
89
|
-
const encryptedField = 'Something encrypted';
|
|
90
|
-
const entity = yield api1.accessLogApi.createAccessLogWithUser(user1, yield api1.accessLogApi.newInstance(user1, samplePatient, { detail: encryptedField }));
|
|
91
|
-
(0, chai_1.expect)(entity.detail).to.be.equal(encryptedField);
|
|
92
|
-
yield api2.accessLogApi
|
|
93
|
-
.getAccessLogWithUser(user2, entity.id)
|
|
94
|
-
.then(() => {
|
|
95
|
-
throw new Error('Should not be able to get the entity');
|
|
96
|
-
})
|
|
97
|
-
.catch(() => {
|
|
98
|
-
/* expected */
|
|
99
|
-
});
|
|
100
|
-
yield api1.accessLogApi.shareWith(user2.healthcarePartyId, entity);
|
|
101
|
-
const retrieved = yield api2.accessLogApi.getAccessLogWithUser(user2, entity.id);
|
|
102
|
-
(0, chai_1.expect)(retrieved.detail).to.be.equal(encryptedField);
|
|
103
|
-
(0, chai_1.expect)((yield api2.accessLogApi.decryptPatientIdOf(retrieved))[0]).to.equal(samplePatient.id);
|
|
104
|
-
}));
|
|
105
|
-
});
|
|
106
|
-
//# sourceMappingURL=icc-accesslog-x-api.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icc-accesslog-x-api.js","sourceRoot":"","sources":["../../../test/icc-x-api/icc-accesslog-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4BAAyB;AACzB,oDAAuH;AACvH,iCAA8B;AAC9B,+CAA6D;AAC7D,2CAA+C;AAC/C,mDAAmE;AACnE,+BAA6B;AAC7B,IAAO,OAAO,GAAG,sBAAS,CAAC,OAAO,CAAA;AAClC,yDAAqD;AAErD,mCAAmC;AACnC,6DAAyD;AACzD,+BAA6B;AAC7B,+CAA6D;AAE7D,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAA;AACtB,IAAI,GAAa,CAAA;AAEjB,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,IAAA,cAAM,EAAC;;YACL,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACpB,MAAM,WAAW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CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QACjD,MAAM,IAAI,CAAC,YAAY;aACpB,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;aACtC,IAAI,CAAC,GAAG,EAAE;YACT,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;QACzD,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,cAAc;QAChB,CAAC,CAAC,CAAA;QACJ,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,iBAAkB,EAAE,MAAM,CAAC,CAAA;QACnE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;QAChF,IAAA,aAAM,EAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QACpD,IAAA,aAAM,EAAC,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;IAC/F,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import 'isomorphic-fetch'\nimport { getEnvironmentInitializer, hcp1Username, hcp2Username, setLocalStorage, TestUtils } from '../utils/test_utils'\nimport { before } from 'mocha'\nimport { IccPatientXApi, IccUserXApi } from '../../icc-x-api'\nimport { IccAccesslogApi } from '../../icc-api'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\nimport { expect } from 'chai'\nimport initApi = TestUtils.initApi\nimport { Patient } from '../../icc-api/model/Patient'\nimport { User } from '../../icc-api/model/User'\nimport { randomUUID } from 'crypto'\nimport { AccessLog } from '../../icc-api/model/AccessLog'\nimport { assert } from 'chai'\nimport { BasicAuthenticationProvider } from '../../icc-x-api'\n\nsetLocalStorage(fetch)\nlet env: TestVars\n\ndescribe('icc-x-accesslog-api Tests', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n async function createPatient(patientApiForHcp: IccPatientXApi, hcpUser: User) {\n return patientApiForHcp.createPatientWithUser(\n hcpUser,\n await patientApiForHcp.newInstance(\n hcpUser,\n new Patient({\n id: randomUUID(),\n firstName: 'John',\n lastName: 'Snow',\n note: 'Winter is coming',\n })\n )\n )\n }\n\n it('Test', async () => {\n // Given\n const username = env.dataOwnerDetails[hcp1Username].user\n const password = env.dataOwnerDetails[hcp1Username].password\n\n const authProvider = new BasicAuthenticationProvider(username, password)\n\n const userApi = new IccUserXApi(env.iCureUrl, {}, authProvider, null as any, fetch)\n const accessLogApi = new IccAccesslogApi(env.iCureUrl, {}, authProvider, fetch)\n\n const currentUser = await userApi.getCurrentUser()\n\n await accessLogApi.findByUserAfterDate(currentUser.id!)\n })\n\n it('Test findBy', async () => {\n // Given\n const apis = await initApi(env, hcp1Username)\n const hcpUser = await apis.userApi.getCurrentUser()\n\n const patient = (await createPatient(apis.patientApi, hcpUser)) as Patient\n\n const accessLog = new AccessLog({\n id: randomUUID(),\n _type: 'org.taktik.icure.entities.AccessLog',\n created: new Date().getTime(),\n modified: new Date().getTime(),\n date: +new Date(),\n responsible: hcpUser.healthcarePartyId!,\n author: hcpUser.id,\n codes: [],\n tags: [],\n user: hcpUser.id,\n patient: patient.id,\n accessType: 'USER_ACCESS',\n })\n\n const accessLogToCreate = await apis.accessLogApi.newInstance(hcpUser, patient, accessLog)\n const createdAccessLog = await apis.accessLogApi.createAccessLogWithUser(hcpUser, accessLogToCreate)\n\n const foundItems: AccessLog[] = await apis.accessLogApi.findBy(hcpUser.healthcarePartyId!, patient, false)\n const foundItemsUsingPost: AccessLog[] = await apis.accessLogApi.findBy(hcpUser.healthcarePartyId!, patient, true)\n\n assert(foundItems.length == 1, 'Found items should be 1')\n assert(foundItems[0].id == createdAccessLog.id, 'Found item should be the same as the created one')\n\n assert(foundItemsUsingPost.length == 1, 'Found items using post should be 1')\n assert(foundItemsUsingPost[0].id == createdAccessLog.id, 'Found item using post should be the same as the created one')\n })\n\n it('Share with should work as expected', async () => {\n const api1 = await initApi(env!, hcp1Username)\n const user1 = await api1.userApi.getCurrentUser()\n const api2 = await initApi(env!, hcp2Username)\n const user2 = await api2.userApi.getCurrentUser()\n const samplePatient = await api1.patientApi.createPatientWithUser(\n user1,\n await api1.patientApi.newInstance(user1, { firstName: 'Gigio', lastName: 'Bagigio' })\n )\n const encryptedField = 'Something encrypted'\n const entity = await api1.accessLogApi.createAccessLogWithUser(\n user1,\n await api1.accessLogApi.newInstance(user1, samplePatient, { detail: encryptedField })\n )\n expect(entity.detail).to.be.equal(encryptedField)\n await api2.accessLogApi\n .getAccessLogWithUser(user2, entity.id)\n .then(() => {\n throw new Error('Should not be able to get the entity')\n })\n .catch(() => {\n /* expected */\n })\n await api1.accessLogApi.shareWith(user2.healthcarePartyId!, entity)\n const retrieved = await api2.accessLogApi.getAccessLogWithUser(user2, entity.id)\n expect(retrieved.detail).to.be.equal(encryptedField)\n expect((await api2.accessLogApi.decryptPatientIdOf(retrieved))[0]).to.equal(samplePatient.id)\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'isomorphic-fetch';
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
require("isomorphic-fetch");
|
|
13
|
-
const test_utils_1 = require("../utils/test_utils");
|
|
14
|
-
const mocha_1 = require("mocha");
|
|
15
|
-
const crypto_1 = require("crypto");
|
|
16
|
-
const chai_1 = require("chai");
|
|
17
|
-
const types_1 = require("@icure/test-setup/types");
|
|
18
|
-
var initApi = test_utils_1.TestUtils.initApi;
|
|
19
|
-
const icc_api_1 = require("../../icc-api");
|
|
20
|
-
const ApplicationSettings_1 = require("../../icc-api/model/ApplicationSettings");
|
|
21
|
-
(0, test_utils_1.setLocalStorage)(fetch);
|
|
22
|
-
let env;
|
|
23
|
-
let unencryptedAppSettings;
|
|
24
|
-
(0, test_utils_1.describeNoLite)('icc-application-settings-x-api Tests', () => {
|
|
25
|
-
(0, mocha_1.before)(function () {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
this.timeout(600000);
|
|
28
|
-
const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
|
|
29
|
-
env = yield initializer.execute((0, types_1.getEnvVariables)());
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
(0, mocha_1.it)('Should still be able to create and get application settings that are not encrypted using the base api', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
-
const api1 = yield initApi(env, test_utils_1.hcp1Username);
|
|
34
|
-
const appSettingsApi = new icc_api_1.IccApplicationsettingsApi(env.iCureUrl, {}, api1.authApi.authenticationProvider, fetch);
|
|
35
|
-
unencryptedAppSettings = yield appSettingsApi.createApplicationSettings(new ApplicationSettings_1.ApplicationSettings({
|
|
36
|
-
id: (0, crypto_1.randomUUID)(),
|
|
37
|
-
settings: { demo: 'plaintext' },
|
|
38
|
-
}));
|
|
39
|
-
(0, chai_1.expect)((yield appSettingsApi.getApplicationSettings()).map((x) => x.id)).to.have.members([unencryptedAppSettings.id]);
|
|
40
|
-
(0, chai_1.expect)((yield api1.applicationSettingsApi.getApplicationSettingsWithUser(undefined)).map((x) => x.id)).to.have.members([
|
|
41
|
-
unencryptedAppSettings.id,
|
|
42
|
-
]);
|
|
43
|
-
})).timeout(10000);
|
|
44
|
-
(0, mocha_1.it)('Should be able to create encrypted application settings', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
var _a, _b, _c;
|
|
46
|
-
const api2 = yield initApi(env, test_utils_1.hcp2Username);
|
|
47
|
-
const user = yield api2.userApi.getCurrentUser();
|
|
48
|
-
const appSettingsApi = new icc_api_1.IccApplicationsettingsApi(env.iCureUrl, {}, api2.authApi.authenticationProvider, fetch);
|
|
49
|
-
const createdWithEncryption = yield api2.applicationSettingsApi.createApplicationSettingsWithUser(undefined, yield api2.applicationSettingsApi.newInstance(user, {
|
|
50
|
-
id: (0, crypto_1.randomUUID)(),
|
|
51
|
-
settings: { demo: 'plaintext' },
|
|
52
|
-
encryptedSettings: { demo: 'willsucceed' },
|
|
53
|
-
}));
|
|
54
|
-
const retrievedWithoutDecryption = yield appSettingsApi.getApplicationSettings();
|
|
55
|
-
(0, chai_1.expect)(retrievedWithoutDecryption.map((x) => x.id)).to.have.members([unencryptedAppSettings.id, createdWithEncryption.id]);
|
|
56
|
-
retrievedWithoutDecryption.forEach((x) => { var _a; return (0, chai_1.expect)((_a = x.encryptedSettings) !== null && _a !== void 0 ? _a : {}).to.deep.eq({}); });
|
|
57
|
-
(0, chai_1.expect)((_a = retrievedWithoutDecryption.find((x) => x.id == createdWithEncryption.id)) === null || _a === void 0 ? void 0 : _a.settings).to.deep.eq({ demo: 'plaintext' });
|
|
58
|
-
const retrievedWithDecryption = yield api2.applicationSettingsApi.getApplicationSettingsWithUser(undefined);
|
|
59
|
-
(0, chai_1.expect)(retrievedWithDecryption.map((x) => x.id)).to.have.members([unencryptedAppSettings.id, createdWithEncryption.id]);
|
|
60
|
-
(0, chai_1.expect)((_b = retrievedWithDecryption.find((x) => x.id == createdWithEncryption.id)) === null || _b === void 0 ? void 0 : _b.settings).to.deep.eq({ demo: 'plaintext' });
|
|
61
|
-
(0, chai_1.expect)((_c = retrievedWithDecryption.find((x) => x.id == createdWithEncryption.id)) === null || _c === void 0 ? void 0 : _c.encryptedSettings).to.deep.eq({ demo: 'willsucceed' });
|
|
62
|
-
})).timeout(10000);
|
|
63
|
-
(0, mocha_1.it)('Should be able to make existing application settings encrypted', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
-
var _a, _b, _c;
|
|
65
|
-
const api1 = yield initApi(env, test_utils_1.hcp1Username);
|
|
66
|
-
const user = yield api1.userApi.getCurrentUser();
|
|
67
|
-
const appSettingsApi = new icc_api_1.IccApplicationsettingsApi(env.iCureUrl, {}, api1.authApi.authenticationProvider, fetch);
|
|
68
|
-
const newToEncryptAfter = yield appSettingsApi.createApplicationSettings(new ApplicationSettings_1.ApplicationSettings({
|
|
69
|
-
id: (0, crypto_1.randomUUID)(),
|
|
70
|
-
settings: { demo: 'plaintext' },
|
|
71
|
-
}));
|
|
72
|
-
// Should not be allowed to set encryptedSettings on application settings where encryption key is not initialized through with user method
|
|
73
|
-
yield api1.applicationSettingsApi
|
|
74
|
-
.updateApplicationSettingsWithUser(user, new ApplicationSettings_1.ApplicationSettings(Object.assign(Object.assign({}, newToEncryptAfter), { encryptedSettings: { demo: 'willfail' } })))
|
|
75
|
-
.then((x) => {
|
|
76
|
-
throw new Error('Should not succeed');
|
|
77
|
-
}, (x) => {
|
|
78
|
-
(0, chai_1.expect)(x.toString()).to.contain('Application settings does not have initialized encryption metadata; initialize or use non-encrypted api');
|
|
79
|
-
});
|
|
80
|
-
yield api1.applicationSettingsApi.updateApplicationSettingsWithUser(undefined, yield api1.applicationSettingsApi.newInstance(user, Object.assign(Object.assign({}, newToEncryptAfter), { encryptedSettings: { demo: 'willsucceed' } })));
|
|
81
|
-
const retrievedWithoutDecryption = yield appSettingsApi.getApplicationSettings();
|
|
82
|
-
(0, chai_1.expect)(retrievedWithoutDecryption.map((x) => x.id)).to.have.members([unencryptedAppSettings.id, newToEncryptAfter.id]);
|
|
83
|
-
retrievedWithoutDecryption.forEach((x) => { var _a; return (0, chai_1.expect)((_a = x.encryptedSettings) !== null && _a !== void 0 ? _a : {}).to.deep.eq({}); });
|
|
84
|
-
(0, chai_1.expect)((_a = retrievedWithoutDecryption.find((x) => x.id == newToEncryptAfter.id)) === null || _a === void 0 ? void 0 : _a.settings).to.deep.eq({ demo: 'plaintext' });
|
|
85
|
-
const retrievedWithDecryption = yield api1.applicationSettingsApi.getApplicationSettingsWithUser(undefined);
|
|
86
|
-
(0, chai_1.expect)(retrievedWithDecryption.map((x) => x.id)).to.have.members([unencryptedAppSettings.id, newToEncryptAfter.id]);
|
|
87
|
-
(0, chai_1.expect)((_b = retrievedWithDecryption.find((x) => x.id == newToEncryptAfter.id)) === null || _b === void 0 ? void 0 : _b.settings).to.deep.eq({ demo: 'plaintext' });
|
|
88
|
-
(0, chai_1.expect)((_c = retrievedWithDecryption.find((x) => x.id == newToEncryptAfter.id)) === null || _c === void 0 ? void 0 : _c.encryptedSettings).to.deep.eq({ demo: 'willsucceed' });
|
|
89
|
-
})).timeout(10000);
|
|
90
|
-
});
|
|
91
|
-
//# sourceMappingURL=icc-application-settings-x-api.js.map
|