@icure/api 8.6.19 → 8.7.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/IccDocumentApi.d.ts +10 -2
- package/icc-api/api/IccDocumentApi.js +22 -4
- package/icc-api/api/IccDocumentApi.js.map +1 -1
- package/icc-api/api/IccReceiptApi.d.ts +17 -0
- package/icc-api/api/IccReceiptApi.js +52 -0
- package/icc-api/api/IccReceiptApi.js.map +1 -1
- package/icc-api/model/DataAttachment.d.ts +22 -0
- package/icc-api/model/DataAttachment.js.map +1 -1
- package/icc-api/model/Document.d.ts +6 -0
- package/icc-api/model/Document.js.map +1 -1
- package/icc-api/model/Receipt.d.ts +6 -0
- package/icc-api/model/Receipt.js.map +1 -1
- package/icc-x-api/crypto/BaseExchangeDataManager.js +2 -2
- package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -1
- package/icc-x-api/crypto/ExchangeDataManager.js +3 -3
- package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtils.d.ts +1 -1
- package/icc-x-api/crypto/ExtendedApisUtils.js.map +1 -1
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.d.ts +1 -1
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +8 -2
- package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -1
- package/icc-x-api/crypto/RecoveryDataEncryption.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.js +7 -7
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.js +7 -7
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.js +4 -5
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-code-x-api.d.ts +2 -2
- package/icc-x-api/icc-code-x-api.js +3 -33
- package/icc-x-api/icc-code-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.js +20 -33
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +8 -7
- package/icc-x-api/icc-document-x-api.js +64 -22
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.js +3 -4
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.js +11 -11
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.js +3 -4
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.js +3 -3
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.js +29 -29
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +40 -0
- package/icc-x-api/icc-receipt-x-api.js +79 -1
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-topic-x-api.js.map +1 -1
- package/icc-x-api/utils/code-util.d.ts +23 -0
- package/icc-x-api/utils/code-util.js +39 -2
- package/icc-x-api/utils/code-util.js.map +1 -1
- package/icc-x-api/utils/collection-utils.d.ts +13 -0
- package/icc-x-api/utils/collection-utils.js +69 -0
- package/icc-x-api/utils/collection-utils.js.map +1 -1
- package/icc-x-api/utils/compression-utils.d.ts +28 -0
- package/icc-x-api/utils/compression-utils.js +106 -0
- package/icc-x-api/utils/compression-utils.js.map +1 -0
- package/icc-x-api/utils/crypto-utils.js +7 -7
- package/icc-x-api/utils/crypto-utils.js.map +1 -1
- package/icc-x-api/utils/formatting-util.d.ts +1 -3
- package/icc-x-api/utils/formatting-util.js +15 -17
- package/icc-x-api/utils/formatting-util.js.map +1 -1
- package/icc-x-api/utils/hcp-util.js +2 -3
- package/icc-x-api/utils/hcp-util.js.map +1 -1
- package/icc-x-api/utils/insurability-util.js +10 -8
- package/icc-x-api/utils/insurability-util.js.map +1 -1
- package/icc-x-api/utils/lzma-wasm.d.ts +6 -0
- package/icc-x-api/utils/lzma-wasm.js +81 -0
- package/icc-x-api/utils/lzma-wasm.js.map +1 -0
- package/icc-x-api/utils/mutex.d.ts +12 -0
- package/icc-x-api/utils/mutex.js +26 -0
- package/icc-x-api/utils/mutex.js.map +1 -0
- package/icc-x-api/utils/websocket.js +7 -7
- package/icc-x-api/utils/websocket.js.map +1 -1
- package/icc-x-api/wasm/lzma/lzma.js +2 -0
- package/icc-x-api/wasm/lzma/lzma.wasm +0 -0
- package/package.json +2 -11
- package/icc-x-api/utils/uuid-encoder.d.ts +0 -44
- package/icc-x-api/utils/uuid-encoder.js +0 -114
- package/icc-x-api/utils/uuid-encoder.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 -408
- 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-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-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 -165
- 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/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/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-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 -98
- 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 -109
- 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,155 +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 icc_x_api_1 = require("../../icc-x-api");
|
|
15
|
-
const Patient_1 = require("../../icc-api/model/Patient");
|
|
16
|
-
const chai_1 = require("chai");
|
|
17
|
-
const crypto_1 = require("crypto");
|
|
18
|
-
const test_utils_1 = require("../utils/test_utils");
|
|
19
|
-
const HealthElement_1 = require("../../icc-api/model/HealthElement");
|
|
20
|
-
const Code_1 = require("../../icc-api/model/Code");
|
|
21
|
-
const types_1 = require("@icure/test-setup/types");
|
|
22
|
-
const HealthElementByIdsFilter_1 = require("../../icc-x-api/filters/HealthElementByIdsFilter");
|
|
23
|
-
const FilterChainHealthElement_1 = require("../../icc-api/model/FilterChainHealthElement");
|
|
24
|
-
var initApi = test_utils_1.TestUtils.initApi;
|
|
25
|
-
const SecretIdUseOption_1 = require("../../icc-x-api/crypto/SecretIdUseOption");
|
|
26
|
-
var UseAnyConfidential = SecretIdUseOption_1.SecretIdUseOption.UseAnyConfidential;
|
|
27
|
-
(0, test_utils_1.setLocalStorage)(fetch);
|
|
28
|
-
let env;
|
|
29
|
-
function createPatient(patientApiForHcp, hcpUser) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
return patientApiForHcp.createPatientWithUser(hcpUser, yield patientApiForHcp.newInstance(hcpUser, new Patient_1.Patient({
|
|
32
|
-
id: (0, crypto_1.randomUUID)(),
|
|
33
|
-
firstName: 'John',
|
|
34
|
-
lastName: 'Snow',
|
|
35
|
-
note: 'Winter is coming',
|
|
36
|
-
})));
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function healthElementToCreate(hElementApiForHcp, hcpUser, patient) {
|
|
40
|
-
return hElementApiForHcp.newInstance(hcpUser, patient, new HealthElement_1.HealthElement({
|
|
41
|
-
id: (0, crypto_1.randomUUID)(),
|
|
42
|
-
codes: [new Code_1.Code({ type: 'LOINC', code: '95209', version: '3' })],
|
|
43
|
-
note: 'SARS-V2',
|
|
44
|
-
}), { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true });
|
|
45
|
-
}
|
|
46
|
-
describe('icc-helement-x-api Tests', () => {
|
|
47
|
-
(0, mocha_1.before)(function () {
|
|
48
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
this.timeout(600000);
|
|
50
|
-
const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
|
|
51
|
-
env = yield initializer.execute((0, types_1.getEnvVariables)());
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
it('CreateHealthElementWithUser Success for HCP', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
// Given
|
|
56
|
-
const { userApi: userApiForHcp, dataOwnerApi: dataOwnerApiForHcp, patientApi: patientApiForHcp, healthcareElementApi: hElementApiForHcp, cryptoApi: cryptoApiForHcp, } = yield initApi(env, test_utils_1.hcp1Username);
|
|
57
|
-
const hcpUser = yield userApiForHcp.getCurrentUser();
|
|
58
|
-
const patient = yield createPatient(patientApiForHcp, hcpUser);
|
|
59
|
-
const hElementToCreate = yield healthElementToCreate(hElementApiForHcp, hcpUser, patient);
|
|
60
|
-
// When
|
|
61
|
-
const createdHealthElement = yield hElementApiForHcp.createHealthElementWithUser(hcpUser, hElementToCreate);
|
|
62
|
-
// Then
|
|
63
|
-
const readHealthElement = yield hElementApiForHcp.getHealthElementWithUser(hcpUser, createdHealthElement.id);
|
|
64
|
-
(0, chai_1.assert)(readHealthElement != null);
|
|
65
|
-
(0, chai_1.assert)(readHealthElement.id != null);
|
|
66
|
-
(0, chai_1.assert)(readHealthElement.note == hElementToCreate.note);
|
|
67
|
-
(0, chai_1.expect)(yield cryptoApiForHcp.xapi.encryptionKeysOf({ entity: readHealthElement, type: icc_x_api_1.EntityWithDelegationTypeName.HealthElement }, undefined)).to.have.length(1);
|
|
68
|
-
const decryptedPatientIds = yield hElementApiForHcp.decryptPatientIdOf(readHealthElement);
|
|
69
|
-
(0, chai_1.expect)(decryptedPatientIds).to.have.length(1);
|
|
70
|
-
(0, chai_1.expect)(decryptedPatientIds[0]).to.equal(patient.id);
|
|
71
|
-
}));
|
|
72
|
-
it('ModifyHealthElementWithUser Success for HCP', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
-
// Given
|
|
74
|
-
const { userApi: userApiForHcp, dataOwnerApi: dataOwnerApiForHcp, patientApi: patientApiForHcp, healthcareElementApi: hElementApiForHcp, cryptoApi: cryptoApiForHcp, } = yield initApi(env, test_utils_1.hcp1Username);
|
|
75
|
-
const hcpUser = yield userApiForHcp.getCurrentUser();
|
|
76
|
-
yield initApi(env, test_utils_1.hcp1Username);
|
|
77
|
-
const patient = yield createPatient(patientApiForHcp, hcpUser);
|
|
78
|
-
const createdHealthElement = yield hElementApiForHcp.createHealthElementWithUser(hcpUser, yield healthElementToCreate(hElementApiForHcp, hcpUser, patient));
|
|
79
|
-
// When
|
|
80
|
-
const newNote = 'SARS-V2 (COVID-19)';
|
|
81
|
-
const modifiedHealthElement = yield hElementApiForHcp.modifyHealthElementWithUser(hcpUser, Object.assign(Object.assign({}, createdHealthElement), { note: newNote }));
|
|
82
|
-
// Then
|
|
83
|
-
const readHealthElement = yield hElementApiForHcp.getHealthElementWithUser(hcpUser, createdHealthElement.id);
|
|
84
|
-
(0, chai_1.assert)(readHealthElement != null);
|
|
85
|
-
(0, chai_1.assert)(readHealthElement.id != null);
|
|
86
|
-
(0, chai_1.assert)(readHealthElement.note != createdHealthElement.note);
|
|
87
|
-
(0, chai_1.assert)(readHealthElement.note == modifiedHealthElement.note);
|
|
88
|
-
(0, chai_1.assert)(readHealthElement.note == newNote);
|
|
89
|
-
(0, chai_1.expect)(yield cryptoApiForHcp.xapi.encryptionKeysOf({ entity: readHealthElement, type: icc_x_api_1.EntityWithDelegationTypeName.HealthElement }, undefined)).to.have.length(1);
|
|
90
|
-
const decryptedPatientIds = yield hElementApiForHcp.decryptPatientIdOf(readHealthElement);
|
|
91
|
-
(0, chai_1.expect)(decryptedPatientIds).to.have.length(1);
|
|
92
|
-
(0, chai_1.expect)(decryptedPatientIds[0]).to.equal(patient.id);
|
|
93
|
-
}));
|
|
94
|
-
it('findHealthElementsByHCPartyAndPatientWithUser Success for HCP', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
|
-
// Given
|
|
96
|
-
const { userApi: userApiForHcp, dataOwnerApi: dataOwnerApiForHcp, patientApi: patientApiForHcp, healthcareElementApi: hElementApiForHcp, cryptoApi: cryptoApiForHcp, } = yield initApi(env, test_utils_1.hcp1Username);
|
|
97
|
-
const hcpUser = yield userApiForHcp.getCurrentUser();
|
|
98
|
-
const patient = (yield createPatient(patientApiForHcp, hcpUser));
|
|
99
|
-
const createdHealthElement = yield hElementApiForHcp.createHealthElementWithUser(hcpUser, yield healthElementToCreate(hElementApiForHcp, hcpUser, patient));
|
|
100
|
-
// When
|
|
101
|
-
const foundHealthElements = yield hElementApiForHcp.findHealthElementsByHCPartyAndPatientWithUser(hcpUser, hcpUser.healthcarePartyId, patient);
|
|
102
|
-
const foundHealthElementsUsingPost = yield hElementApiForHcp.findHealthElementsByHCPartyAndPatientWithUser(hcpUser, hcpUser.healthcarePartyId, patient, true);
|
|
103
|
-
// Then
|
|
104
|
-
(0, chai_1.assert)(foundHealthElements.length == 1, 'Found health elements should be 1');
|
|
105
|
-
(0, chai_1.assert)(foundHealthElements[0].id == createdHealthElement.id, 'Found health element should be the same as the created one');
|
|
106
|
-
(0, chai_1.assert)(foundHealthElementsUsingPost.length == 1, 'Found health elements using POST should be 1');
|
|
107
|
-
(0, chai_1.assert)(foundHealthElementsUsingPost[0].id == createdHealthElement.id, 'Found health element using POST should be the same as the created one');
|
|
108
|
-
}));
|
|
109
|
-
it('filter healthcare element result should return same output by id', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
|
-
var _a;
|
|
111
|
-
// Given
|
|
112
|
-
const { userApi: userApiForHcp, dataOwnerApi: dataOwnerApiForHcp, patientApi: patientApiForHcp, healthcareElementApi: hElementApiForHcp, cryptoApi: cryptoApiForHcp, } = yield initApi(env, test_utils_1.hcp1Username);
|
|
113
|
-
const hcpUser = yield userApiForHcp.getCurrentUser();
|
|
114
|
-
const patient = (yield createPatient(patientApiForHcp, hcpUser));
|
|
115
|
-
const createdHealthElement = yield hElementApiForHcp.createHealthElementWithUser(hcpUser, yield healthElementToCreate(hElementApiForHcp, hcpUser, patient));
|
|
116
|
-
// When
|
|
117
|
-
const healthElementById = yield hElementApiForHcp.getHealthElementWithUser(hcpUser, createdHealthElement.id);
|
|
118
|
-
const healthElementByFilter = yield hElementApiForHcp.filterByWithUser(hcpUser, undefined, undefined, new FilterChainHealthElement_1.FilterChainHealthElement({
|
|
119
|
-
filter: new HealthElementByIdsFilter_1.HealthElementByIdsFilter({
|
|
120
|
-
ids: [createdHealthElement.id],
|
|
121
|
-
healthcarePartyId: hcpUser.healthcarePartyId,
|
|
122
|
-
}),
|
|
123
|
-
}));
|
|
124
|
-
// Then
|
|
125
|
-
// expect(foundHealthElements).to.have.length(1)
|
|
126
|
-
// expect(foundHealthElements[0].id).to.equal(createdHealthElement.id)
|
|
127
|
-
(0, chai_1.assert)(((_a = healthElementByFilter.rows) === null || _a === void 0 ? void 0 : _a.length) == 1, 'Found health elements should be 1');
|
|
128
|
-
(0, chai_1.assert)(healthElementByFilter.rows[0].id == createdHealthElement.id, 'Found health element should be the same as the created one');
|
|
129
|
-
(0, chai_1.assert)(!!healthElementById.note, 'Health element should have a note');
|
|
130
|
-
(0, chai_1.assert)(JSON.stringify(healthElementByFilter.rows[0]) === JSON.stringify(healthElementById), 'Found health elements by id should match the one found by filter');
|
|
131
|
-
}));
|
|
132
|
-
it('Share with should work as expected', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
-
const api1 = yield initApi(env, test_utils_1.hcp1Username);
|
|
134
|
-
const user1 = yield api1.userApi.getCurrentUser();
|
|
135
|
-
const api2 = yield initApi(env, test_utils_1.hcp2Username);
|
|
136
|
-
const user2 = yield api2.userApi.getCurrentUser();
|
|
137
|
-
const samplePatient = yield api1.patientApi.createPatientWithUser(user1, yield api1.patientApi.newInstance(user1, { firstName: 'Gigio', lastName: 'Bagigio' }));
|
|
138
|
-
const encryptedField = 'Something encrypted';
|
|
139
|
-
const entity = yield api1.healthcareElementApi.createHealthElementWithUser(user1, yield api1.healthcareElementApi.newInstance(user1, samplePatient, { note: encryptedField }));
|
|
140
|
-
(0, chai_1.expect)(entity.note).to.be.equal(encryptedField);
|
|
141
|
-
yield api2.healthcareElementApi
|
|
142
|
-
.getHealthElementWithUser(user2, entity.id)
|
|
143
|
-
.then(() => {
|
|
144
|
-
throw new Error('Should not be able to get the entity');
|
|
145
|
-
})
|
|
146
|
-
.catch(() => {
|
|
147
|
-
/* expected */
|
|
148
|
-
});
|
|
149
|
-
yield api1.healthcareElementApi.shareWith(user2.healthcarePartyId, entity);
|
|
150
|
-
const retrieved = yield api2.healthcareElementApi.getHealthElementWithUser(user2, entity.id);
|
|
151
|
-
(0, chai_1.expect)(retrieved.note).to.be.equal(encryptedField);
|
|
152
|
-
(0, chai_1.expect)((yield api2.healthcareElementApi.decryptPatientIdOf(retrieved))[0]).to.equal(samplePatient.id);
|
|
153
|
-
}));
|
|
154
|
-
});
|
|
155
|
-
//# sourceMappingURL=icc-helement-x-api-test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icc-helement-x-api-test.js","sourceRoot":"","sources":["../../../test/icc-x-api/icc-helement-x-api-test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAA8B;AAE9B,4BAAyB;AAEzB,+CAA+F;AAC/F,yDAAqD;AACrD,+BAAqC;AACrC,mCAAmC;AACnC,oDAAuH;AACvH,qEAAiE;AACjE,mDAA+C;AAE/C,mDAAmE;AACnE,+FAA2F;AAC3F,2FAAuF;AACvF,IAAO,OAAO,GAAG,sBAAS,CAAC,OAAO,CAAA;AAClC,gFAA4E;AAC5E,IAAO,k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,CAAC,cAAc,CAAC,CAAA;QAClD,IAAA,aAAM,EAAC,CAAC,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;IACvG,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { before } from 'mocha'\n\nimport 'isomorphic-fetch'\n\nimport { EntityWithDelegationTypeName, IccHelementXApi, IccPatientXApi } from '../../icc-x-api'\nimport { Patient } from '../../icc-api/model/Patient'\nimport { assert, expect } from 'chai'\nimport { randomUUID } from 'crypto'\nimport { getEnvironmentInitializer, hcp1Username, hcp2Username, setLocalStorage, TestUtils } from '../utils/test_utils'\nimport { HealthElement } from '../../icc-api/model/HealthElement'\nimport { Code } from '../../icc-api/model/Code'\nimport { User } from '../../icc-api/model/User'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\nimport { HealthElementByIdsFilter } from '../../icc-x-api/filters/HealthElementByIdsFilter'\nimport { FilterChainHealthElement } from '../../icc-api/model/FilterChainHealthElement'\nimport initApi = TestUtils.initApi\nimport { SecretIdUseOption } from '../../icc-x-api/crypto/SecretIdUseOption'\nimport UseAnyConfidential = SecretIdUseOption.UseAnyConfidential\n\nsetLocalStorage(fetch)\nlet env: TestVars\n\nasync 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\nfunction healthElementToCreate(hElementApiForHcp: IccHelementXApi, hcpUser: User, patient: Patient) {\n return hElementApiForHcp.newInstance(\n hcpUser,\n patient,\n new HealthElement({\n id: randomUUID(),\n codes: [new Code({ type: 'LOINC', code: '95209', version: '3' })],\n note: 'SARS-V2',\n }),\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n}\n\ndescribe('icc-helement-x-api Tests', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n it('CreateHealthElementWithUser Success for HCP', async () => {\n // Given\n const {\n userApi: userApiForHcp,\n dataOwnerApi: dataOwnerApiForHcp,\n patientApi: patientApiForHcp,\n healthcareElementApi: hElementApiForHcp,\n cryptoApi: cryptoApiForHcp,\n } = await initApi(env, hcp1Username)\n\n const hcpUser = await userApiForHcp.getCurrentUser()\n\n const patient = await createPatient(patientApiForHcp, hcpUser)\n const hElementToCreate = await healthElementToCreate(hElementApiForHcp, hcpUser, patient)\n\n // When\n const createdHealthElement = await hElementApiForHcp.createHealthElementWithUser(hcpUser, hElementToCreate)\n\n // Then\n const readHealthElement = await hElementApiForHcp.getHealthElementWithUser(hcpUser, createdHealthElement.id!)\n assert(readHealthElement != null)\n assert(readHealthElement.id != null)\n assert(readHealthElement.note == hElementToCreate.note)\n expect(\n await cryptoApiForHcp.xapi.encryptionKeysOf({ entity: readHealthElement, type: EntityWithDelegationTypeName.HealthElement }, undefined)\n ).to.have.length(1)\n const decryptedPatientIds = await hElementApiForHcp.decryptPatientIdOf(readHealthElement)\n expect(decryptedPatientIds).to.have.length(1)\n expect(decryptedPatientIds[0]).to.equal(patient.id)\n })\n\n it('ModifyHealthElementWithUser Success for HCP', async () => {\n // Given\n const {\n userApi: userApiForHcp,\n dataOwnerApi: dataOwnerApiForHcp,\n patientApi: patientApiForHcp,\n healthcareElementApi: hElementApiForHcp,\n cryptoApi: cryptoApiForHcp,\n } = await initApi(env!, hcp1Username)\n\n const hcpUser = await userApiForHcp.getCurrentUser()\n await initApi(env!, hcp1Username)\n\n const patient = await createPatient(patientApiForHcp, hcpUser)\n const createdHealthElement = await hElementApiForHcp.createHealthElementWithUser(\n hcpUser,\n await healthElementToCreate(hElementApiForHcp, hcpUser, patient)\n )\n\n // When\n const newNote = 'SARS-V2 (COVID-19)'\n const modifiedHealthElement = await hElementApiForHcp.modifyHealthElementWithUser(hcpUser, {\n ...createdHealthElement,\n note: newNote,\n })\n\n // Then\n const readHealthElement = await hElementApiForHcp.getHealthElementWithUser(hcpUser, createdHealthElement.id!)\n assert(readHealthElement != null)\n assert(readHealthElement.id != null)\n assert(readHealthElement.note != createdHealthElement.note)\n assert(readHealthElement.note == modifiedHealthElement.note)\n assert(readHealthElement.note == newNote)\n expect(\n await cryptoApiForHcp.xapi.encryptionKeysOf({ entity: readHealthElement, type: EntityWithDelegationTypeName.HealthElement }, undefined)\n ).to.have.length(1)\n const decryptedPatientIds = await hElementApiForHcp.decryptPatientIdOf(readHealthElement)\n expect(decryptedPatientIds).to.have.length(1)\n expect(decryptedPatientIds[0]).to.equal(patient.id)\n })\n\n it('findHealthElementsByHCPartyAndPatientWithUser Success for HCP', async () => {\n // Given\n const {\n userApi: userApiForHcp,\n dataOwnerApi: dataOwnerApiForHcp,\n patientApi: patientApiForHcp,\n healthcareElementApi: hElementApiForHcp,\n cryptoApi: cryptoApiForHcp,\n } = await initApi(env!, hcp1Username)\n\n const hcpUser = await userApiForHcp.getCurrentUser()\n\n const patient = (await createPatient(patientApiForHcp, hcpUser)) as Patient\n const createdHealthElement = await hElementApiForHcp.createHealthElementWithUser(\n hcpUser,\n await healthElementToCreate(hElementApiForHcp, hcpUser, patient)\n )\n\n // When\n const foundHealthElements = await hElementApiForHcp.findHealthElementsByHCPartyAndPatientWithUser(hcpUser, hcpUser.healthcarePartyId!, patient)\n const foundHealthElementsUsingPost = await hElementApiForHcp.findHealthElementsByHCPartyAndPatientWithUser(\n hcpUser,\n hcpUser.healthcarePartyId!,\n patient,\n true\n )\n\n // Then\n assert(foundHealthElements.length == 1, 'Found health elements should be 1')\n assert(foundHealthElements[0].id == createdHealthElement.id, 'Found health element should be the same as the created one')\n\n assert(foundHealthElementsUsingPost.length == 1, 'Found health elements using POST should be 1')\n assert(foundHealthElementsUsingPost[0].id == createdHealthElement.id, 'Found health element using POST should be the same as the created one')\n })\n\n it('filter healthcare element result should return same output by id', async () => {\n // Given\n const {\n userApi: userApiForHcp,\n dataOwnerApi: dataOwnerApiForHcp,\n patientApi: patientApiForHcp,\n healthcareElementApi: hElementApiForHcp,\n cryptoApi: cryptoApiForHcp,\n } = await initApi(env!, hcp1Username)\n const hcpUser = await userApiForHcp.getCurrentUser()\n\n const patient = (await createPatient(patientApiForHcp, hcpUser)) as Patient\n const createdHealthElement = await hElementApiForHcp.createHealthElementWithUser(\n hcpUser,\n await healthElementToCreate(hElementApiForHcp, hcpUser, patient)\n )\n\n // When\n const healthElementById = await hElementApiForHcp.getHealthElementWithUser(hcpUser, createdHealthElement.id)\n const healthElementByFilter = await hElementApiForHcp.filterByWithUser(\n hcpUser,\n undefined,\n undefined,\n new FilterChainHealthElement({\n filter: new HealthElementByIdsFilter({\n ids: [createdHealthElement.id!],\n healthcarePartyId: hcpUser.healthcarePartyId!,\n }),\n })\n )\n\n // Then\n // expect(foundHealthElements).to.have.length(1)\n // expect(foundHealthElements[0].id).to.equal(createdHealthElement.id)\n assert(healthElementByFilter.rows?.length == 1, 'Found health elements should be 1')\n assert(healthElementByFilter.rows[0].id == createdHealthElement.id, 'Found health element should be the same as the created one')\n\n assert(!!healthElementById.note, 'Health element should have a note')\n\n assert(\n JSON.stringify(healthElementByFilter.rows[0]) === JSON.stringify(healthElementById),\n 'Found health elements by id should match the one found by filter'\n )\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.healthcareElementApi.createHealthElementWithUser(\n user1,\n await api1.healthcareElementApi.newInstance(user1, samplePatient, { note: encryptedField })\n )\n expect(entity.note).to.be.equal(encryptedField)\n await api2.healthcareElementApi\n .getHealthElementWithUser(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.healthcareElementApi.shareWith(user2.healthcarePartyId!, entity)\n const retrieved = await api2.healthcareElementApi.getHealthElementWithUser(user2, entity.id)\n expect(retrieved.note).to.be.equal(encryptedField)\n expect((await api2.healthcareElementApi.decryptPatientIdOf(retrieved))[0]).to.equal(samplePatient.id)\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'isomorphic-fetch';
|
|
@@ -1,99 +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 Patient_1 = require("../../icc-api/model/Patient");
|
|
18
|
-
const crypto_1 = require("crypto");
|
|
19
|
-
const Invoice_1 = require("../../icc-api/model/Invoice");
|
|
20
|
-
const chai_1 = require("chai");
|
|
21
|
-
const types_1 = require("@icure/test-setup/types");
|
|
22
|
-
var initApi = test_utils_1.TestUtils.initApi;
|
|
23
|
-
const AuthenticationProvider_1 = require("../../icc-x-api/auth/AuthenticationProvider");
|
|
24
|
-
(0, test_utils_1.setLocalStorage)(fetch);
|
|
25
|
-
let env;
|
|
26
|
-
describe('icc-calendar-item-x-api Tests', () => {
|
|
27
|
-
(0, mocha_1.before)(function () {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
this.timeout(600000);
|
|
30
|
-
const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
|
|
31
|
-
env = yield initializer.execute((0, types_1.getEnvVariables)());
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
function createPatient(patientApiForHcp, hcpUser) {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
return patientApiForHcp.createPatientWithUser(hcpUser, yield patientApiForHcp.newInstance(hcpUser, new Patient_1.Patient({
|
|
37
|
-
id: (0, crypto_1.randomUUID)(),
|
|
38
|
-
firstName: 'John',
|
|
39
|
-
lastName: 'Snow',
|
|
40
|
-
note: 'Winter is coming',
|
|
41
|
-
})));
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
it('Test', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
// Given
|
|
46
|
-
const username = env.dataOwnerDetails[test_utils_1.hcp1Username].user;
|
|
47
|
-
const password = env.dataOwnerDetails[test_utils_1.hcp1Username].password;
|
|
48
|
-
const authProvider = new AuthenticationProvider_1.BasicAuthenticationProvider(username, password);
|
|
49
|
-
const userApi = new icc_x_api_1.IccUserXApi(env.iCureUrl, {}, authProvider, null, fetch);
|
|
50
|
-
const invoiceApi = new icc_api_1.IccInvoiceApi(env.iCureUrl, {}, authProvider, fetch);
|
|
51
|
-
const currentUser = yield userApi.getCurrentUser();
|
|
52
|
-
}));
|
|
53
|
-
it('Test findBy not usingPost', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
-
// Given
|
|
55
|
-
const { userApi: userApiForHcp, dataOwnerApi: dataOwnerApiForHcp, patientApi: patientApiForHcp, cryptoApi: cryptoApiForHcp, dataOwnerApi: dateOwnerApiForHcp, entityReferenceApi: entityReferenceApiForHcp, invoiceApi: invoiceXApi, } = yield initApi(env, test_utils_1.hcp1Username);
|
|
56
|
-
const hcpUser = yield userApiForHcp.getCurrentUser();
|
|
57
|
-
const patient = (yield createPatient(patientApiForHcp, hcpUser));
|
|
58
|
-
const invoice = new Invoice_1.Invoice({
|
|
59
|
-
id: (0, crypto_1.randomUUID)(),
|
|
60
|
-
created: new Date().getTime(),
|
|
61
|
-
modified: new Date().getTime(),
|
|
62
|
-
date: +new Date(),
|
|
63
|
-
responsible: hcpUser.healthcarePartyId,
|
|
64
|
-
author: hcpUser.id,
|
|
65
|
-
codes: [],
|
|
66
|
-
tags: [],
|
|
67
|
-
user: hcpUser.id,
|
|
68
|
-
patient: patient.id,
|
|
69
|
-
});
|
|
70
|
-
const invoiceToCreate = yield invoiceXApi.newInstance(hcpUser, patient, invoice);
|
|
71
|
-
const createdInvoice = yield invoiceXApi.createInvoice(invoiceToCreate);
|
|
72
|
-
const foundItems = yield invoiceXApi.findBy(hcpUser.healthcarePartyId, patient, false);
|
|
73
|
-
const foundItemsUsingPost = yield invoiceXApi.findBy(hcpUser.healthcarePartyId, patient, true);
|
|
74
|
-
(0, chai_1.assert)(foundItems.length == 1, 'Found items should be 1');
|
|
75
|
-
(0, chai_1.assert)(foundItems[0].id == createdInvoice.id, 'Found item should be the created invoice');
|
|
76
|
-
(0, chai_1.assert)(foundItemsUsingPost.length == 1, 'Found items using post should be 1');
|
|
77
|
-
(0, chai_1.assert)(foundItemsUsingPost[0].id == createdInvoice.id, 'Found item using post should be the created invoice');
|
|
78
|
-
}));
|
|
79
|
-
it('Share with should work as expected', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
|
-
const api1 = yield initApi(env, test_utils_1.hcp1Username);
|
|
81
|
-
const user1 = yield api1.userApi.getCurrentUser();
|
|
82
|
-
const api2 = yield initApi(env, test_utils_1.hcp2Username);
|
|
83
|
-
const user2 = yield api2.userApi.getCurrentUser();
|
|
84
|
-
const samplePatient = yield api1.patientApi.createPatientWithUser(user1, yield api1.patientApi.newInstance(user1, { firstName: 'Gigio', lastName: 'Bagigio' }));
|
|
85
|
-
const entity = yield api1.invoiceApi.createInvoice(yield api1.invoiceApi.newInstance(user1, samplePatient));
|
|
86
|
-
yield api2.invoiceApi
|
|
87
|
-
.getInvoice(entity.id)
|
|
88
|
-
.then(() => {
|
|
89
|
-
throw new Error('Should not be able to get the entity');
|
|
90
|
-
})
|
|
91
|
-
.catch(() => {
|
|
92
|
-
/* expected */
|
|
93
|
-
});
|
|
94
|
-
yield api1.invoiceApi.shareWith(user2.healthcarePartyId, entity);
|
|
95
|
-
const retrieved = yield api2.invoiceApi.getInvoice(entity.id);
|
|
96
|
-
(0, chai_1.expect)((yield api2.invoiceApi.decryptPatientIdOf(retrieved))[0]).to.equal(samplePatient.id);
|
|
97
|
-
}));
|
|
98
|
-
});
|
|
99
|
-
//# sourceMappingURL=icc-invoice-x-api.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icc-invoice-x-api.js","sourceRoot":"","sources":["../../../test/icc-x-api/icc-invoice-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4BAAyB;AACzB,oDAAuH;AACvH,iCAA8B;AAC9B,+CAA6D;AAC7D,2CAA6C;AAC7C,yDAAqD;AAErD,mCAAmC;AACnC,yDAAqD;AACrD,+BAAqC;AACrC,mDAAmE;AACnE,IAAO,OAAO,GAAG,sBAAS,CAAC,OAAO,CAAA;AAClC,wFAAyF;AAEzF,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAA;AACtB,IAAI,GAAa,CAAA;AAEjB,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,IAAA,cAAM,EAAC;;YACL,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,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C,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,cAAc;QAChB,CAAC,CAAC,CAAA;QACJ,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,iBAAkB,EAAE,MAAM,CAAC,CAAA;QACjE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,EAAG,CAAC,CAAA;QAC9D,IAAA,aAAM,EAAC,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;IAC7F,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 { IccInvoiceApi } from '../../icc-api'\nimport { Patient } from '../../icc-api/model/Patient'\nimport { User } from '../../icc-api/model/User'\nimport { randomUUID } from 'crypto'\nimport { Invoice } from '../../icc-api/model/Invoice'\nimport { assert, expect } from 'chai'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\nimport initApi = TestUtils.initApi\nimport { BasicAuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider'\n\nsetLocalStorage(fetch)\nlet env: TestVars\n\ndescribe('icc-calendar-item-x-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 invoiceApi = new IccInvoiceApi(env.iCureUrl, {}, authProvider, fetch)\n\n const currentUser = await userApi.getCurrentUser()\n })\n\n it('Test findBy not usingPost', async () => {\n // Given\n const {\n userApi: userApiForHcp,\n dataOwnerApi: dataOwnerApiForHcp,\n patientApi: patientApiForHcp,\n cryptoApi: cryptoApiForHcp,\n dataOwnerApi: dateOwnerApiForHcp,\n entityReferenceApi: entityReferenceApiForHcp,\n invoiceApi: invoiceXApi,\n } = await initApi(env, hcp1Username)\n const hcpUser = await userApiForHcp.getCurrentUser()\n\n const patient = (await createPatient(patientApiForHcp, hcpUser)) as Patient\n\n const invoice = new Invoice({\n id: randomUUID(),\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 })\n\n const invoiceToCreate = await invoiceXApi.newInstance(hcpUser, patient, invoice)\n const createdInvoice = await invoiceXApi.createInvoice(invoiceToCreate)\n\n const foundItems = await invoiceXApi.findBy(hcpUser.healthcarePartyId!, patient, false)\n const foundItemsUsingPost = await invoiceXApi.findBy(hcpUser.healthcarePartyId!, patient, true)\n\n assert(foundItems.length == 1, 'Found items should be 1')\n assert(foundItems[0].id == createdInvoice.id, 'Found item should be the created invoice')\n\n assert(foundItemsUsingPost.length == 1, 'Found items using post should be 1')\n assert(foundItemsUsingPost[0].id == createdInvoice.id, 'Found item using post should be the created invoice')\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 entity = await api1.invoiceApi.createInvoice(await api1.invoiceApi.newInstance(user1, samplePatient))\n await api2.invoiceApi\n .getInvoice(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.invoiceApi.shareWith(user2.healthcarePartyId!, entity)\n const retrieved = await api2.invoiceApi.getInvoice(entity.id!)\n expect((await api2.invoiceApi.decryptPatientIdOf(retrieved))[0]).to.equal(samplePatient.id)\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'isomorphic-fetch';
|
|
@@ -1,222 +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 icc_x_api_1 = require("../../icc-x-api");
|
|
15
|
-
const chai_1 = require("chai");
|
|
16
|
-
const crypto_1 = require("crypto");
|
|
17
|
-
const test_utils_1 = require("../utils/test_utils");
|
|
18
|
-
const MaintenanceTask_1 = require("../../icc-api/model/MaintenanceTask");
|
|
19
|
-
const PropertyStub_1 = require("../../icc-api/model/PropertyStub");
|
|
20
|
-
const PropertyTypeStub_1 = require("../../icc-api/model/PropertyTypeStub");
|
|
21
|
-
const TypedValueObject_1 = require("../../icc-api/model/TypedValueObject");
|
|
22
|
-
const Identifier_1 = require("../../icc-api/model/Identifier");
|
|
23
|
-
const FilterChainMaintenanceTask_1 = require("../../icc-api/model/FilterChainMaintenanceTask");
|
|
24
|
-
const MaintenanceTaskByIdsFilter_1 = require("../../icc-x-api/filters/MaintenanceTaskByIdsFilter");
|
|
25
|
-
const MaintenanceTaskByHcPartyAndTypeFilter_1 = require("../../icc-x-api/filters/MaintenanceTaskByHcPartyAndTypeFilter");
|
|
26
|
-
var initApi = test_utils_1.TestUtils.initApi;
|
|
27
|
-
const MaintenanceTaskAfterDateFilter_1 = require("../../icc-x-api/filters/MaintenanceTaskAfterDateFilter");
|
|
28
|
-
const SecureDelegation_1 = require("../../icc-api/model/SecureDelegation");
|
|
29
|
-
var AccessLevel = SecureDelegation_1.SecureDelegation.AccessLevelEnum;
|
|
30
|
-
const types_1 = require("@icure/test-setup/types");
|
|
31
|
-
(0, test_utils_1.setLocalStorage)(fetch);
|
|
32
|
-
let env;
|
|
33
|
-
function maintenanceTaskToCreate(mTaskApiForHcp, hcpUser, delegatedTo) {
|
|
34
|
-
return mTaskApiForHcp.newInstance(hcpUser, new MaintenanceTask_1.MaintenanceTask({
|
|
35
|
-
id: (0, crypto_1.randomUUID)(),
|
|
36
|
-
taskType: (0, crypto_1.randomUUID)(),
|
|
37
|
-
status: MaintenanceTask_1.MaintenanceTask.StatusEnum.Pending,
|
|
38
|
-
properties: [
|
|
39
|
-
new PropertyStub_1.PropertyStub({
|
|
40
|
-
id: 'dataOwnerConcernedId',
|
|
41
|
-
type: new PropertyTypeStub_1.PropertyTypeStub({ type: PropertyTypeStub_1.PropertyTypeStub.TypeEnum.STRING }),
|
|
42
|
-
typedValue: new TypedValueObject_1.TypedValueObject({
|
|
43
|
-
type: TypedValueObject_1.TypedValueObject.TypeEnum.STRING,
|
|
44
|
-
stringValue: delegatedTo.id,
|
|
45
|
-
}),
|
|
46
|
-
}),
|
|
47
|
-
new PropertyStub_1.PropertyStub({
|
|
48
|
-
id: 'dataOwnerConcernedPubKey',
|
|
49
|
-
type: new PropertyTypeStub_1.PropertyTypeStub({ type: PropertyTypeStub_1.PropertyTypeStub.TypeEnum.STRING }),
|
|
50
|
-
typedValue: new TypedValueObject_1.TypedValueObject({
|
|
51
|
-
type: TypedValueObject_1.TypedValueObject.TypeEnum.STRING,
|
|
52
|
-
stringValue: delegatedTo.publicKey,
|
|
53
|
-
}),
|
|
54
|
-
}),
|
|
55
|
-
],
|
|
56
|
-
}), { additionalDelegates: { [delegatedTo.id]: AccessLevel.WRITE } });
|
|
57
|
-
}
|
|
58
|
-
let apiForHcp1;
|
|
59
|
-
let hcp1User;
|
|
60
|
-
let hcp1;
|
|
61
|
-
let apiForHcp2;
|
|
62
|
-
let hcp2User;
|
|
63
|
-
let hcp2;
|
|
64
|
-
describe('icc-x-maintenance-task-api Tests', () => {
|
|
65
|
-
(0, mocha_1.before)(function () {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
this.timeout(600000);
|
|
68
|
-
const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
|
|
69
|
-
env = yield initializer.execute((0, types_1.getEnvVariables)());
|
|
70
|
-
const hierarchicalHcps = yield (0, test_utils_1.createHcpHierarchyApis)(env);
|
|
71
|
-
apiForHcp1 = hierarchicalHcps.grandApi;
|
|
72
|
-
hcp1User = yield apiForHcp1.userApi.getCurrentUser();
|
|
73
|
-
hcp1 = yield apiForHcp1.healthcarePartyApi.getCurrentHealthcareParty();
|
|
74
|
-
apiForHcp2 = hierarchicalHcps.parentApi;
|
|
75
|
-
hcp2User = yield apiForHcp2.userApi.getCurrentUser();
|
|
76
|
-
hcp2 = yield apiForHcp2.healthcarePartyApi.getCurrentHealthcareParty();
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
it('CreateMaintenanceTaskWithUser Success for HCP', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
|
-
var _a, _b;
|
|
81
|
-
// Given
|
|
82
|
-
const taskToCreate = yield maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp2);
|
|
83
|
-
// When
|
|
84
|
-
const createdTask = yield apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(hcp1User, taskToCreate);
|
|
85
|
-
// Then
|
|
86
|
-
(0, chai_1.assert)(createdTask != null);
|
|
87
|
-
(0, chai_1.assert)(createdTask.id == taskToCreate.id);
|
|
88
|
-
const keysFor1 = yield apiForHcp1.cryptoApi.xapi.encryptionKeysOf({ entity: createdTask, type: icc_x_api_1.EntityWithDelegationTypeName.MaintenanceTask }, undefined);
|
|
89
|
-
(0, chai_1.expect)(keysFor1).to.have.length(1);
|
|
90
|
-
const foundTask = yield apiForHcp2.maintenanceTaskApi.getMaintenanceTaskWithUser(hcp2User, createdTask.id);
|
|
91
|
-
(0, chai_1.assert)(foundTask.id == createdTask.id);
|
|
92
|
-
(0, chai_1.assert)(((_a = foundTask.properties) === null || _a === void 0 ? void 0 : _a.find((prop) => { var _a; return ((_a = prop.typedValue) === null || _a === void 0 ? void 0 : _a.stringValue) == hcp2.id; })) != undefined);
|
|
93
|
-
(0, chai_1.assert)(((_b = foundTask.properties) === null || _b === void 0 ? void 0 : _b.find((prop) => { var _a; return ((_a = prop.typedValue) === null || _a === void 0 ? void 0 : _a.stringValue) == hcp2.publicKey; })) != undefined);
|
|
94
|
-
const keysFor2 = yield apiForHcp2.cryptoApi.xapi.encryptionKeysOf({ entity: createdTask, type: icc_x_api_1.EntityWithDelegationTypeName.MaintenanceTask }, undefined);
|
|
95
|
-
(0, chai_1.expect)(keysFor2).to.have.length(1);
|
|
96
|
-
(0, chai_1.expect)(keysFor2[0]).to.equal(keysFor1[0]);
|
|
97
|
-
})).timeout(30000);
|
|
98
|
-
it('ModifyMaintenanceTaskWithUser Success for HCP', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
99
|
-
var _a, _b, _c;
|
|
100
|
-
// Given
|
|
101
|
-
const createdTask = (yield apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(hcp1User, yield maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)));
|
|
102
|
-
const identifierToAdd = new Identifier_1.Identifier({ id: 'SYSTEM-TEST|VALUE-TEST', system: 'SYSTEM-TEST', value: 'VALUE-TEST' });
|
|
103
|
-
// When
|
|
104
|
-
const updatedTask = yield apiForHcp1.maintenanceTaskApi.modifyMaintenanceTaskWithUser(hcp1User, new MaintenanceTask_1.MaintenanceTask(Object.assign(Object.assign({}, createdTask), { identifier: [identifierToAdd], status: MaintenanceTask_1.MaintenanceTask.StatusEnum.Ongoing })));
|
|
105
|
-
// Then
|
|
106
|
-
(0, chai_1.assert)(updatedTask.id == createdTask.id);
|
|
107
|
-
(0, chai_1.assert)(((_a = updatedTask.identifier) === null || _a === void 0 ? void 0 : _a[0].system) == identifierToAdd.system);
|
|
108
|
-
(0, chai_1.assert)(((_b = updatedTask.identifier) === null || _b === void 0 ? void 0 : _b[0].value) == identifierToAdd.value);
|
|
109
|
-
(0, chai_1.assert)(((_c = updatedTask.identifier) === null || _c === void 0 ? void 0 : _c[0].id) == identifierToAdd.id);
|
|
110
|
-
(0, chai_1.assert)(updatedTask.status == MaintenanceTask_1.MaintenanceTask.StatusEnum.Ongoing);
|
|
111
|
-
}));
|
|
112
|
-
it('DeleteMaintenanceTaskWithUser Success for delegated HCP', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
113
|
-
// Given
|
|
114
|
-
const createdTask = (yield apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(hcp1User, yield maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)));
|
|
115
|
-
(0, chai_1.assert)(!!createdTask.id);
|
|
116
|
-
// When
|
|
117
|
-
const deletedTask = yield apiForHcp1.maintenanceTaskApi.deleteMaintenanceTaskWithUser(hcp1User, createdTask.id);
|
|
118
|
-
// Then
|
|
119
|
-
(0, chai_1.assert)(!!deletedTask);
|
|
120
|
-
(0, chai_1.assert)(deletedTask.id === createdTask.id);
|
|
121
|
-
}));
|
|
122
|
-
it('DeleteMaintenanceTaskWithUser Success for HCP that which parent has delegation', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
123
|
-
// Given
|
|
124
|
-
const createdTask = (yield apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(hcp1User, yield maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)));
|
|
125
|
-
(0, chai_1.assert)(!!createdTask.id);
|
|
126
|
-
// When
|
|
127
|
-
const deletedTask = yield apiForHcp2.maintenanceTaskApi.deleteMaintenanceTaskWithUser(hcp1User, createdTask.id);
|
|
128
|
-
// Then
|
|
129
|
-
(0, chai_1.assert)(!!deletedTask);
|
|
130
|
-
(0, chai_1.assert)(deletedTask.id === createdTask.id);
|
|
131
|
-
}));
|
|
132
|
-
it('DeleteMaintenanceTaskWithUser Fails for non-delegated HCP', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
-
const apiForHcp3 = yield initApi(env, test_utils_1.hcp2Username);
|
|
134
|
-
const hcp3User = yield apiForHcp3.userApi.getCurrentUser();
|
|
135
|
-
// Given
|
|
136
|
-
const createdTask = (yield apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(hcp1User, yield maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)));
|
|
137
|
-
(0, chai_1.assert)(!!createdTask.id);
|
|
138
|
-
// When
|
|
139
|
-
apiForHcp3.maintenanceTaskApi.deleteMaintenanceTaskWithUser(hcp3User, createdTask.id).then(() => {
|
|
140
|
-
throw new Error('You should not be here');
|
|
141
|
-
}, (e) => {
|
|
142
|
-
(0, chai_1.assert)(!!e);
|
|
143
|
-
});
|
|
144
|
-
// Then
|
|
145
|
-
const actualTask = yield apiForHcp1.maintenanceTaskApi.getMaintenanceTaskWithUser(hcp1User, createdTask.id);
|
|
146
|
-
(0, chai_1.assert)(!!actualTask);
|
|
147
|
-
(0, chai_1.assert)(!actualTask.deletionDate);
|
|
148
|
-
}));
|
|
149
|
-
it('FilterMaintenanceTaskByWithUser By Ids Success for HCP', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
150
|
-
// Given
|
|
151
|
-
const createdTask = (yield apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(hcp1User, yield maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)));
|
|
152
|
-
// When
|
|
153
|
-
const foundTask = (yield apiForHcp1.maintenanceTaskApi.filterMaintenanceTasksByWithUser(hcp1User, undefined, undefined, new FilterChainMaintenanceTask_1.FilterChainMaintenanceTask({
|
|
154
|
-
filter: new MaintenanceTaskByIdsFilter_1.MaintenanceTaskByIdsFilter({
|
|
155
|
-
ids: [createdTask.id],
|
|
156
|
-
}),
|
|
157
|
-
}))).rows[0];
|
|
158
|
-
// Then
|
|
159
|
-
(0, chai_1.assert)(foundTask.id == createdTask.id);
|
|
160
|
-
}));
|
|
161
|
-
it('FilterMaintenanceTaskByWithUser By Type Success for HCP', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
162
|
-
// Given
|
|
163
|
-
const createdTask = (yield apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(hcp1User, yield maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)));
|
|
164
|
-
// When
|
|
165
|
-
const foundTask = (yield apiForHcp1.maintenanceTaskApi.filterMaintenanceTasksByWithUser(hcp1User, undefined, undefined, new FilterChainMaintenanceTask_1.FilterChainMaintenanceTask({
|
|
166
|
-
filter: new MaintenanceTaskByHcPartyAndTypeFilter_1.MaintenanceTaskByHcPartyAndTypeFilter({
|
|
167
|
-
healthcarePartyId: hcp1.id,
|
|
168
|
-
type: createdTask.taskType,
|
|
169
|
-
}),
|
|
170
|
-
}))).rows[0];
|
|
171
|
-
// Then
|
|
172
|
-
(0, chai_1.assert)(foundTask.id == createdTask.id);
|
|
173
|
-
}));
|
|
174
|
-
it('FilterMaintenanceTaskByWithUser After Date Success for HCP', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
175
|
-
// Given
|
|
176
|
-
const startTimestamp = new Date().getTime() + 1000;
|
|
177
|
-
const taskToCreate = Object.assign(Object.assign({}, (yield maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1))), { created: startTimestamp });
|
|
178
|
-
const createdTask = (yield apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(hcp1User, new MaintenanceTask_1.MaintenanceTask(taskToCreate)));
|
|
179
|
-
// When
|
|
180
|
-
const foundTask = (yield apiForHcp1.maintenanceTaskApi.filterMaintenanceTasksByWithUser(hcp1User, undefined, undefined, new FilterChainMaintenanceTask_1.FilterChainMaintenanceTask({
|
|
181
|
-
filter: new MaintenanceTaskAfterDateFilter_1.MaintenanceTaskAfterDateFilter({
|
|
182
|
-
healthcarePartyId: hcp1.id,
|
|
183
|
-
date: startTimestamp - 1000,
|
|
184
|
-
}),
|
|
185
|
-
}))).rows[0];
|
|
186
|
-
// Then
|
|
187
|
-
(0, chai_1.assert)(foundTask.id == createdTask.id);
|
|
188
|
-
}));
|
|
189
|
-
it('Share with should work as expected', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
190
|
-
const api1 = yield initApi(env, test_utils_1.hcp1Username);
|
|
191
|
-
const user1 = yield api1.userApi.getCurrentUser();
|
|
192
|
-
const api2 = yield initApi(env, test_utils_1.hcp2Username);
|
|
193
|
-
const user2 = yield api2.userApi.getCurrentUser();
|
|
194
|
-
const samplePatient = yield api1.patientApi.createPatientWithUser(user1, yield api1.patientApi.newInstance(user1, { firstName: 'Gigio', lastName: 'Bagigio' }));
|
|
195
|
-
const encryptedField = 'Something encrypted';
|
|
196
|
-
const entity = (yield api1.maintenanceTaskApi.createMaintenanceTaskWithUser(user1, yield api1.maintenanceTaskApi.newInstance(user1, {
|
|
197
|
-
properties: [
|
|
198
|
-
new PropertyStub_1.PropertyStub({
|
|
199
|
-
id: 'someProp',
|
|
200
|
-
type: new PropertyTypeStub_1.PropertyTypeStub({ type: PropertyTypeStub_1.PropertyTypeStub.TypeEnum.STRING }),
|
|
201
|
-
typedValue: new TypedValueObject_1.TypedValueObject({
|
|
202
|
-
type: TypedValueObject_1.TypedValueObject.TypeEnum.STRING,
|
|
203
|
-
stringValue: encryptedField,
|
|
204
|
-
}),
|
|
205
|
-
}),
|
|
206
|
-
],
|
|
207
|
-
})));
|
|
208
|
-
(0, chai_1.expect)(entity.properties[0].typedValue.stringValue).to.be.equal(encryptedField);
|
|
209
|
-
yield api2.maintenanceTaskApi
|
|
210
|
-
.getMaintenanceTaskWithUser(user2, entity.id)
|
|
211
|
-
.then(() => {
|
|
212
|
-
throw new Error('Should not be able to get the entity');
|
|
213
|
-
})
|
|
214
|
-
.catch(() => {
|
|
215
|
-
/* expected */
|
|
216
|
-
});
|
|
217
|
-
yield api1.maintenanceTaskApi.shareWith(user2.healthcarePartyId, entity);
|
|
218
|
-
const retrieved = yield api2.maintenanceTaskApi.getMaintenanceTaskWithUser(user2, entity.id);
|
|
219
|
-
(0, chai_1.expect)(retrieved.properties[0].typedValue.stringValue).to.be.equal(encryptedField);
|
|
220
|
-
}));
|
|
221
|
-
});
|
|
222
|
-
//# sourceMappingURL=icc-maintenance-task-x-api-test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icc-maintenance-task-x-api-test.js","sourceRoot":"","sources":["../../../test/icc-x-api/icc-maintenance-task-x-api-test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAA8B;AAE9B,4BAAyB;AAEzB,+CAAoE;AACpE,+BAAqC;AACrC,mCAAmC;AACnC,oDAA+I;AAG/I,yEAAqE;AACrE,mEAA+D;AAC/D,2EAAuE;AACvE,2EAAuE;AAEvE,+DAA2D;AAC3D,+FAA2F;AAC3F,mGAA+F;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,CAAA;QACzE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,0BAA0B,CAAC,KAAK,EAAE,MAAM,CAAC,EAAG,CAAC,CAAA;QAC7F,IAAA,aAAM,EAAC,SAAS,CAAC,UAAW,CAAC,CAAC,CAAC,CAAC,UAAW,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IACtF,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { before } from 'mocha'\n\nimport 'isomorphic-fetch'\n\nimport { Apis, EntityWithDelegationTypeName } from '../../icc-x-api'\nimport { assert, expect } from 'chai'\nimport { randomUUID } from 'crypto'\nimport { createHcpHierarchyApis, getEnvironmentInitializer, hcp1Username, hcp2Username, setLocalStorage, TestUtils } from '../utils/test_utils'\nimport { User } from '../../icc-api/model/User'\nimport { IccMaintenanceTaskXApi } from '../../icc-x-api'\nimport { MaintenanceTask } from '../../icc-api/model/MaintenanceTask'\nimport { PropertyStub } from '../../icc-api/model/PropertyStub'\nimport { PropertyTypeStub } from '../../icc-api/model/PropertyTypeStub'\nimport { TypedValueObject } from '../../icc-api/model/TypedValueObject'\nimport { HealthcareParty } from '../../icc-api/model/HealthcareParty'\nimport { Identifier } from '../../icc-api/model/Identifier'\nimport { FilterChainMaintenanceTask } from '../../icc-api/model/FilterChainMaintenanceTask'\nimport { MaintenanceTaskByIdsFilter } from '../../icc-x-api/filters/MaintenanceTaskByIdsFilter'\nimport { MaintenanceTaskByHcPartyAndTypeFilter } from '../../icc-x-api/filters/MaintenanceTaskByHcPartyAndTypeFilter'\nimport { DocIdentifier } from '../../icc-api/model/DocIdentifier'\nimport initApi = TestUtils.initApi\nimport { MaintenanceTaskAfterDateFilter } from '../../icc-x-api/filters/MaintenanceTaskAfterDateFilter'\nimport { SecureDelegation } from '../../icc-api/model/SecureDelegation'\nimport AccessLevel = SecureDelegation.AccessLevelEnum\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\n\nsetLocalStorage(fetch)\nlet env: TestVars\n\nfunction maintenanceTaskToCreate(mTaskApiForHcp: IccMaintenanceTaskXApi, hcpUser: User, delegatedTo: HealthcareParty) {\n return mTaskApiForHcp.newInstance(\n hcpUser,\n new MaintenanceTask({\n id: randomUUID(),\n taskType: randomUUID(),\n status: MaintenanceTask.StatusEnum.Pending,\n properties: [\n new PropertyStub({\n id: 'dataOwnerConcernedId',\n type: new PropertyTypeStub({ type: PropertyTypeStub.TypeEnum.STRING }),\n typedValue: new TypedValueObject({\n type: TypedValueObject.TypeEnum.STRING,\n stringValue: delegatedTo.id,\n }),\n }),\n new PropertyStub({\n id: 'dataOwnerConcernedPubKey',\n type: new PropertyTypeStub({ type: PropertyTypeStub.TypeEnum.STRING }),\n typedValue: new TypedValueObject({\n type: TypedValueObject.TypeEnum.STRING,\n stringValue: delegatedTo.publicKey,\n }),\n }),\n ],\n }),\n { additionalDelegates: { [delegatedTo.id!]: AccessLevel.WRITE } }\n )\n}\n\nlet apiForHcp1: Apis\nlet hcp1User: User\nlet hcp1: HealthcareParty\n\nlet apiForHcp2: Apis\nlet hcp2User: User\nlet hcp2: HealthcareParty\n\ndescribe('icc-x-maintenance-task-api Tests', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n const hierarchicalHcps = await createHcpHierarchyApis(env)\n\n apiForHcp1 = hierarchicalHcps.grandApi\n hcp1User = await apiForHcp1.userApi.getCurrentUser()\n hcp1 = await apiForHcp1.healthcarePartyApi.getCurrentHealthcareParty()\n\n apiForHcp2 = hierarchicalHcps.parentApi\n hcp2User = await apiForHcp2.userApi.getCurrentUser()\n hcp2 = await apiForHcp2.healthcarePartyApi.getCurrentHealthcareParty()\n })\n\n it('CreateMaintenanceTaskWithUser Success for HCP', async () => {\n // Given\n const taskToCreate = await maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp2)\n\n // When\n const createdTask = await apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(hcp1User, taskToCreate)\n\n // Then\n assert(createdTask != null)\n assert(createdTask.id == taskToCreate.id)\n const keysFor1 = await apiForHcp1.cryptoApi.xapi.encryptionKeysOf(\n { entity: createdTask, type: EntityWithDelegationTypeName.MaintenanceTask },\n undefined\n )\n expect(keysFor1).to.have.length(1)\n\n const foundTask: MaintenanceTask = await apiForHcp2.maintenanceTaskApi.getMaintenanceTaskWithUser(hcp2User, createdTask.id!)\n\n assert(foundTask.id == createdTask.id)\n assert(foundTask.properties?.find((prop: PropertyStub) => prop.typedValue?.stringValue == hcp2.id) != undefined)\n assert(foundTask.properties?.find((prop: PropertyStub) => prop.typedValue?.stringValue == hcp2.publicKey) != undefined)\n const keysFor2 = await apiForHcp2.cryptoApi.xapi.encryptionKeysOf(\n { entity: createdTask, type: EntityWithDelegationTypeName.MaintenanceTask },\n undefined\n )\n expect(keysFor2).to.have.length(1)\n expect(keysFor2[0]).to.equal(keysFor1[0])\n }).timeout(30000)\n\n it('ModifyMaintenanceTaskWithUser Success for HCP', async () => {\n // Given\n const createdTask: MaintenanceTask = (await apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(\n hcp1User,\n await maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)\n ))!\n const identifierToAdd = new Identifier({ id: 'SYSTEM-TEST|VALUE-TEST', system: 'SYSTEM-TEST', value: 'VALUE-TEST' })\n\n // When\n const updatedTask: MaintenanceTask = await apiForHcp1.maintenanceTaskApi.modifyMaintenanceTaskWithUser(\n hcp1User,\n new MaintenanceTask({ ...createdTask, identifier: [identifierToAdd], status: MaintenanceTask.StatusEnum.Ongoing })\n )\n\n // Then\n assert(updatedTask.id == createdTask.id)\n assert(updatedTask.identifier?.[0].system == identifierToAdd.system)\n assert(updatedTask.identifier?.[0].value == identifierToAdd.value)\n assert(updatedTask.identifier?.[0].id == identifierToAdd.id)\n assert(updatedTask.status == MaintenanceTask.StatusEnum.Ongoing)\n })\n\n it('DeleteMaintenanceTaskWithUser Success for delegated HCP', async () => {\n // Given\n const createdTask: MaintenanceTask = (await apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(\n hcp1User,\n await maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)\n ))!\n assert(!!createdTask.id)\n\n // When\n const deletedTask: DocIdentifier = await apiForHcp1.maintenanceTaskApi.deleteMaintenanceTaskWithUser(hcp1User, createdTask.id!)\n\n // Then\n assert(!!deletedTask)\n assert(deletedTask.id === createdTask.id)\n })\n\n it('DeleteMaintenanceTaskWithUser Success for HCP that which parent has delegation', async () => {\n // Given\n const createdTask: MaintenanceTask = (await apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(\n hcp1User,\n await maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)\n ))!\n assert(!!createdTask.id)\n\n // When\n const deletedTask: DocIdentifier = await apiForHcp2.maintenanceTaskApi.deleteMaintenanceTaskWithUser(hcp1User, createdTask.id!)\n\n // Then\n assert(!!deletedTask)\n assert(deletedTask.id === createdTask.id)\n })\n\n it('DeleteMaintenanceTaskWithUser Fails for non-delegated HCP', async () => {\n const apiForHcp3 = await initApi(env, hcp2Username)\n const hcp3User = await apiForHcp3.userApi.getCurrentUser()\n\n // Given\n const createdTask: MaintenanceTask = (await apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(\n hcp1User,\n await maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)\n ))!\n assert(!!createdTask.id)\n\n // When\n apiForHcp3.maintenanceTaskApi.deleteMaintenanceTaskWithUser(hcp3User, createdTask.id!).then(\n () => {\n throw new Error('You should not be here')\n },\n (e) => {\n assert(!!e)\n }\n )\n\n // Then\n const actualTask: MaintenanceTask = await apiForHcp1.maintenanceTaskApi.getMaintenanceTaskWithUser(hcp1User, createdTask.id!)\n assert(!!actualTask)\n assert(!actualTask.deletionDate)\n })\n\n it('FilterMaintenanceTaskByWithUser By Ids Success for HCP', async () => {\n // Given\n const createdTask: MaintenanceTask = (await apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(\n hcp1User,\n await maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)\n ))!\n\n // When\n const foundTask = (\n await apiForHcp1.maintenanceTaskApi.filterMaintenanceTasksByWithUser(\n hcp1User,\n undefined,\n undefined,\n new FilterChainMaintenanceTask({\n filter: new MaintenanceTaskByIdsFilter({\n ids: [createdTask.id!],\n }),\n })\n )\n ).rows![0] as MaintenanceTask\n\n // Then\n assert(foundTask.id == createdTask.id)\n })\n\n it('FilterMaintenanceTaskByWithUser By Type Success for HCP', async () => {\n // Given\n const createdTask: MaintenanceTask = (await apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(\n hcp1User,\n await maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)\n ))!\n\n // When\n const foundTask = (\n await apiForHcp1.maintenanceTaskApi.filterMaintenanceTasksByWithUser(\n hcp1User,\n undefined,\n undefined,\n new FilterChainMaintenanceTask({\n filter: new MaintenanceTaskByHcPartyAndTypeFilter({\n healthcarePartyId: hcp1.id!,\n type: createdTask.taskType!,\n }),\n })\n )\n ).rows![0]\n\n // Then\n assert(foundTask.id == createdTask.id)\n })\n\n it('FilterMaintenanceTaskByWithUser After Date Success for HCP', async () => {\n // Given\n const startTimestamp = new Date().getTime() + 1000\n const taskToCreate = { ...(await maintenanceTaskToCreate(apiForHcp1.maintenanceTaskApi, hcp1User, hcp1)), created: startTimestamp }\n\n const createdTask: MaintenanceTask = (await apiForHcp1.maintenanceTaskApi.createMaintenanceTaskWithUser(\n hcp1User,\n new MaintenanceTask(taskToCreate)\n ))!\n\n // When\n const foundTask = (\n await apiForHcp1.maintenanceTaskApi.filterMaintenanceTasksByWithUser(\n hcp1User,\n undefined,\n undefined,\n new FilterChainMaintenanceTask({\n filter: new MaintenanceTaskAfterDateFilter({\n healthcarePartyId: hcp1.id!,\n date: startTimestamp - 1000,\n }),\n })\n )\n ).rows![0]\n\n // Then\n assert(foundTask.id == createdTask.id)\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.maintenanceTaskApi.createMaintenanceTaskWithUser(\n user1,\n await api1.maintenanceTaskApi.newInstance(user1, {\n properties: [\n new PropertyStub({\n id: 'someProp',\n type: new PropertyTypeStub({ type: PropertyTypeStub.TypeEnum.STRING }),\n typedValue: new TypedValueObject({\n type: TypedValueObject.TypeEnum.STRING,\n stringValue: encryptedField,\n }),\n }),\n ],\n })\n ))!\n expect(entity.properties![0].typedValue!.stringValue).to.be.equal(encryptedField)\n await api2.maintenanceTaskApi\n .getMaintenanceTaskWithUser(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.maintenanceTaskApi.shareWith(user2.healthcarePartyId!, entity)\n const retrieved = await api2.maintenanceTaskApi.getMaintenanceTaskWithUser(user2, entity.id!)\n expect(retrieved.properties![0].typedValue!.stringValue).to.be.equal(encryptedField)\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'isomorphic-fetch';
|