@icure/api 7.1.34 → 7.1.35
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/IccAuthApi.d.ts +1 -0
- package/icc-api/api/IccAuthApi.js +1 -0
- package/icc-api/api/IccAuthApi.js.map +1 -1
- package/icc-x-api/index.d.ts +22 -29
- package/icc-x-api/index.js +60 -38
- package/icc-x-api/index.js.map +1 -1
- package/package.json +1 -1
- package/test/icc-api/api/IccDocumentApi.d.ts +1 -0
- package/test/icc-api/api/IccDocumentApi.js +200 -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/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 +80 -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 +45 -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 +222 -0
- package/test/icc-x-api/auth/smart-auth-provider-test.js.map +1 -0
- package/test/icc-x-api/crypto/KeyManager-test.d.ts +1 -0
- package/test/icc-x-api/crypto/KeyManager-test.js +225 -0
- package/test/icc-x-api/crypto/KeyManager-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 +275 -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 +132 -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/full-crypto-test.d.ts +1 -0
- package/test/icc-x-api/crypto/full-crypto-test.js +458 -0
- package/test/icc-x-api/crypto/full-crypto-test.js.map +1 -0
- package/test/icc-x-api/crypto/shamir.d.ts +2 -0
- package/test/icc-x-api/crypto/shamir.js +156 -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 +75 -0
- package/test/icc-x-api/crypto/share-to-newly-created-patient-from-hcp.js.map +1 -0
- package/test/icc-x-api/data-compatibility-test-7to6.d.ts +1 -0
- package/test/icc-x-api/data-compatibility-test-7to6.js +343 -0
- package/test/icc-x-api/data-compatibility-test-7to6.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 +121 -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 +46 -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 +146 -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 +311 -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 +331 -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 +158 -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 +115 -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 +230 -0
- package/test/icc-x-api/icc-maintenance-task-x-api-test.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 +169 -0
- package/test/icc-x-api/icc-patient-x-api-test.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 +110 -0
- package/test/icc-x-api/icc-time-table-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 +108 -0
- package/test/icc-x-api/icc-user-x-api-test.js.map +1 -0
- package/test/icc-x-api/icureapi-group-test.d.ts +1 -0
- package/test/icc-x-api/icureapi-group-test.js +130 -0
- package/test/icc-x-api/icureapi-group-test.js.map +1 -0
- package/test/icc-x-api/patient-user.d.ts +2 -0
- package/test/icc-x-api/patient-user.js +117 -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 +50 -0
- package/test/icc-x-api/storage/storage.js.map +1 -0
- package/test/icc-x-api/subscription-apis.d.ts +2 -0
- package/test/icc-x-api/subscription-apis.js +498 -0
- package/test/icc-x-api/subscription-apis.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 +231 -0
- package/test/icc-x-api/test-legacy-data-support.js.map +1 -0
- package/test/icc-x-api/utils/crypto-utils-test.d.ts +1 -0
- package/test/icc-x-api/utils/crypto-utils-test.js +586 -0
- package/test/icc-x-api/utils/crypto-utils-test.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/support/CSM-185.d.ts +1 -0
- package/test/support/CSM-185.js +120 -0
- package/test/support/CSM-185.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 +111 -0
- package/test/support/CSM-93.js.map +1 -0
- package/test/utils/TestApi.d.ts +3 -0
- package/test/utils/TestApi.js +27 -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 +37 -0
- package/test/utils/TestCryptoStrategies.js +72 -0
- package/test/utils/TestCryptoStrategies.js.map +1 -0
- package/test/utils/TestStorage.d.ts +31 -0
- package/test/utils/TestStorage.js +88 -0
- package/test/utils/TestStorage.js.map +1 -0
- package/test/utils/test_utils.d.ts +60 -0
- package/test/utils/test_utils.js +313 -0
- package/test/utils/test_utils.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patient-user.js","sourceRoot":"","sources":["../../../test/icc-x-api/patient-user.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4BAAyB;AACzB,+BAA6B;AAC7B,iBAAc;AAEd,2CAA6C;AAC7C,mDAA+C;AAC/C,mDAA0C;AAC1C,+CAAwC;AACxC,yDAAqD;AACrD,iCAA8B;AAC9B,oDAAsH;AACtH,wFAAyF;AACzF,IAAO,OAAO,GAAG,sBAAS,CAAC,OAAO,CAAA;AAClC,8CAA0C;AAC1C,oDAAqD;AACrD,mDAAmE;AAEnE,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAA;AACtB,IAAI,GAAa,CAAA;AACjB,IAAI,GAAS,CAAA;AACb,IAAI,OAAa,CAAA;AAEjB,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,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,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C1B,IAAA,aAAM,EAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACnC,IAAA,aAAM,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACzC,CAAC,CAAA,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AACnB,CAAC,CAAC,CAAA","sourcesContent":["import 'isomorphic-fetch'\nimport { expect } from 'chai'\nimport 'mocha'\nimport { Apis } from '../../icc-x-api'\nimport { IccPatientApi } from '../../icc-api'\nimport { User } from '../../icc-api/model/User'\nimport { crypto } from '../../node-compat'\nimport { ua2hex } from '../../icc-x-api'\nimport { Patient } from '../../icc-api/model/Patient'\nimport { before } from 'mocha'\nimport { getEnvironmentInitializer, hcp1Username, patUsername, setLocalStorage, TestUtils } from '../utils/test_utils'\nimport { BasicAuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider'\nimport initApi = TestUtils.initApi\nimport { TestApi } from '../utils/TestApi'\nimport { RSAUtils } from '../../icc-x-api/crypto/RSA'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\n\nsetLocalStorage(fetch)\nlet env: TestVars\nlet api: Apis\nlet hcpUser: User\n\ndescribe('Patient', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n api = await initApi(env, hcp1Username)\n hcpUser = await api.userApi.getCurrentUser()\n })\n\n it('should be capable of creating a patient from scratch', async () => {\n const rawPatientApiForHcp = new IccPatientApi(\n env.iCureUrl,\n {},\n new BasicAuthenticationProvider(env.dataOwnerDetails[hcp1Username].user, env.dataOwnerDetails[hcp1Username].password)\n )\n const patient = await rawPatientApiForHcp.createPatient(\n new Patient({ id: api.cryptoApi.primitives.randomUuid(), firstName: 'Tasty', lastName: 'Test' })\n )\n const pwd = api.cryptoApi.primitives.randomUuid()\n const tmpUser = await api.userApi.createUser(\n new User({\n id: api.cryptoApi.primitives.randomUuid(),\n login: api.cryptoApi.primitives.randomUuid(),\n passwordHash: pwd,\n patientId: patient.id,\n })\n )\n\n const rsa = new RSAUtils(crypto)\n const keyPair = await rsa.generateKeyPair()\n const { publicKey, privateKey } = keyPair\n const publicKeyHex = ua2hex(await rsa.exportKey(publicKey, 'spki'))\n const rawPatientApi = new IccPatientApi(env.iCureUrl, {}, new BasicAuthenticationProvider(tmpUser.id!, pwd))\n await rawPatientApi.modifyPatient({ ...patient, publicKey: publicKeyHex })\n\n const { userApi, patientApi, cryptoApi } = await TestApi(env.iCureUrl, tmpUser.id!, pwd!, crypto, keyPair)\n const user = await userApi.getCurrentUser()\n let me: Patient = await patientApi.getPatientWithUser(user, user.patientId!)\n let updatedRev = me.rev\n updatedRev = (await cryptoApi.exchangeKeys.getOrCreateEncryptionExchangeKeysTo(user.patientId!)).updatedDelegator?.stub.rev ?? updatedRev\n me = updatedRev == me.rev ? me : await patientApi.getPatientWithUser(user, user.patientId!)\n expect((await patientApi.getPatientWithUser(user, user.patientId!)).rev).to.equal(me.rev)\n updatedRev =\n (await cryptoApi.exchangeKeys.getOrCreateEncryptionExchangeKeysTo(hcpUser.healthcarePartyId!)).updatedDelegator?.stub.rev ?? updatedRev\n me = updatedRev == me.rev ? me : await patientApi.getPatientWithUser(user, user.patientId!)\n expect((await patientApi.getPatientWithUser(user, user.patientId!)).rev).to.equal(me.rev)\n const mySecretIds = await cryptoApi.entities.secretIdsOf(me)\n const myEncryptionKeys = await cryptoApi.entities.encryptionKeysOf(me)\n expect(mySecretIds).to.have.length(1)\n expect(myEncryptionKeys).to.have.length(1)\n\n me = (await patientApi.modifyPatientWithUser(\n user,\n await cryptoApi.entities.entityWithExtendedEncryptedMetadata(me, hcpUser.healthcarePartyId!, mySecretIds, myEncryptionKeys, [], [])\n ))!\n await patientApi.modifyPatientWithUser(user, new Patient({ ...me, note: 'This is secret' }))\n\n const pat2 = await api.patientApi.getPatientWithUser(hcpUser, patient.id!)\n expect(pat2 != null)\n expect(pat2.note != null)\n }).timeout(60000)\n\n it('should be capable of logging in and encryption', async () => {\n const { userApi, calendarItemApi, patientApi } = await initApi(env, patUsername)\n\n const user = await userApi.getCurrentUser()\n\n const patNote = 'Secret note'\n const retrievedPat = await patientApi.getPatientWithUser(user, user.patientId!)\n const pat = await patientApi.modifyPatientWithUser(user, {\n ...retrievedPat,\n note: patNote,\n })\n expect(pat!.note).to.equal(patNote)\n const ciTitle = 'Secret title'\n const ciDetails = 'Important and private information'\n const ci = await calendarItemApi.createCalendarItemWithHcParty(\n user,\n await calendarItemApi.newInstancePatient(user, pat, { patientId: pat!.id, title: ciTitle, details: ciDetails })\n )\n\n let failed = false\n try {\n await api.patientApi.getPatientWithUser(hcpUser, pat!.id!)\n } catch {\n failed = true\n }\n expect(failed).to.be.true\n failed = false\n try {\n await api.calendarItemApi.getCalendarItemWithUser(hcpUser, ci.id)\n } catch {\n failed = true\n }\n expect(failed).to.be.true\n\n await patientApi.shareWith(hcpUser.healthcarePartyId!, pat!, await patientApi.decryptSecretIdsOf(pat!))\n await calendarItemApi.shareWith(hcpUser.healthcarePartyId!, ci!)\n await api.cryptoApi.forceReload()\n const pat3 = await api.patientApi.getPatientWithUser(hcpUser, pat!.id!)\n const ci3 = await api.calendarItemApi.getCalendarItemWithUser(hcpUser, ci.id)\n expect(pat3).to.not.be.null\n expect(pat3.note).to.equal(patNote)\n expect(ci3).to.not.be.null\n expect(ci3.title).to.equal(ciTitle)\n expect(ci3.details).to.equal(ciDetails)\n }).timeout(60000)\n})\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'isomorphic-fetch';
|
|
@@ -0,0 +1,50 @@
|
|
|
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 chai_1 = require("chai");
|
|
13
|
+
const LocalStorageImpl_1 = require("../../../icc-x-api/storage/LocalStorageImpl");
|
|
14
|
+
const os_1 = require("os");
|
|
15
|
+
require("isomorphic-fetch");
|
|
16
|
+
const util_1 = require("util");
|
|
17
|
+
const icc_x_api_1 = require("../../../icc-x-api");
|
|
18
|
+
global.localStorage = new (require('node-localstorage').LocalStorage)((0, os_1.tmpdir)(), 5 * 1024 * 1024 * 1024);
|
|
19
|
+
global.fetch = fetch;
|
|
20
|
+
global.Storage = '';
|
|
21
|
+
global.TextDecoder = util_1.TextDecoder;
|
|
22
|
+
global.TextEncoder = util_1.TextEncoder;
|
|
23
|
+
const testStorage = new LocalStorageImpl_1.LocalStorageImpl();
|
|
24
|
+
const testKeyStorage = new icc_x_api_1.KeyStorageImpl(testStorage);
|
|
25
|
+
describe('Test LocalStorageFacade abstraction', () => {
|
|
26
|
+
it('should store and retrieve a keypair', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
const key = 'key';
|
|
28
|
+
const keyPair = {
|
|
29
|
+
publicKey: 'publicKey',
|
|
30
|
+
privateKey: 'privateKey', // pragma: allowlist secret
|
|
31
|
+
};
|
|
32
|
+
yield testStorage.setItem(key, JSON.stringify(keyPair));
|
|
33
|
+
(0, chai_1.expect)(yield testStorage.getItem(key)).to.eq(JSON.stringify(keyPair));
|
|
34
|
+
}));
|
|
35
|
+
it('should store and retrieve a string', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
const key = 'key';
|
|
37
|
+
const value = 'value';
|
|
38
|
+
yield testStorage.setItem(key, value);
|
|
39
|
+
(0, chai_1.expect)(yield testStorage.getItem(key)).to.eq(value);
|
|
40
|
+
}));
|
|
41
|
+
it('should remove a key', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
const key = 'key';
|
|
43
|
+
const value = 'value';
|
|
44
|
+
yield testStorage.setItem(key, value);
|
|
45
|
+
(0, chai_1.expect)(yield testStorage.getItem(key)).to.eq(value);
|
|
46
|
+
yield testStorage.removeItem(key);
|
|
47
|
+
(0, chai_1.expect)(yield testStorage.getItem(key)).to.be.undefined;
|
|
48
|
+
}));
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../../test/icc-x-api/storage/storage.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+BAA6B;AAC7B,kFAA8E;AAC9E,2BAA2B;AAC3B,4BAAyB;AACzB,+BAA+C;AAC/C,kDACC;AAAC,MAAc,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,CAAC,IAAA,WAAM,GAAE,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAChH;AAAC,MAAc,CAAC,KAAK,GAAG,KAAK,CAC7B;AAAC,MAAc,CAAC,OAAO,GAAG,EAAE,CAC5B;AAAC,MAAc,CAAC,WAAW,GAAG,kBAAW,CACzC;AAAC,MAAc,CAAC,WAAW,GAAG,kBAAW,CAAA;AAC1C,MAAM,WAAW,GAAG,IAAI,mCAAgB,EAAE,CAAA;AAC1C,MAAM,cAAc,GAAG,IAAI,0BAAc,CAAC,WAAW,CAAC,CAAA;AAEtD,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,EAAE,CAAC,qCAAqC,EAAE,GAAS,EAAE;QACnD,MAAM,GAAG,GA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AC,CAAC,CAAA","sourcesContent":["import { expect } from 'chai'\nimport { LocalStorageImpl } from '../../../icc-x-api/storage/LocalStorageImpl'\nimport { tmpdir } from 'os'\nimport 'isomorphic-fetch'\nimport { TextDecoder, TextEncoder } from 'util'\nimport { KeyStorageImpl } from '../../../icc-x-api'\n;(global as any).localStorage = new (require('node-localstorage').LocalStorage)(tmpdir(), 5 * 1024 * 1024 * 1024)\n;(global as any).fetch = fetch\n;(global as any).Storage = ''\n;(global as any).TextDecoder = TextDecoder\n;(global as any).TextEncoder = TextEncoder\nconst testStorage = new LocalStorageImpl()\nconst testKeyStorage = new KeyStorageImpl(testStorage)\n\ndescribe('Test LocalStorageFacade abstraction', () => {\n it('should store and retrieve a keypair', async () => {\n const key = 'key'\n const keyPair = {\n publicKey: 'publicKey',\n privateKey: 'privateKey', // pragma: allowlist secret\n }\n await testStorage.setItem(key, JSON.stringify(keyPair))\n expect(await testStorage.getItem(key)).to.eq(JSON.stringify(keyPair))\n })\n\n it('should store and retrieve a string', async () => {\n const key = 'key'\n const value = 'value'\n await testStorage.setItem(key, value)\n expect(await testStorage.getItem(key)).to.eq(value)\n })\n\n it('should remove a key', async () => {\n const key = 'key'\n const value = 'value'\n await testStorage.setItem(key, value)\n expect(await testStorage.getItem(key)).to.eq(value)\n await testStorage.removeItem(key)\n expect(await testStorage.getItem(key)).to.be.undefined\n })\n})\n"]}
|
|
@@ -0,0 +1,498 @@
|
|
|
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("mocha");
|
|
13
|
+
require("isomorphic-fetch");
|
|
14
|
+
const api_1 = require("@icure/api");
|
|
15
|
+
const chai_1 = require("chai");
|
|
16
|
+
const types_1 = require("@icure/test-setup/types");
|
|
17
|
+
const test_utils_1 = require("../utils/test_utils");
|
|
18
|
+
const User_1 = require("../../icc-api/model/User");
|
|
19
|
+
const Service_1 = require("../../icc-api/model/Service");
|
|
20
|
+
const Patient_1 = require("../../icc-api/model/Patient");
|
|
21
|
+
const Content_1 = require("../../icc-api/model/Content");
|
|
22
|
+
const CodeStub_1 = require("../../icc-api/model/CodeStub");
|
|
23
|
+
const Contact_1 = require("../../icc-api/model/Contact");
|
|
24
|
+
const ServiceByHcPartyFilter_1 = require("../../icc-x-api/filters/ServiceByHcPartyFilter");
|
|
25
|
+
const MaintenanceTaskByHcPartyAndTypeFilter_1 = require("../../icc-x-api/filters/MaintenanceTaskByHcPartyAndTypeFilter");
|
|
26
|
+
const MaintenanceTask_1 = require("../../icc-api/model/MaintenanceTask");
|
|
27
|
+
const uuid_1 = require("uuid");
|
|
28
|
+
const HealthElement_1 = require("../../icc-api/model/HealthElement");
|
|
29
|
+
const HealthElementByHcPartyTagCodeFilter_1 = require("../../icc-x-api/filters/HealthElementByHcPartyTagCodeFilter");
|
|
30
|
+
const PatientByHcPartyNameContainsFuzzyFilter_1 = require("../../icc-x-api/filters/PatientByHcPartyNameContainsFuzzyFilter");
|
|
31
|
+
const websocket_1 = require("../../icc-x-api/utils/websocket");
|
|
32
|
+
const AllUsersFilter_1 = require("../../icc-x-api/filters/AllUsersFilter");
|
|
33
|
+
const ContactByHcPartyFilter_1 = require("../../icc-x-api/filters/ContactByHcPartyFilter");
|
|
34
|
+
const HealthcareParty_1 = require("../../icc-api/model/HealthcareParty");
|
|
35
|
+
const Device_1 = require("../../icc-api/model/Device");
|
|
36
|
+
const AllHealthcarePartiesFilter_1 = require("../../icc-x-api/filters/AllHealthcarePartiesFilter");
|
|
37
|
+
const AllDevicesFilter_1 = require("../../icc-x-api/filters/AllDevicesFilter");
|
|
38
|
+
var initApi = test_utils_1.TestUtils.initApi;
|
|
39
|
+
var initMasterApi = test_utils_1.TestUtils.initMasterApi;
|
|
40
|
+
(0, test_utils_1.setLocalStorage)(fetch);
|
|
41
|
+
let env;
|
|
42
|
+
const testType = 'IC-TEST';
|
|
43
|
+
const testCode = 'TEST';
|
|
44
|
+
let api;
|
|
45
|
+
let hcp1Api;
|
|
46
|
+
let hcp1User;
|
|
47
|
+
let masterApi;
|
|
48
|
+
describe('Subscription API', () => {
|
|
49
|
+
before(function () {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
this.timeout(600000);
|
|
52
|
+
const initializer = yield (0, test_utils_1.getEnvironmentInitializer)();
|
|
53
|
+
env = yield initializer.execute((0, types_1.getEnvVariables)());
|
|
54
|
+
if (env.backendType === 'oss')
|
|
55
|
+
this.skip();
|
|
56
|
+
api = yield initApi(env, test_utils_1.hcp3Username);
|
|
57
|
+
hcp1Api = yield initApi(env, test_utils_1.hcp1Username);
|
|
58
|
+
hcp1User = yield hcp1Api.userApi.getCurrentUser();
|
|
59
|
+
masterApi = yield initMasterApi(env);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
function doXOnYAndSubscribe(api, options, connectionPromise, x, statusListener, eventReceivedPromiseReject, eventReceivedPromise) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const connection = (yield connectionPromise)
|
|
65
|
+
.onClosed(() => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
statusListener('CLOSED');
|
|
67
|
+
yield (0, api_1.sleep)(3000);
|
|
68
|
+
}))
|
|
69
|
+
.onConnected(() => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
statusListener('CONNECTED');
|
|
71
|
+
yield (0, api_1.sleep)(2000);
|
|
72
|
+
yield x();
|
|
73
|
+
}));
|
|
74
|
+
const timeout = setTimeout(eventReceivedPromiseReject, 20000);
|
|
75
|
+
yield eventReceivedPromise.then(() => clearTimeout(timeout)).catch(() => { });
|
|
76
|
+
connection.close();
|
|
77
|
+
yield (0, api_1.sleep)(3000);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
describe('Can subscribe to Service and Contact', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
+
const subscribeAndCreateContactOrService = (options, eventTypes, creationApi, subscriptionApi, supplier, target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
|
+
const connectionPromise = (options, dataOwnerId, eventListener) => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
|
+
return target === 'service'
|
|
84
|
+
? subscriptionApi.contactApi.subscribeToServiceEvents(eventTypes, new ServiceByHcPartyFilter_1.ServiceByHcPartyFilter({
|
|
85
|
+
hcpId: dataOwnerId,
|
|
86
|
+
}), eventListener, options)
|
|
87
|
+
: subscriptionApi.contactApi.subscribeToContactEvents(eventTypes, new ContactByHcPartyFilter_1.ContactByHcPartyFilter({
|
|
88
|
+
hcpId: dataOwnerId,
|
|
89
|
+
}), eventListener, options);
|
|
90
|
+
});
|
|
91
|
+
const loggedUser = yield creationApi.userApi.getCurrentUser();
|
|
92
|
+
const events = [];
|
|
93
|
+
const statuses = [];
|
|
94
|
+
let eventReceivedPromiseResolve;
|
|
95
|
+
let eventReceivedPromiseReject;
|
|
96
|
+
const eventReceivedPromise = new Promise((res, rej) => {
|
|
97
|
+
eventReceivedPromiseResolve = res;
|
|
98
|
+
eventReceivedPromiseReject = rej;
|
|
99
|
+
});
|
|
100
|
+
yield doXOnYAndSubscribe(creationApi, options, connectionPromise({}, loggedUser.healthcarePartyId, (ds) => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
|
+
events.push(ds);
|
|
102
|
+
eventReceivedPromiseResolve();
|
|
103
|
+
})), supplier, (status) => {
|
|
104
|
+
statuses.push(status);
|
|
105
|
+
}, eventReceivedPromiseReject, eventReceivedPromise);
|
|
106
|
+
events === null || events === void 0 ? void 0 : events.forEach((event) => console.log(`Event : ${event}`));
|
|
107
|
+
statuses === null || statuses === void 0 ? void 0 : statuses.forEach((status) => console.log(`Status : ${status}`));
|
|
108
|
+
(0, chai_1.assert)(events.length === 1, 'The events have not been recorded');
|
|
109
|
+
(0, chai_1.assert)(statuses.length === 2, 'The statuses have not been recorded');
|
|
110
|
+
(0, chai_1.assert)(events.every((event) => (target === 'service' && event) || (target === 'contact' && event)), 'The events are not of type ' + target);
|
|
111
|
+
});
|
|
112
|
+
const createService = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
113
|
+
const user = yield api.userApi.getCurrentUser();
|
|
114
|
+
const newPatient = new Patient_1.Patient({
|
|
115
|
+
firstName: 'John',
|
|
116
|
+
lastName: 'Snow',
|
|
117
|
+
note: 'Winter is coming',
|
|
118
|
+
});
|
|
119
|
+
const newInstanceOfPatient = yield api.patientApi.newInstance(user, newPatient);
|
|
120
|
+
const patient = yield api.patientApi.createPatientWithUser(user, newInstanceOfPatient);
|
|
121
|
+
const newContact = new Contact_1.Contact({
|
|
122
|
+
id: (0, uuid_1.v4)(),
|
|
123
|
+
services: [
|
|
124
|
+
new Service_1.Service({
|
|
125
|
+
id: (0, uuid_1.v4)(),
|
|
126
|
+
labels: new Set([new CodeStub_1.CodeStub({ type: testType, code: testCode })]),
|
|
127
|
+
content: { en: new Content_1.Content({ stringValue: 'Hello world' }) },
|
|
128
|
+
}),
|
|
129
|
+
],
|
|
130
|
+
});
|
|
131
|
+
const newInstanceOfContact = yield api.contactApi.newInstance(user, patient, newContact);
|
|
132
|
+
const createdContact = yield api.contactApi.createContactWithUser(user, newInstanceOfContact);
|
|
133
|
+
return {
|
|
134
|
+
contact: createdContact,
|
|
135
|
+
service: createdContact.services[0],
|
|
136
|
+
patient: patient,
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
const deleteService = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
140
|
+
const { service, patient } = yield createService();
|
|
141
|
+
const user = yield api.userApi.getCurrentUser();
|
|
142
|
+
const contactToDeleteServices = yield api.contactApi.newInstance(user, patient, new Contact_1.Contact({
|
|
143
|
+
id: (0, uuid_1.v4)(),
|
|
144
|
+
services: [
|
|
145
|
+
new Service_1.Service({
|
|
146
|
+
id: service.id,
|
|
147
|
+
created: service.created,
|
|
148
|
+
modified: +new Date(),
|
|
149
|
+
endOfLife: +new Date(),
|
|
150
|
+
}),
|
|
151
|
+
],
|
|
152
|
+
}));
|
|
153
|
+
const contactToDelete = yield api.contactApi.createContactWithUser(user, contactToDeleteServices);
|
|
154
|
+
});
|
|
155
|
+
it('CREATE Service without options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
156
|
+
yield subscribeAndCreateContactOrService({}, ['CREATE'], api, api, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
157
|
+
yield createService();
|
|
158
|
+
}), 'service');
|
|
159
|
+
})).timeout(60000);
|
|
160
|
+
it('CREATE Service with options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
161
|
+
yield subscribeAndCreateContactOrService({
|
|
162
|
+
connectionRetryIntervalMs: 10000,
|
|
163
|
+
connectionMaxRetry: 5,
|
|
164
|
+
}, ['CREATE'], api, api, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
165
|
+
yield createService();
|
|
166
|
+
}), 'service');
|
|
167
|
+
})).timeout(60000);
|
|
168
|
+
it('CREATE Service without options with another instance of api', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
169
|
+
const subscriptionApi = yield initApi(env, test_utils_1.hcp3Username);
|
|
170
|
+
yield subscribeAndCreateContactOrService({}, ['CREATE'], api, subscriptionApi, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
171
|
+
yield createService();
|
|
172
|
+
}), 'service');
|
|
173
|
+
})).timeout(60000);
|
|
174
|
+
it('CREATE Service with options with another instance of api', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
175
|
+
const subscriptionApi = yield initApi(env, test_utils_1.hcp3Username);
|
|
176
|
+
yield subscribeAndCreateContactOrService({
|
|
177
|
+
connectionRetryIntervalMs: 10000,
|
|
178
|
+
connectionMaxRetry: 5,
|
|
179
|
+
}, ['CREATE'], api, subscriptionApi, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
180
|
+
yield createService();
|
|
181
|
+
}), 'service');
|
|
182
|
+
})).timeout(60000);
|
|
183
|
+
it('CREATE Contact without options with another instance of api', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
184
|
+
const subscriptionApi = yield initApi(env, test_utils_1.hcp3Username);
|
|
185
|
+
yield subscribeAndCreateContactOrService({}, ['CREATE'], api, subscriptionApi, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
186
|
+
yield createService();
|
|
187
|
+
}), 'contact');
|
|
188
|
+
})).timeout(60000);
|
|
189
|
+
it('CREATE Contact with options with another instance of api', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
190
|
+
const subscriptionApi = yield initApi(env, test_utils_1.hcp3Username);
|
|
191
|
+
yield subscribeAndCreateContactOrService({
|
|
192
|
+
connectionRetryIntervalMs: 10000,
|
|
193
|
+
connectionMaxRetry: 5,
|
|
194
|
+
}, ['CREATE'], api, subscriptionApi, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
195
|
+
yield createService();
|
|
196
|
+
}), 'contact');
|
|
197
|
+
})).timeout(60000);
|
|
198
|
+
it('DELETE Service without options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
199
|
+
yield subscribeAndCreateContactOrService({}, ['DELETE'], api, api, () => __awaiter(void 0, void 0, void 0, function* () { return deleteService(); }), 'service');
|
|
200
|
+
})).timeout(60000);
|
|
201
|
+
it('DELETE Service with options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
202
|
+
yield subscribeAndCreateContactOrService({
|
|
203
|
+
connectionRetryIntervalMs: 10000,
|
|
204
|
+
connectionMaxRetry: 5,
|
|
205
|
+
}, ['DELETE'], api, api, () => __awaiter(void 0, void 0, void 0, function* () { return deleteService(); }), 'service');
|
|
206
|
+
})).timeout(60000);
|
|
207
|
+
}));
|
|
208
|
+
describe('Can subscribe to MaintenanceTasks', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
209
|
+
const subscribeAndCreateMaintenanceTask = (options, eventTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
210
|
+
const loggedUser = yield api.userApi.getCurrentUser();
|
|
211
|
+
const connectionPromise = (options, dataOwnerId, eventListener) => __awaiter(void 0, void 0, void 0, function* () {
|
|
212
|
+
return api.maintenanceTaskApi.subscribeToMaintenanceTaskEvents(eventTypes, new MaintenanceTaskByHcPartyAndTypeFilter_1.MaintenanceTaskByHcPartyAndTypeFilter({
|
|
213
|
+
healthcarePartyId: loggedUser.healthcarePartyId,
|
|
214
|
+
type: MaintenanceTask_1.MaintenanceTask.TaskTypeEnum.KeyPairUpdate,
|
|
215
|
+
}), eventListener, options);
|
|
216
|
+
});
|
|
217
|
+
const events = [];
|
|
218
|
+
const statuses = [];
|
|
219
|
+
let eventReceivedPromiseResolve;
|
|
220
|
+
let eventReceivedPromiseReject;
|
|
221
|
+
const eventReceivedPromise = new Promise((res, rej) => {
|
|
222
|
+
eventReceivedPromiseResolve = res;
|
|
223
|
+
eventReceivedPromiseReject = rej;
|
|
224
|
+
});
|
|
225
|
+
yield doXOnYAndSubscribe(api, options, connectionPromise({}, loggedUser.healthcarePartyId, (notification) => __awaiter(void 0, void 0, void 0, function* () {
|
|
226
|
+
events.push(notification);
|
|
227
|
+
eventReceivedPromiseResolve();
|
|
228
|
+
})), () => __awaiter(void 0, void 0, void 0, function* () {
|
|
229
|
+
const notificationId = (0, uuid_1.v4)();
|
|
230
|
+
const notification = yield api.maintenanceTaskApi.newInstance(loggedUser, new MaintenanceTask_1.MaintenanceTask({
|
|
231
|
+
id: notificationId,
|
|
232
|
+
status: 'pending',
|
|
233
|
+
taskType: MaintenanceTask_1.MaintenanceTask.TaskTypeEnum.KeyPairUpdate,
|
|
234
|
+
}));
|
|
235
|
+
const createdMaintenanceTask = yield api.maintenanceTaskApi.createMaintenanceTaskWithUser(loggedUser, notification);
|
|
236
|
+
(0, chai_1.assert)(!!createdMaintenanceTask);
|
|
237
|
+
return createdMaintenanceTask;
|
|
238
|
+
}), (status) => {
|
|
239
|
+
statuses.push(status);
|
|
240
|
+
}, eventReceivedPromiseReject, eventReceivedPromise);
|
|
241
|
+
events === null || events === void 0 ? void 0 : events.forEach((event) => console.log(`Event : ${event}`));
|
|
242
|
+
statuses === null || statuses === void 0 ? void 0 : statuses.forEach((status) => console.log(`Status : ${status}`));
|
|
243
|
+
(0, chai_1.assert)(events.length === 1, 'The events have not been recorded');
|
|
244
|
+
(0, chai_1.assert)(statuses.length === 2, 'The statuses have not been recorded');
|
|
245
|
+
(0, chai_1.assert)(events.every((event) => event instanceof MaintenanceTask_1.MaintenanceTask), 'The events are not of type MaintenanceTask');
|
|
246
|
+
});
|
|
247
|
+
it('CREATE MaintenanceTask without options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
248
|
+
yield subscribeAndCreateMaintenanceTask({}, ['CREATE']);
|
|
249
|
+
})).timeout(60000);
|
|
250
|
+
it('CREATE MaintenanceTask with options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
251
|
+
yield subscribeAndCreateMaintenanceTask({
|
|
252
|
+
connectionRetryIntervalMs: 10000,
|
|
253
|
+
connectionMaxRetry: 5,
|
|
254
|
+
}, ['CREATE']);
|
|
255
|
+
})).timeout(60000);
|
|
256
|
+
}));
|
|
257
|
+
describe('Can subscribe to HealthElements', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
258
|
+
const subscribeAndCreateHealthElement = (options, eventTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
259
|
+
const connectionPromise = (options, dataOwnerId, eventListener) => __awaiter(void 0, void 0, void 0, function* () {
|
|
260
|
+
return api.healthcareElementApi.subscribeToHealthElementEvents(eventTypes, new HealthElementByHcPartyTagCodeFilter_1.HealthElementByHcPartyTagCodeFilter({
|
|
261
|
+
hcpId: hcp1User.healthcarePartyId,
|
|
262
|
+
tagCode: testCode,
|
|
263
|
+
tagType: testType,
|
|
264
|
+
}), eventListener, options);
|
|
265
|
+
});
|
|
266
|
+
const loggedUser = yield api.userApi.getCurrentUser();
|
|
267
|
+
const events = [];
|
|
268
|
+
const statuses = [];
|
|
269
|
+
let eventReceivedPromiseResolve;
|
|
270
|
+
let eventReceivedPromiseReject;
|
|
271
|
+
const eventReceivedPromise = new Promise((res, rej) => {
|
|
272
|
+
eventReceivedPromiseResolve = res;
|
|
273
|
+
eventReceivedPromiseReject = rej;
|
|
274
|
+
});
|
|
275
|
+
yield doXOnYAndSubscribe(api, options, connectionPromise({}, loggedUser.healthcarePartyId, (healthcareElement) => __awaiter(void 0, void 0, void 0, function* () {
|
|
276
|
+
events.push(healthcareElement);
|
|
277
|
+
eventReceivedPromiseResolve();
|
|
278
|
+
})), () => __awaiter(void 0, void 0, void 0, function* () {
|
|
279
|
+
const user = yield api.userApi.getCurrentUser();
|
|
280
|
+
const patient = yield api.patientApi.createPatientWithUser(user, yield api.patientApi.newInstance(user, new Patient_1.Patient({
|
|
281
|
+
firstName: 'John',
|
|
282
|
+
lastName: 'Snow',
|
|
283
|
+
note: 'Winter is coming',
|
|
284
|
+
})));
|
|
285
|
+
yield api.healthcareElementApi.createHealthElementWithUser(user, yield api.healthcareElementApi.newInstance(user, patient, new HealthElement_1.HealthElement({
|
|
286
|
+
note: 'Hero Syndrome',
|
|
287
|
+
tags: [new CodeStub_1.CodeStub({ id: 'id', code: testCode, type: testType })],
|
|
288
|
+
})));
|
|
289
|
+
}), (status) => {
|
|
290
|
+
statuses.push(status);
|
|
291
|
+
}, eventReceivedPromiseReject, eventReceivedPromise);
|
|
292
|
+
events === null || events === void 0 ? void 0 : events.forEach((event) => console.log(`Event : ${event}`));
|
|
293
|
+
statuses === null || statuses === void 0 ? void 0 : statuses.forEach((status) => console.log(`Status : ${status}`));
|
|
294
|
+
(0, chai_1.assert)(events.length === 1, 'The events have not been recorded');
|
|
295
|
+
(0, chai_1.assert)(statuses.length === 2, 'The statuses have not been recorded');
|
|
296
|
+
(0, chai_1.assert)(events.every((event) => event instanceof HealthElement_1.HealthElement), 'The events are not of type HealthElement');
|
|
297
|
+
});
|
|
298
|
+
it('CREATE HealthElement without options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
299
|
+
yield subscribeAndCreateHealthElement({}, ['CREATE']);
|
|
300
|
+
})).timeout(60000);
|
|
301
|
+
it('CREATE HealthElement with options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
302
|
+
yield subscribeAndCreateHealthElement({
|
|
303
|
+
connectionRetryIntervalMs: 10000,
|
|
304
|
+
connectionMaxRetry: 5,
|
|
305
|
+
}, ['CREATE']);
|
|
306
|
+
})).timeout(60000);
|
|
307
|
+
}));
|
|
308
|
+
describe('Can subscribe to Patients', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
309
|
+
const subscribeAndCreatePatient = (options, eventTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
310
|
+
const connectionPromise = (options, dataOwnerId, eventListener) => __awaiter(void 0, void 0, void 0, function* () {
|
|
311
|
+
yield (0, api_1.sleep)(2000);
|
|
312
|
+
return api.patientApi.subscribeToPatientEvents(eventTypes, new PatientByHcPartyNameContainsFuzzyFilter_1.PatientByHcPartyNameContainsFuzzyFilter({
|
|
313
|
+
healthcarePartyId: loggedUser.healthcarePartyId,
|
|
314
|
+
searchString: 'John',
|
|
315
|
+
}), eventListener, options);
|
|
316
|
+
});
|
|
317
|
+
const loggedUser = yield api.userApi.getCurrentUser();
|
|
318
|
+
const events = [];
|
|
319
|
+
const statuses = [];
|
|
320
|
+
let eventReceivedPromiseResolve;
|
|
321
|
+
let eventReceivedPromiseReject;
|
|
322
|
+
const eventReceivedPromise = new Promise((res, rej) => {
|
|
323
|
+
eventReceivedPromiseResolve = res;
|
|
324
|
+
eventReceivedPromiseReject = rej;
|
|
325
|
+
});
|
|
326
|
+
yield doXOnYAndSubscribe(api, options, connectionPromise(options, loggedUser.healthcarePartyId, (patient) => __awaiter(void 0, void 0, void 0, function* () {
|
|
327
|
+
events.push(patient);
|
|
328
|
+
eventReceivedPromiseResolve();
|
|
329
|
+
})), () => __awaiter(void 0, void 0, void 0, function* () {
|
|
330
|
+
const user = yield api.userApi.getCurrentUser();
|
|
331
|
+
yield api.patientApi.createPatientWithUser(user, yield api.patientApi.newInstance(user, new Patient_1.Patient({
|
|
332
|
+
firstName: 'John',
|
|
333
|
+
lastName: 'Snow',
|
|
334
|
+
note: 'Winter is coming',
|
|
335
|
+
})));
|
|
336
|
+
}), (status) => {
|
|
337
|
+
statuses.push(status);
|
|
338
|
+
}, eventReceivedPromiseReject, eventReceivedPromise);
|
|
339
|
+
events === null || events === void 0 ? void 0 : events.forEach((event) => console.log(`Event : ${event}`));
|
|
340
|
+
statuses === null || statuses === void 0 ? void 0 : statuses.forEach((status) => console.log(`Status : ${status}`));
|
|
341
|
+
(0, chai_1.assert)(events.length === 1, 'The events have not been recorded');
|
|
342
|
+
(0, chai_1.assert)(statuses.length === 2, 'The statuses have not been recorded');
|
|
343
|
+
(0, chai_1.assert)(events.every((event) => event instanceof Patient_1.Patient), 'The events are not of type Patient');
|
|
344
|
+
});
|
|
345
|
+
it('CREATE Patient without option', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
346
|
+
yield subscribeAndCreatePatient({}, ['CREATE']);
|
|
347
|
+
})).timeout(60000);
|
|
348
|
+
it('CREATE Patient with options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
349
|
+
yield subscribeAndCreatePatient({
|
|
350
|
+
connectionRetryIntervalMs: 10000,
|
|
351
|
+
connectionMaxRetry: 5,
|
|
352
|
+
}, ['CREATE']);
|
|
353
|
+
})).timeout(60000);
|
|
354
|
+
}));
|
|
355
|
+
describe('Can subscribe to HealthcareParty', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
356
|
+
const subscribeAndCreateHealthcareParty = (options, eventTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
357
|
+
const connectionPromise = (options, dataOwnerId, eventListener) => __awaiter(void 0, void 0, void 0, function* () {
|
|
358
|
+
yield (0, api_1.sleep)(2000);
|
|
359
|
+
return masterApi.healthcarePartyApi.subscribeToHealthcarePartyEvents(eventTypes, new AllHealthcarePartiesFilter_1.AllHealthcarePartiesFilter({}), eventListener, options);
|
|
360
|
+
});
|
|
361
|
+
const loggedUser = yield masterApi.userApi.getCurrentUser();
|
|
362
|
+
const events = [];
|
|
363
|
+
const statuses = [];
|
|
364
|
+
let eventReceivedPromiseResolve;
|
|
365
|
+
let eventReceivedPromiseReject;
|
|
366
|
+
const eventReceivedPromise = new Promise((res, rej) => {
|
|
367
|
+
eventReceivedPromiseResolve = res;
|
|
368
|
+
eventReceivedPromiseReject = rej;
|
|
369
|
+
});
|
|
370
|
+
yield doXOnYAndSubscribe(masterApi, options, connectionPromise(options, loggedUser.healthcarePartyId, (patient) => __awaiter(void 0, void 0, void 0, function* () {
|
|
371
|
+
events.push(patient);
|
|
372
|
+
eventReceivedPromiseResolve();
|
|
373
|
+
})), () => __awaiter(void 0, void 0, void 0, function* () {
|
|
374
|
+
yield masterApi.healthcarePartyApi.createHealthcareParty(new HealthcareParty_1.HealthcareParty({ id: (0, uuid_1.v4)(), firstName: 'Homer', lastName: 'Simpson', parentId: loggedUser.healthcarePartyId }));
|
|
375
|
+
}), (status) => {
|
|
376
|
+
statuses.push(status);
|
|
377
|
+
}, eventReceivedPromiseReject, eventReceivedPromise);
|
|
378
|
+
events === null || events === void 0 ? void 0 : events.forEach((event) => console.log(`Event : ${event}`));
|
|
379
|
+
statuses === null || statuses === void 0 ? void 0 : statuses.forEach((status) => console.log(`Status : ${status}`));
|
|
380
|
+
(0, chai_1.assert)(events.length === 1, 'The events have not been recorded');
|
|
381
|
+
(0, chai_1.assert)(statuses.length === 2, 'The statuses have not been recorded');
|
|
382
|
+
});
|
|
383
|
+
it('CREATE HealthcareParty without option', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
384
|
+
yield subscribeAndCreateHealthcareParty({}, ['CREATE']);
|
|
385
|
+
})).timeout(60000);
|
|
386
|
+
it('CREATE HealthcareParty with options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
387
|
+
yield subscribeAndCreateHealthcareParty({
|
|
388
|
+
connectionRetryIntervalMs: 10000,
|
|
389
|
+
connectionMaxRetry: 5,
|
|
390
|
+
}, ['CREATE']);
|
|
391
|
+
})).timeout(60000);
|
|
392
|
+
}));
|
|
393
|
+
describe('Can subscribe to Device', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
394
|
+
const subscribeAndCreateDevice = (options, eventTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
395
|
+
const connectionPromise = (options, dataOwnerId, eventListener) => __awaiter(void 0, void 0, void 0, function* () {
|
|
396
|
+
yield (0, api_1.sleep)(2000);
|
|
397
|
+
return api.deviceApi.subscribeToDeviceEvents(eventTypes, new AllDevicesFilter_1.AllDevicesFilter({}), eventListener, options);
|
|
398
|
+
});
|
|
399
|
+
const loggedUser = yield api.userApi.getCurrentUser();
|
|
400
|
+
const events = [];
|
|
401
|
+
const statuses = [];
|
|
402
|
+
let eventReceivedPromiseResolve;
|
|
403
|
+
let eventReceivedPromiseReject;
|
|
404
|
+
const eventReceivedPromise = new Promise((res, rej) => {
|
|
405
|
+
eventReceivedPromiseResolve = res;
|
|
406
|
+
eventReceivedPromiseReject = rej;
|
|
407
|
+
});
|
|
408
|
+
yield doXOnYAndSubscribe(api, options, connectionPromise(options, loggedUser.healthcarePartyId, (patient) => __awaiter(void 0, void 0, void 0, function* () {
|
|
409
|
+
events.push(patient);
|
|
410
|
+
eventReceivedPromiseResolve();
|
|
411
|
+
})), () => __awaiter(void 0, void 0, void 0, function* () {
|
|
412
|
+
yield api.deviceApi.createDevice(new Device_1.Device({ id: (0, uuid_1.v4)(), brand: 'Apple', model: 'iPod Shuffle' }));
|
|
413
|
+
}), (status) => {
|
|
414
|
+
statuses.push(status);
|
|
415
|
+
}, eventReceivedPromiseReject, eventReceivedPromise);
|
|
416
|
+
events === null || events === void 0 ? void 0 : events.forEach((event) => console.log(`Event : ${event}`));
|
|
417
|
+
statuses === null || statuses === void 0 ? void 0 : statuses.forEach((status) => console.log(`Status : ${status}`));
|
|
418
|
+
(0, chai_1.assert)(events.length === 1, 'The events have not been recorded');
|
|
419
|
+
(0, chai_1.assert)(statuses.length === 2, 'The statuses have not been recorded');
|
|
420
|
+
(0, chai_1.assert)(events.every((event) => event instanceof Device_1.Device), 'The events are not of type Device');
|
|
421
|
+
});
|
|
422
|
+
it('CREATE Device without option', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
423
|
+
yield subscribeAndCreateDevice({}, ['CREATE']);
|
|
424
|
+
})).timeout(60000);
|
|
425
|
+
it('CREATE Device with options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
426
|
+
yield subscribeAndCreateDevice({
|
|
427
|
+
connectionRetryIntervalMs: 10000,
|
|
428
|
+
connectionMaxRetry: 5,
|
|
429
|
+
}, ['CREATE']);
|
|
430
|
+
})).timeout(60000);
|
|
431
|
+
}));
|
|
432
|
+
describe('Can subscribe to User', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
433
|
+
const subscribeAndCreateUser = (options, eventTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
434
|
+
const connectionPromise = (options, dataOwnerId, eventListener) => __awaiter(void 0, void 0, void 0, function* () {
|
|
435
|
+
yield (0, api_1.sleep)(2000);
|
|
436
|
+
return api.userApi.subscribeToUserEvents(eventTypes, new AllUsersFilter_1.AllUsersFilter({}), eventListener, options);
|
|
437
|
+
});
|
|
438
|
+
const loggedUser = yield api.userApi.getCurrentUser();
|
|
439
|
+
yield (0, api_1.sleep)(2000);
|
|
440
|
+
yield (0, api_1.sleep)(2000);
|
|
441
|
+
const events = [];
|
|
442
|
+
const statuses = [];
|
|
443
|
+
let eventReceivedPromiseResolve;
|
|
444
|
+
let eventReceivedPromiseReject;
|
|
445
|
+
const eventReceivedPromise = new Promise((res, rej) => {
|
|
446
|
+
eventReceivedPromiseResolve = res;
|
|
447
|
+
eventReceivedPromiseReject = rej;
|
|
448
|
+
});
|
|
449
|
+
yield doXOnYAndSubscribe(api, options, connectionPromise(options, loggedUser.healthcarePartyId, (user) => __awaiter(void 0, void 0, void 0, function* () {
|
|
450
|
+
events.push(user);
|
|
451
|
+
eventReceivedPromiseResolve();
|
|
452
|
+
})), () => __awaiter(void 0, void 0, void 0, function* () {
|
|
453
|
+
const user = yield api.userApi.createUser(new User_1.User({
|
|
454
|
+
id: (0, uuid_1.v4)(),
|
|
455
|
+
login: `${(0, uuid_1.v4)()}`,
|
|
456
|
+
status: 'ACTIVE',
|
|
457
|
+
patientId: (0, uuid_1.v4)(),
|
|
458
|
+
}));
|
|
459
|
+
}), (status) => {
|
|
460
|
+
statuses.push(status);
|
|
461
|
+
}, eventReceivedPromiseReject, eventReceivedPromise);
|
|
462
|
+
events === null || events === void 0 ? void 0 : events.forEach((event) => console.log(`Event : ${event}`));
|
|
463
|
+
statuses === null || statuses === void 0 ? void 0 : statuses.forEach((status) => console.log(`Status : ${status}`));
|
|
464
|
+
(0, chai_1.assert)(events.length === 1, 'The events have not been recorded');
|
|
465
|
+
(0, chai_1.assert)(statuses.length === 2, 'The statuses have not been recorded');
|
|
466
|
+
(0, chai_1.assert)(events.every((event) => event instanceof User_1.User), 'The events are not of type User');
|
|
467
|
+
});
|
|
468
|
+
it('CREATE User without options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
469
|
+
yield subscribeAndCreateUser({}, ['CREATE']);
|
|
470
|
+
})).timeout(60000);
|
|
471
|
+
it('CREATE User with options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
472
|
+
yield subscribeAndCreateUser({
|
|
473
|
+
connectionRetryIntervalMs: 10000,
|
|
474
|
+
connectionMaxRetry: 5,
|
|
475
|
+
}, ['CREATE']);
|
|
476
|
+
})).timeout(60000);
|
|
477
|
+
}));
|
|
478
|
+
describe('Retry mechanism', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
479
|
+
it('Should fails 10 times and then cut', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
480
|
+
const statuses = [];
|
|
481
|
+
const ws = yield websocket_1.WebSocketWrapper.create(env.iCureUrl.replace('http', 'ws').replace('rest', 'ws') + '/notification/subscribe', {
|
|
482
|
+
getBearerToken: () => Promise.resolve(undefined),
|
|
483
|
+
getIcureOtt: () => Promise.resolve('fake-token'),
|
|
484
|
+
}, 10, 500, {
|
|
485
|
+
CONNECTED: [() => statuses.push('CONNECTED')],
|
|
486
|
+
CLOSED: [() => statuses.push('CLOSED')],
|
|
487
|
+
ERROR: [(ws, error) => statuses.push('ERROR')],
|
|
488
|
+
}, (data) => {
|
|
489
|
+
throw new Error('Test');
|
|
490
|
+
});
|
|
491
|
+
yield (0, api_1.sleep)(20000);
|
|
492
|
+
(0, chai_1.assert)(statuses.length === 20, 'The statuses have not been recorded');
|
|
493
|
+
(0, chai_1.assert)(statuses.filter((status) => status === 'ERROR').length === 10, 'There should be 10 errors status');
|
|
494
|
+
(0, chai_1.assert)(statuses.filter((status) => status === 'CLOSED').length === 10, 'There should be 10 closed status');
|
|
495
|
+
})).timeout(60000);
|
|
496
|
+
}));
|
|
497
|
+
});
|
|
498
|
+
//# sourceMappingURL=subscription-apis.js.map
|