@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,276 +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 mocha_1 = require("mocha");
|
|
14
|
-
const test_utils_1 = require("../../utils/test_utils");
|
|
15
|
-
const types_1 = require("@icure/test-setup/types");
|
|
16
|
-
const icc_x_api_1 = require("../../../icc-x-api");
|
|
17
|
-
const chaiAsPromised = require("chai-as-promised");
|
|
18
|
-
const chai_1 = require("chai");
|
|
19
|
-
const entities_crud_test_interface_1 = require("./entities-crud-test-interface");
|
|
20
|
-
const IdWithRev_1 = require("../../../icc-api/model/IdWithRev");
|
|
21
|
-
const crypto_1 = require("crypto");
|
|
22
|
-
const TestCryptoStrategies_1 = require("../../utils/TestCryptoStrategies");
|
|
23
|
-
var initMasterApi = test_utils_1.TestUtils.initMasterApi;
|
|
24
|
-
var initApi = test_utils_1.TestUtils.initApi;
|
|
25
|
-
(0, chai_1.use)(chaiAsPromised);
|
|
26
|
-
(0, test_utils_1.setLocalStorage)(fetch);
|
|
27
|
-
let masterApi;
|
|
28
|
-
let hcpApi;
|
|
29
|
-
let patientApi;
|
|
30
|
-
let noPermissionsApi;
|
|
31
|
-
let patient;
|
|
32
|
-
let entitiesPermissions;
|
|
33
|
-
let env;
|
|
34
|
-
describe('CRUD Test', () => {
|
|
35
|
-
(0, mocha_1.before)(function () {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
this.timeout(600000);
|
|
38
|
-
const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
|
|
39
|
-
env = yield initializer.execute((0, types_1.getEnvVariables)());
|
|
40
|
-
masterApi = yield initMasterApi(env);
|
|
41
|
-
hcpApi = yield initApi(env, test_utils_1.hcp1Username);
|
|
42
|
-
patientApi = yield initApi(env, test_utils_1.patUsername);
|
|
43
|
-
const patientUser = yield patientApi.userApi.getCurrentUser();
|
|
44
|
-
patient = yield patientApi.patientApi.getPatientWithUser(patientUser, patientUser.patientId);
|
|
45
|
-
const { api, credentials, user } = yield (0, test_utils_1.createNewHcpApi)(env);
|
|
46
|
-
if (!(0, test_utils_1.isLiteTest)())
|
|
47
|
-
yield masterApi.userApi.setRoles(user.id, ['BASIC_USER']);
|
|
48
|
-
const RSA = new icc_x_api_1.RSAUtilsImpl(crypto_1.webcrypto);
|
|
49
|
-
const keys = {
|
|
50
|
-
publicKey: yield RSA.importKey('spki', (0, icc_x_api_1.ua2ab)((0, icc_x_api_1.hex2ua)(credentials.publicKey)), ['encrypt'], icc_x_api_1.ShaVersion.Sha1),
|
|
51
|
-
privateKey: yield RSA.importKey('pkcs8', (0, icc_x_api_1.ua2ab)((0, icc_x_api_1.hex2ua)(credentials.privateKey)), ['decrypt'], icc_x_api_1.ShaVersion.Sha1),
|
|
52
|
-
};
|
|
53
|
-
noPermissionsApi = yield icc_x_api_1.IcureApi.initialise(env.iCureUrl, { username: credentials.user, password: credentials.password }, new TestCryptoStrategies_1.TestCryptoStrategies(keys), crypto_1.webcrypto, fetch);
|
|
54
|
-
entitiesPermissions = {
|
|
55
|
-
AccessLog: {
|
|
56
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
57
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
58
|
-
},
|
|
59
|
-
Agenda: {
|
|
60
|
-
create: { allowed: masterApi },
|
|
61
|
-
delete: { allowed: hcpApi, denied: patientApi },
|
|
62
|
-
},
|
|
63
|
-
Article: {
|
|
64
|
-
create: { allowed: masterApi, denied: patientApi },
|
|
65
|
-
delete: { allowed: masterApi, denied: hcpApi },
|
|
66
|
-
},
|
|
67
|
-
CalendarItem: {
|
|
68
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
69
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
70
|
-
},
|
|
71
|
-
CalendarItemType: {
|
|
72
|
-
create: { allowed: masterApi },
|
|
73
|
-
delete: { allowed: hcpApi, denied: patientApi },
|
|
74
|
-
},
|
|
75
|
-
Classification: {
|
|
76
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
77
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
78
|
-
},
|
|
79
|
-
ClassificationTemplate: {
|
|
80
|
-
create: { allowed: masterApi, denied: patientApi },
|
|
81
|
-
delete: { allowed: masterApi, denied: hcpApi },
|
|
82
|
-
},
|
|
83
|
-
Contact: {
|
|
84
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
85
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
86
|
-
},
|
|
87
|
-
Device: {
|
|
88
|
-
create: { allowed: masterApi },
|
|
89
|
-
delete: { allowed: hcpApi, denied: patientApi },
|
|
90
|
-
},
|
|
91
|
-
Document: {
|
|
92
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
93
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
94
|
-
},
|
|
95
|
-
Form: {
|
|
96
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
97
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
98
|
-
},
|
|
99
|
-
HealthcarePartyInGroup: {
|
|
100
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
101
|
-
delete: { allowed: masterApi, denied: patientApi },
|
|
102
|
-
},
|
|
103
|
-
HealthcareParty: {
|
|
104
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
105
|
-
delete: { allowed: masterApi, denied: patientApi },
|
|
106
|
-
},
|
|
107
|
-
HealthcareElement: {
|
|
108
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
109
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
110
|
-
},
|
|
111
|
-
Insurance: {
|
|
112
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
113
|
-
delete: { allowed: masterApi, denied: patientApi },
|
|
114
|
-
},
|
|
115
|
-
Invoice: {
|
|
116
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
117
|
-
delete: { allowed: masterApi, denied: patientApi },
|
|
118
|
-
},
|
|
119
|
-
Keyword: {
|
|
120
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
121
|
-
delete: { allowed: masterApi, denied: patientApi },
|
|
122
|
-
},
|
|
123
|
-
MaintenanceTask: {
|
|
124
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
125
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
126
|
-
},
|
|
127
|
-
MedicalLocation: {
|
|
128
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
129
|
-
delete: { allowed: masterApi, denied: patientApi },
|
|
130
|
-
},
|
|
131
|
-
Message: {
|
|
132
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
133
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
134
|
-
},
|
|
135
|
-
Patient: {
|
|
136
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
137
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
138
|
-
},
|
|
139
|
-
Place: {
|
|
140
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
141
|
-
delete: { allowed: masterApi, denied: patientApi },
|
|
142
|
-
},
|
|
143
|
-
Receipt: {
|
|
144
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
145
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
146
|
-
},
|
|
147
|
-
TimeTable: {
|
|
148
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
149
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
150
|
-
},
|
|
151
|
-
Topic: {
|
|
152
|
-
create: { allowed: masterApi, denied: noPermissionsApi },
|
|
153
|
-
delete: { allowed: hcpApi, denied: hcpApi },
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
Object.entries(entities_crud_test_interface_1.entities)
|
|
159
|
-
.filter(([, operations]) => {
|
|
160
|
-
return !(0, test_utils_1.isLiteTest)() || !operations.cloudOnly;
|
|
161
|
-
})
|
|
162
|
-
.forEach(([entityType, operations]) => {
|
|
163
|
-
it(`A user with create permissions can create a ${entityType}`, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
164
|
-
const api = entitiesPermissions[entityType].create.allowed;
|
|
165
|
-
const entity = yield operations.create(api, patient);
|
|
166
|
-
(0, chai_1.expect)(entity.rev).not.to.be.undefined;
|
|
167
|
-
}));
|
|
168
|
-
(0, test_utils_1.itNoLite)(`A user without create permissions cannot create a ${entityType}`, function () {
|
|
169
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
-
if (!!operations.skipDenied)
|
|
171
|
-
this.skip();
|
|
172
|
-
const api = entitiesPermissions[entityType].create.denied;
|
|
173
|
-
if (!api)
|
|
174
|
-
this.skip();
|
|
175
|
-
yield (0, chai_1.expect)(operations.create(api, patient)).to.be.rejected;
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
it(`A user can delete many ${entityType} if they have access to them`, function () {
|
|
179
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
-
if (!operations.encryptable) {
|
|
181
|
-
this.skip();
|
|
182
|
-
}
|
|
183
|
-
const creationApi = entitiesPermissions[entityType].create.allowed;
|
|
184
|
-
const api = entitiesPermissions[entityType].delete.allowed;
|
|
185
|
-
const notAccessibleEntities = [];
|
|
186
|
-
for (let i = 0; i <= 5; i++) {
|
|
187
|
-
const entity = yield operations.create(creationApi, patient);
|
|
188
|
-
notAccessibleEntities.push(entity);
|
|
189
|
-
}
|
|
190
|
-
const accessibleEntities = [];
|
|
191
|
-
for (let i = 0; i <= 5; i++) {
|
|
192
|
-
const entity = yield operations.create(creationApi, patient).then((e) => {
|
|
193
|
-
return operations.share(creationApi, api, e);
|
|
194
|
-
});
|
|
195
|
-
accessibleEntities.push(entity);
|
|
196
|
-
}
|
|
197
|
-
const result = yield operations.deleteMany(api, (0, test_utils_1.isLiteTest)() ? accessibleEntities : notAccessibleEntities.concat(accessibleEntities));
|
|
198
|
-
(0, chai_1.expect)(result.length).to.be.equal(accessibleEntities.length);
|
|
199
|
-
result.forEach((el) => {
|
|
200
|
-
(0, chai_1.expect)(accessibleEntities.find((it) => it.id === el.id)).not.to.be.undefined;
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
(0, test_utils_1.itNoLite)(`A user can delete many ${entityType} if they have the correct role`, function () {
|
|
205
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
-
if (!!operations.encryptable)
|
|
207
|
-
this.skip();
|
|
208
|
-
const creationApi = entitiesPermissions[entityType].create.allowed;
|
|
209
|
-
const api = entitiesPermissions[entityType].delete.allowed;
|
|
210
|
-
const entities = [];
|
|
211
|
-
for (let i = 0; i <= 5; i++) {
|
|
212
|
-
const entity = yield operations.create(creationApi, patient);
|
|
213
|
-
entities.push(entity);
|
|
214
|
-
}
|
|
215
|
-
const result = yield operations.deleteMany(api, entities);
|
|
216
|
-
(0, chai_1.expect)(result.length).to.be.equal(entities.length);
|
|
217
|
-
result.forEach((el) => {
|
|
218
|
-
(0, chai_1.expect)(entities.find((it) => it.id === el.id)).not.to.be.undefined;
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
(0, test_utils_1.itNoLite)(`A user cannot delete many ${entityType} if they do not have the correct role`, function () {
|
|
223
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
-
if (!!operations.skipDenied)
|
|
225
|
-
this.skip();
|
|
226
|
-
const creationApi = entitiesPermissions[entityType].create.allowed;
|
|
227
|
-
const api = entitiesPermissions[entityType].delete.denied;
|
|
228
|
-
if (!api) {
|
|
229
|
-
throw new Error('An API is required to perform this test');
|
|
230
|
-
}
|
|
231
|
-
const entities = [];
|
|
232
|
-
for (let i = 0; i <= 5; i++) {
|
|
233
|
-
const entity = yield operations.create(creationApi, patient);
|
|
234
|
-
entities.push(entity);
|
|
235
|
-
}
|
|
236
|
-
yield operations.deleteMany(api, entities).then((result) => {
|
|
237
|
-
(0, chai_1.expect)(result).to.be.empty;
|
|
238
|
-
}, () => {
|
|
239
|
-
(0, chai_1.expect)(true).to.be.eq(true, 'Response should be empty or promise rejected');
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
it(`A user can delete a single ${entityType} if they have access to it`, function () {
|
|
244
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
245
|
-
const creationApi = entitiesPermissions[entityType].create.allowed;
|
|
246
|
-
const api = entitiesPermissions[entityType].delete.allowed;
|
|
247
|
-
const entity = yield operations.create(creationApi, patient).then((e) => {
|
|
248
|
-
return operations.share(creationApi, api, e);
|
|
249
|
-
});
|
|
250
|
-
const result = yield operations.delete(api, entity);
|
|
251
|
-
(0, chai_1.expect)(result.id).to.be.equal(entity.id);
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
(0, test_utils_1.itNoLite)(`A user cannot delete a single ${entityType} if they do not have access to it`, function () {
|
|
255
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
256
|
-
if (!!operations.skipDenied) {
|
|
257
|
-
this.skip();
|
|
258
|
-
}
|
|
259
|
-
const creationApi = entitiesPermissions[entityType].create.allowed;
|
|
260
|
-
const api = entitiesPermissions[entityType].delete.denied;
|
|
261
|
-
if (!api) {
|
|
262
|
-
throw new Error('An API is required to perform this test');
|
|
263
|
-
}
|
|
264
|
-
const entity = yield operations.create(creationApi, patient);
|
|
265
|
-
yield (0, chai_1.expect)(operations.delete(api, entity)).to.be.rejected;
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
it(`A user cannot delete a single ${entityType} that does not exist`, function () {
|
|
269
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
270
|
-
const api = entitiesPermissions[entityType].delete.allowed;
|
|
271
|
-
yield (0, chai_1.expect)(operations.delete(api, new IdWithRev_1.IdWithRev({ id: (0, crypto_1.randomUUID)() }))).to.be.rejected;
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
//# sourceMappingURL=comprehensive-crud-test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"comprehensive-crud-test.js","sourceRoot":"","sources":["../../../../test/icc-x-api/crud/comprehensive-crud-test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4BAAyB;AACzB,iCAA8B;AAC9B,uDAS+B;AAC/B,mDAAmE;AACnE,kDAAgG;AAChG,mDAAkD;AAClD,+BAA6C;AAC7C,iFAAyD;AAEzD,gEAA4D;AAC5D,mCAA8C;AAC9C,2EAAuE;AACvE,IAAO,aAAa,GAAG,sBAAS,CAAC,aAAa,CAAA;AAC9C,IAAO,OAAO,GAAG,sBAAS,CAAC,OAAO,CAAA;AAElC,IAAA,UAAO,EAAC,cAAc,CAAC,CAAA;AAEvB,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAA;AAKtB,IAAI,SAAmB,CAAA;AACvB,IAAI,MAAgB,CAAA;AACpB,IAAI,UAAoB,CAAA;AACxB,IAAI,gBAA0B,CAAA;AAC9B,IAAI,OAAgB,CAAA;AACpB,IAAI,mBAAyE,CAAA;AAE7E,IAAI,GAAa,CAAA;AAEjB,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAA,cAAM,EAAC;;YACL,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACpB,MAAM,WAAW,GAAG,MAAM,IAAA,sCAAyB,GAAE,CAAA;YACrD,GAAG,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,IAAA,uBAAe,GAAE,CAAC,CAAA;YAClD,SAAS,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,CAAA;YACpC,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,yBAAY,CAAC,CAAA;YACzC,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,wBAAW,CAAC,CAAA;YAC5C,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,cAAc,EAAE,CAAA;YAC7D,OAAO,GA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D,MAAM,WAAW,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAA;gBAClE,MAAM,GAAG,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,MAAM,CAAA;gBACzD,IAAI,CAAC,GAAG,EAAE,CAAC;oBACT,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;gBAC5D,CAAC;gBACD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;gBAC5D,MAAM,IAAA,aAAM,EAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAA;YAC7D,CAAC;SAAA,CAAC,CAAA;QAEF,EAAE,CAAC,iCAAiC,UAAU,sBAAsB,EAAE;;gBACpE,MAAM,GAAG,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAA;gBAC1D,MAAM,IAAA,aAAM,EAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,qBAAS,CAAC,EAAE,EAAE,EAAE,IAAA,mBAAU,GAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAA;YAC1F,CAAC;SAAA,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA","sourcesContent":["import 'isomorphic-fetch'\nimport { before } from 'mocha'\nimport {\n createNewHcpApi,\n getEnvironmentInitializer,\n hcp1Username,\n isLiteTest,\n itNoLite,\n patUsername,\n setLocalStorage,\n TestUtils,\n} from '../../utils/test_utils'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\nimport { hex2ua, IcureApi, RSAUtils, RSAUtilsImpl, ShaVersion, ua2ab } from '../../../icc-x-api'\nimport * as chaiAsPromised from 'chai-as-promised'\nimport { expect, use as chaiUse } from 'chai'\nimport { entities } from './entities-crud-test-interface'\nimport { Patient } from '../../../icc-api/model/Patient'\nimport { IdWithRev } from '../../../icc-api/model/IdWithRev'\nimport { randomUUID, webcrypto } from 'crypto'\nimport { TestCryptoStrategies } from '../../utils/TestCryptoStrategies'\nimport initMasterApi = TestUtils.initMasterApi\nimport initApi = TestUtils.initApi\n\nchaiUse(chaiAsPromised)\n\nsetLocalStorage(fetch)\n\ntype OpType = 'create' | 'delete'\ntype ApisWithRole = { allowed: IcureApi; denied?: IcureApi }\n\nlet masterApi: IcureApi\nlet hcpApi: IcureApi\nlet patientApi: IcureApi\nlet noPermissionsApi: IcureApi\nlet patient: Patient\nlet entitiesPermissions: { [key: string]: { [key in OpType]: ApisWithRole } }\n\nlet env: TestVars\n\ndescribe('CRUD Test', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n masterApi = await initMasterApi(env)\n hcpApi = await initApi(env, hcp1Username)\n patientApi = await initApi(env, patUsername)\n const patientUser = await patientApi.userApi.getCurrentUser()\n patient = await patientApi.patientApi.getPatientWithUser(patientUser, patientUser.patientId!)\n const { api, credentials, user } = await createNewHcpApi(env)\n if (!isLiteTest()) await masterApi.userApi.setRoles(user.id!, ['BASIC_USER'])\n\n const RSA = new RSAUtilsImpl(webcrypto as any)\n const keys = {\n publicKey: await RSA.importKey('spki', ua2ab(hex2ua(credentials.publicKey)), ['encrypt'], ShaVersion.Sha1),\n privateKey: await RSA.importKey('pkcs8', ua2ab(hex2ua(credentials.privateKey)), ['decrypt'], ShaVersion.Sha1),\n }\n\n noPermissionsApi = await IcureApi.initialise(\n env.iCureUrl,\n { username: credentials.user, password: credentials.password },\n new TestCryptoStrategies(keys),\n webcrypto as any,\n fetch\n )\n\n entitiesPermissions = {\n AccessLog: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n Agenda: {\n create: { allowed: masterApi },\n delete: { allowed: hcpApi, denied: patientApi },\n },\n Article: {\n create: { allowed: masterApi, denied: patientApi },\n delete: { allowed: masterApi, denied: hcpApi },\n },\n CalendarItem: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n CalendarItemType: {\n create: { allowed: masterApi },\n delete: { allowed: hcpApi, denied: patientApi },\n },\n Classification: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n ClassificationTemplate: {\n create: { allowed: masterApi, denied: patientApi },\n delete: { allowed: masterApi, denied: hcpApi },\n },\n Contact: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n Device: {\n create: { allowed: masterApi },\n delete: { allowed: hcpApi, denied: patientApi },\n },\n Document: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n Form: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n HealthcarePartyInGroup: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: masterApi, denied: patientApi },\n },\n HealthcareParty: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: masterApi, denied: patientApi },\n },\n HealthcareElement: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n Insurance: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: masterApi, denied: patientApi },\n },\n Invoice: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: masterApi, denied: patientApi },\n },\n Keyword: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: masterApi, denied: patientApi },\n },\n MaintenanceTask: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n MedicalLocation: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: masterApi, denied: patientApi },\n },\n Message: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n Patient: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n Place: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: masterApi, denied: patientApi },\n },\n Receipt: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n TimeTable: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n Topic: {\n create: { allowed: masterApi, denied: noPermissionsApi },\n delete: { allowed: hcpApi, denied: hcpApi },\n },\n }\n })\n\n Object.entries(entities)\n .filter(([, operations]) => {\n return !isLiteTest() || !operations.cloudOnly\n })\n .forEach(([entityType, operations]) => {\n it(`A user with create permissions can create a ${entityType}`, async () => {\n const api = entitiesPermissions[entityType].create.allowed\n const entity = await operations.create(api, patient)\n expect(entity.rev).not.to.be.undefined\n })\n\n itNoLite(`A user without create permissions cannot create a ${entityType}`, async function () {\n if (!!operations.skipDenied) this.skip()\n const api = entitiesPermissions[entityType].create.denied\n if (!api) this.skip()\n await expect(operations.create(api, patient)).to.be.rejected\n })\n\n it(`A user can delete many ${entityType} if they have access to them`, async function () {\n if (!operations.encryptable) {\n this.skip()\n }\n const creationApi = entitiesPermissions[entityType].create.allowed\n const api = entitiesPermissions[entityType].delete.allowed\n const notAccessibleEntities: IdWithRev[] = []\n for (let i = 0; i <= 5; i++) {\n const entity = await operations.create(creationApi, patient)\n notAccessibleEntities.push(entity)\n }\n const accessibleEntities: IdWithRev[] = []\n for (let i = 0; i <= 5; i++) {\n const entity = await operations.create(creationApi, patient).then((e) => {\n return operations.share(creationApi, api, e)\n })\n accessibleEntities.push(entity)\n }\n const result = await operations.deleteMany(api, isLiteTest() ? accessibleEntities : notAccessibleEntities.concat(accessibleEntities))\n expect(result.length).to.be.equal(accessibleEntities.length)\n result.forEach((el) => {\n expect(accessibleEntities.find((it) => it.id === el.id)).not.to.be.undefined\n })\n })\n\n itNoLite(`A user can delete many ${entityType} if they have the correct role`, async function () {\n if (!!operations.encryptable) this.skip()\n const creationApi = entitiesPermissions[entityType].create.allowed\n const api = entitiesPermissions[entityType].delete.allowed\n const entities: IdWithRev[] = []\n for (let i = 0; i <= 5; i++) {\n const entity = await operations.create(creationApi, patient)\n entities.push(entity)\n }\n const result = await operations.deleteMany(api, entities)\n expect(result.length).to.be.equal(entities.length)\n result.forEach((el) => {\n expect(entities.find((it) => it.id === el.id)).not.to.be.undefined\n })\n })\n\n itNoLite(`A user cannot delete many ${entityType} if they do not have the correct role`, async function () {\n if (!!operations.skipDenied) this.skip()\n const creationApi = entitiesPermissions[entityType].create.allowed\n const api = entitiesPermissions[entityType].delete.denied\n if (!api) {\n throw new Error('An API is required to perform this test')\n }\n const entities: IdWithRev[] = []\n for (let i = 0; i <= 5; i++) {\n const entity = await operations.create(creationApi, patient)\n entities.push(entity)\n }\n await operations.deleteMany(api, entities).then(\n (result) => {\n expect(result).to.be.empty\n },\n () => {\n expect(true).to.be.eq(true, 'Response should be empty or promise rejected')\n }\n )\n })\n\n it(`A user can delete a single ${entityType} if they have access to it`, async function () {\n const creationApi = entitiesPermissions[entityType].create.allowed\n const api = entitiesPermissions[entityType].delete.allowed\n const entity = await operations.create(creationApi, patient).then((e) => {\n return operations.share(creationApi, api, e)\n })\n const result = await operations.delete(api, entity)\n expect(result.id).to.be.equal(entity.id)\n })\n\n itNoLite(`A user cannot delete a single ${entityType} if they do not have access to it`, async function () {\n if (!!operations.skipDenied) {\n this.skip()\n }\n const creationApi = entitiesPermissions[entityType].create.allowed\n const api = entitiesPermissions[entityType].delete.denied\n if (!api) {\n throw new Error('An API is required to perform this test')\n }\n const entity = await operations.create(creationApi, patient)\n await expect(operations.delete(api, entity)).to.be.rejected\n })\n\n it(`A user cannot delete a single ${entityType} that does not exist`, async function () {\n const api = entitiesPermissions[entityType].delete.allowed\n await expect(operations.delete(api, new IdWithRev({ id: randomUUID() }))).to.be.rejected\n })\n })\n})\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { IcureApi } from '../../../icc-x-api';
|
|
2
|
-
import { Patient } from '../../../icc-api/model/Patient';
|
|
3
|
-
import { IdWithRev } from '../../../icc-api/model/IdWithRev';
|
|
4
|
-
import { DocIdentifier } from '../../../icc-api/model/DocIdentifier';
|
|
5
|
-
export interface CRUDInterface {
|
|
6
|
-
encryptable: boolean;
|
|
7
|
-
skipDenied?: boolean;
|
|
8
|
-
cloudOnly?: boolean;
|
|
9
|
-
create(api: IcureApi, patient: Patient): Promise<IdWithRev>;
|
|
10
|
-
share(delegatorApi: IcureApi, delegateApi: IcureApi, entity: any): Promise<IdWithRev>;
|
|
11
|
-
deleteMany(api: IcureApi, ids: IdWithRev[]): Promise<Array<DocIdentifier>>;
|
|
12
|
-
delete(api: IcureApi, id: IdWithRev): Promise<DocIdentifier>;
|
|
13
|
-
}
|
|
14
|
-
export declare const entities: {
|
|
15
|
-
[key: string]: CRUDInterface;
|
|
16
|
-
};
|