@icure/api 8.0.8 → 8.0.9
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/model/models.d.ts +1 -0
- package/icc-api/model/models.js +1 -0
- package/icc-api/model/models.js.map +1 -1
- package/icc-x-api/crypto/ExchangeDataManager.js +3 -2
- package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
- package/icc-x-api/crypto/KeyRecovery.js +5 -4
- package/icc-x-api/crypto/KeyRecovery.js.map +1 -1
- package/icc-x-api/crypto/RSA.d.ts +4 -1
- package/icc-x-api/crypto/RSA.js +6 -1
- package/icc-x-api/crypto/RSA.js.map +1 -1
- package/icc-x-api/crypto/SecureDelegationsManager.js +2 -1
- package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -1
- package/icc-x-api/crypto/TransferKeysManager.js +4 -3
- package/icc-x-api/crypto/TransferKeysManager.js.map +1 -1
- package/icc-x-api/crypto/UserEncryptionKeysManager.js +2 -1
- package/icc-x-api/crypto/UserEncryptionKeysManager.js.map +1 -1
- package/icc-x-api/crypto/utils.d.ts +1 -4
- package/icc-x-api/crypto/utils.js +6 -8
- package/icc-x-api/crypto/utils.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.js +16 -14
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +2 -2
- package/icc-x-api/icc-calendar-item-x-api.js +17 -17
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.js +12 -11
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +2 -2
- package/icc-x-api/icc-contact-x-api.js +23 -20
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.js +17 -16
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.js +13 -12
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.js +18 -16
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.js +12 -11
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.js +11 -11
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.js +14 -14
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.js +28 -27
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.js +11 -10
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-recovery-x-api.js +3 -2
- package/icc-x-api/icc-recovery-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.js +9 -8
- package/icc-x-api/icc-time-table-x-api.js.map +1 -1
- package/icc-x-api/icc-topic-x-api.js +13 -13
- package/icc-x-api/icc-topic-x-api.js.map +1 -1
- package/icc-x-api/utils/EntityWithDelegationTypeName.d.ts +17 -1
- package/icc-x-api/utils/EntityWithDelegationTypeName.js +33 -15
- package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -1
- package/package.json +1 -1
- package/test/icc-api/api/IccAnonymousAccessApi.d.ts +1 -0
- package/test/icc-api/api/IccAnonymousAccessApi.js +58 -0
- package/test/icc-api/api/IccAnonymousAccessApi.js.map +1 -0
- package/test/icc-api/api/IccDocumentApi.d.ts +1 -0
- package/test/icc-api/api/IccDocumentApi.js +208 -0
- package/test/icc-api/api/IccDocumentApi.js.map +1 -0
- package/test/icc-api/api/IccGroupApi.d.ts +1 -0
- package/test/icc-api/api/IccGroupApi.js +50 -0
- package/test/icc-api/api/IccGroupApi.js.map +1 -0
- package/test/icc-api/api/IccRecoveryDataApi.d.ts +1 -0
- package/test/icc-api/api/IccRecoveryDataApi.js +95 -0
- package/test/icc-api/api/IccRecoveryDataApi.js.map +1 -0
- package/test/icc-api/api/IccRoleApi.d.ts +1 -0
- package/test/icc-api/api/IccRoleApi.js +34 -0
- package/test/icc-api/api/IccRoleApi.js.map +1 -0
- package/test/icc-api/api/IccUserApi.d.ts +1 -0
- package/test/icc-api/api/IccUserApi.js +96 -0
- package/test/icc-api/api/IccUserApi.js.map +1 -0
- package/test/icc-api/e2e/IccCalendarItemApi.d.ts +1 -0
- package/test/icc-api/e2e/IccCalendarItemApi.js +46 -0
- package/test/icc-api/e2e/IccCalendarItemApi.js.map +1 -0
- package/test/icc-api/model/modelHelpersTest.d.ts +1 -0
- package/test/icc-api/model/modelHelpersTest.js +45 -0
- package/test/icc-api/model/modelHelpersTest.js.map +1 -0
- package/test/icc-x-api/auth/group-switch-test.d.ts +1 -0
- package/test/icc-x-api/auth/group-switch-test.js +81 -0
- package/test/icc-x-api/auth/group-switch-test.js.map +1 -0
- package/test/icc-x-api/auth/jwt-concurrency-test.d.ts +2 -0
- package/test/icc-x-api/auth/jwt-concurrency-test.js +113 -0
- package/test/icc-x-api/auth/jwt-concurrency-test.js.map +1 -0
- package/test/icc-x-api/auth/smart-auth-provider-test.d.ts +1 -0
- package/test/icc-x-api/auth/smart-auth-provider-test.js +224 -0
- package/test/icc-x-api/auth/smart-auth-provider-test.js.map +1 -0
- package/test/icc-x-api/autofix-anonymity-test.d.ts +1 -0
- package/test/icc-x-api/autofix-anonymity-test.js +108 -0
- package/test/icc-x-api/autofix-anonymity-test.js.map +1 -0
- package/test/icc-x-api/confidential-entities-test.d.ts +1 -0
- package/test/icc-x-api/confidential-entities-test.js +110 -0
- package/test/icc-x-api/confidential-entities-test.js.map +1 -0
- package/test/icc-x-api/crud/comprehensive-crud-test.d.ts +1 -0
- package/test/icc-x-api/crud/comprehensive-crud-test.js +276 -0
- package/test/icc-x-api/crud/comprehensive-crud-test.js.map +1 -0
- package/test/icc-x-api/crud/entities-crud-test-interface.d.ts +16 -0
- package/test/icc-x-api/crud/entities-crud-test-interface.js +422 -0
- package/test/icc-x-api/crud/entities-crud-test-interface.js.map +1 -0
- package/test/icc-x-api/crypto/anonymous-delegations-test.d.ts +1 -0
- package/test/icc-x-api/crypto/anonymous-delegations-test.js +588 -0
- package/test/icc-x-api/crypto/anonymous-delegations-test.js.map +1 -0
- package/test/icc-x-api/crypto/concurrency.d.ts +1 -0
- package/test/icc-x-api/crypto/concurrency.js +35 -0
- package/test/icc-x-api/crypto/concurrency.js.map +1 -0
- package/test/icc-x-api/crypto/crypto-utils.d.ts +1 -0
- package/test/icc-x-api/crypto/crypto-utils.js +80 -0
- package/test/icc-x-api/crypto/crypto-utils.js.map +1 -0
- package/test/icc-x-api/crypto/cryptoTest.d.ts +2 -0
- package/test/icc-x-api/crypto/cryptoTest.js +302 -0
- package/test/icc-x-api/crypto/cryptoTest.js.map +1 -0
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.d.ts +1 -0
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js +166 -0
- package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js.map +1 -0
- package/test/icc-x-api/crypto/exchange-data-manager-test.d.ts +1 -0
- package/test/icc-x-api/crypto/exchange-data-manager-test.js +690 -0
- package/test/icc-x-api/crypto/exchange-data-manager-test.js.map +1 -0
- package/test/icc-x-api/crypto/full-crypto-test.d.ts +1 -0
- package/test/icc-x-api/crypto/full-crypto-test.js +457 -0
- package/test/icc-x-api/crypto/full-crypto-test.js.map +1 -0
- package/test/icc-x-api/crypto/secure-delegations-manager-test.d.ts +1 -0
- package/test/icc-x-api/crypto/secure-delegations-manager-test.js +266 -0
- package/test/icc-x-api/crypto/secure-delegations-manager-test.js.map +1 -0
- package/test/icc-x-api/crypto/secure-delegations-metadata-decryptor-test.d.ts +1 -0
- package/test/icc-x-api/crypto/secure-delegations-metadata-decryptor-test.js +393 -0
- package/test/icc-x-api/crypto/secure-delegations-metadata-decryptor-test.js.map +1 -0
- package/test/icc-x-api/crypto/security-metadata-decryptor-chain-test.d.ts +1 -0
- package/test/icc-x-api/crypto/security-metadata-decryptor-chain-test.js +213 -0
- package/test/icc-x-api/crypto/security-metadata-decryptor-chain-test.js.map +1 -0
- package/test/icc-x-api/crypto/shamir.d.ts +2 -0
- package/test/icc-x-api/crypto/shamir.js +166 -0
- package/test/icc-x-api/crypto/shamir.js.map +1 -0
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.d.ts +1 -0
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js +71 -0
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js.map +1 -0
- package/test/icc-x-api/crypto/signature-keys-manager-test.d.ts +1 -0
- package/test/icc-x-api/crypto/signature-keys-manager-test.js +44 -0
- package/test/icc-x-api/crypto/signature-keys-manager-test.js.map +1 -0
- package/test/icc-x-api/crypto/user-encryption-keys-manager-test.d.ts +1 -0
- package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js +246 -0
- package/test/icc-x-api/crypto/user-encryption-keys-manager-test.js.map +1 -0
- package/test/icc-x-api/entity-with-attachments-api-test.d.ts +1 -0
- package/test/icc-x-api/entity-with-attachments-api-test.js +142 -0
- package/test/icc-x-api/entity-with-attachments-api-test.js.map +1 -0
- package/test/icc-x-api/filters/filters.d.ts +1 -0
- package/test/icc-x-api/filters/filters.js +49 -0
- package/test/icc-x-api/filters/filters.js.map +1 -0
- package/test/icc-x-api/icc-accesslog-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-accesslog-x-api.js +106 -0
- package/test/icc-x-api/icc-accesslog-x-api.js.map +1 -0
- package/test/icc-x-api/icc-auth-api.d.ts +1 -0
- package/test/icc-x-api/icc-auth-api.js +47 -0
- package/test/icc-x-api/icc-auth-api.js.map +1 -0
- package/test/icc-x-api/icc-calendar-item-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-calendar-item-x-api.js +150 -0
- package/test/icc-x-api/icc-calendar-item-x-api.js.map +1 -0
- package/test/icc-x-api/icc-contact-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-contact-x-api.js +279 -0
- package/test/icc-x-api/icc-contact-x-api.js.map +1 -0
- package/test/icc-x-api/icc-form-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-form-x-api.js +98 -0
- package/test/icc-x-api/icc-form-x-api.js.map +1 -0
- package/test/icc-x-api/icc-helement-x-api-test.d.ts +1 -0
- package/test/icc-x-api/icc-helement-x-api-test.js +153 -0
- package/test/icc-x-api/icc-helement-x-api-test.js.map +1 -0
- package/test/icc-x-api/icc-invoice-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-invoice-x-api.js +99 -0
- package/test/icc-x-api/icc-invoice-x-api.js.map +1 -0
- package/test/icc-x-api/icc-maintenance-task-x-api-test.d.ts +1 -0
- package/test/icc-x-api/icc-maintenance-task-x-api-test.js +221 -0
- package/test/icc-x-api/icc-maintenance-task-x-api-test.js.map +1 -0
- package/test/icc-x-api/icc-message-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-message-x-api.js +328 -0
- package/test/icc-x-api/icc-message-x-api.js.map +1 -0
- package/test/icc-x-api/icc-patient-x-api-test.d.ts +1 -0
- package/test/icc-x-api/icc-patient-x-api-test.js +158 -0
- package/test/icc-x-api/icc-patient-x-api-test.js.map +1 -0
- package/test/icc-x-api/icc-recovery-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-recovery-x-api.js +170 -0
- package/test/icc-x-api/icc-recovery-x-api.js.map +1 -0
- package/test/icc-x-api/icc-time-table-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-time-table-x-api.js +100 -0
- package/test/icc-x-api/icc-time-table-x-api.js.map +1 -0
- package/test/icc-x-api/icc-topic-x-api.d.ts +1 -0
- package/test/icc-x-api/icc-topic-x-api.js +269 -0
- package/test/icc-x-api/icc-topic-x-api.js.map +1 -0
- package/test/icc-x-api/icc-user-x-api-test.d.ts +1 -0
- package/test/icc-x-api/icc-user-x-api-test.js +99 -0
- package/test/icc-x-api/icc-user-x-api-test.js.map +1 -0
- package/test/icc-x-api/patient-user.d.ts +2 -0
- package/test/icc-x-api/patient-user.js +104 -0
- package/test/icc-x-api/patient-user.js.map +1 -0
- package/test/icc-x-api/storage/storage.d.ts +1 -0
- package/test/icc-x-api/storage/storage.js +48 -0
- package/test/icc-x-api/storage/storage.js.map +1 -0
- package/test/icc-x-api/test-api-no-parent.d.ts +1 -0
- package/test/icc-x-api/test-api-no-parent.js +79 -0
- package/test/icc-x-api/test-api-no-parent.js.map +1 -0
- package/test/icc-x-api/test-legacy-data-support.d.ts +1 -0
- package/test/icc-x-api/test-legacy-data-support.js +376 -0
- package/test/icc-x-api/test-legacy-data-support.js.map +1 -0
- package/test/icc-x-api/utils/graph-test.d.ts +1 -0
- package/test/icc-x-api/utils/graph-test.js +54 -0
- package/test/icc-x-api/utils/graph-test.js.map +1 -0
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.d.ts +1 -0
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.js +364 -0
- package/test/icc-x-api/utils/lru-temporised-async-cache-test.js.map +1 -0
- package/test/support/CSM-185.d.ts +1 -0
- package/test/support/CSM-185.js +124 -0
- package/test/support/CSM-185.js.map +1 -0
- package/test/support/CSM-243.d.ts +1 -0
- package/test/support/CSM-243.js +120 -0
- package/test/support/CSM-243.js.map +1 -0
- package/test/support/CSM-87.d.ts +0 -0
- package/test/support/CSM-87.js +21 -0
- package/test/support/CSM-87.js.map +1 -0
- package/test/support/CSM-93.d.ts +1 -0
- package/test/support/CSM-93.js +112 -0
- package/test/support/CSM-93.js.map +1 -0
- package/test/utils/FakeDataOwnerApi.d.ts +32 -0
- package/test/utils/FakeDataOwnerApi.js +136 -0
- package/test/utils/FakeDataOwnerApi.js.map +1 -0
- package/test/utils/FakeEncryptionKeysManager.d.ts +35 -0
- package/test/utils/FakeEncryptionKeysManager.js +87 -0
- package/test/utils/FakeEncryptionKeysManager.js.map +1 -0
- package/test/utils/FakeExchangeDataApi.d.ts +30 -0
- package/test/utils/FakeExchangeDataApi.js +74 -0
- package/test/utils/FakeExchangeDataApi.js.map +1 -0
- package/test/utils/FakeExchangeDataManager.d.ts +40 -0
- package/test/utils/FakeExchangeDataManager.js +89 -0
- package/test/utils/FakeExchangeDataManager.js.map +1 -0
- package/test/utils/FakeExchangeDataMapManager.d.ts +12 -0
- package/test/utils/FakeExchangeDataMapManager.js +38 -0
- package/test/utils/FakeExchangeDataMapManager.js.map +1 -0
- package/test/utils/FakeGenericApi.d.ts +16 -0
- package/test/utils/FakeGenericApi.js +65 -0
- package/test/utils/FakeGenericApi.js.map +1 -0
- package/test/utils/FakeSignatureKeysManager.d.ts +16 -0
- package/test/utils/FakeSignatureKeysManager.js +54 -0
- package/test/utils/FakeSignatureKeysManager.js.map +1 -0
- package/test/utils/TestApi.d.ts +3 -0
- package/test/utils/TestApi.js +30 -0
- package/test/utils/TestApi.js.map +1 -0
- package/test/utils/TestCollectionUtils.d.ts +1 -0
- package/test/utils/TestCollectionUtils.js +109 -0
- package/test/utils/TestCollectionUtils.js.map +1 -0
- package/test/utils/TestCryptoStrategies.d.ts +42 -0
- package/test/utils/TestCryptoStrategies.js +80 -0
- package/test/utils/TestCryptoStrategies.js.map +1 -0
- package/test/utils/TestStorage.d.ts +23 -0
- package/test/utils/TestStorage.js +61 -0
- package/test/utils/TestStorage.js.map +1 -0
- package/test/utils/test_utils.d.ts +76 -0
- package/test/utils/test_utils.js +419 -0
- package/test/utils/test_utils.js.map +1 -0
|
@@ -0,0 +1,276 @@
|
|
|
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.RSAUtils(crypto_1.webcrypto);
|
|
49
|
+
const keys = {
|
|
50
|
+
publicKey: yield RSA.importKey('spki', (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.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
|
|
@@ -0,0 +1 @@
|
|
|
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,kDAA2E;AAC3E,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,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,OAAO,CAAA;gBAClE,MAAM,GAAG,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,MAAM,CAAA;gBACzD,IAAI,CAAC,GAAG,EAAE;oBACR,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;iBAC3D;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, ShaVersion } 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 RSAUtils(webcrypto as any)\n const keys = {\n publicKey: await RSA.importKey('spki', hex2ua(credentials.publicKey), ['encrypt'], ShaVersion.Sha1),\n privateKey: await RSA.importKey('pkcs8', 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"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
};
|