@icure/api 5.0.14 → 5.0.17
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/IccCodeApi.d.ts +14 -1
- package/icc-api/api/IccCodeApi.js +33 -1
- package/icc-api/api/IccCodeApi.js.map +1 -1
- package/icc-api/model/UserGroup.d.ts +3 -0
- package/icc-api/model/UserGroup.js.map +1 -1
- package/icc-x-api/crypto/utils.d.ts +0 -0
- package/icc-x-api/crypto/utils.js +2 -0
- package/icc-x-api/crypto/utils.js.map +1 -0
- package/icc-x-api/icc-accesslog-x-api.d.ts +3 -3
- package/icc-x-api/icc-accesslog-x-api.js +11 -11
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +3 -3
- package/icc-x-api/icc-calendar-item-x-api.js +13 -13
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.d.ts +3 -3
- package/icc-x-api/icc-classification-x-api.js +4 -4
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +3 -3
- package/icc-x-api/icc-contact-x-api.js +16 -16
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +10 -3
- package/icc-x-api/icc-crypto-x-api.js +29 -17
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-data-owner-x-api.d.ts +14 -0
- package/icc-x-api/icc-data-owner-x-api.js +44 -0
- package/icc-x-api/icc-data-owner-x-api.js.map +1 -0
- package/icc-x-api/icc-document-x-api.d.ts +3 -3
- package/icc-x-api/icc-document-x-api.js +5 -5
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +3 -3
- package/icc-x-api/icc-form-x-api.js +5 -5
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +3 -3
- package/icc-x-api/icc-helement-x-api.js +10 -10
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.d.ts +3 -3
- package/icc-x-api/icc-invoice-x-api.js +5 -5
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.d.ts +6 -3
- package/icc-x-api/icc-maintenance-task-x-api.js +21 -7
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.d.ts +3 -3
- package/icc-x-api/icc-message-x-api.js +4 -4
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +3 -3
- package/icc-x-api/icc-patient-x-api.js +9 -9
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +3 -3
- package/icc-x-api/icc-receipt-x-api.js +5 -5
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.d.ts +3 -3
- package/icc-x-api/icc-time-table-x-api.js +5 -5
- package/icc-x-api/icc-time-table-x-api.js.map +1 -1
- package/icc-x-api/icc-user-x-api.d.ts +0 -2
- package/icc-x-api/icc-user-x-api.js +0 -8
- package/icc-x-api/icc-user-x-api.js.map +1 -1
- package/icc-x-api/index.d.ts +2 -0
- package/icc-x-api/index.js +24 -19
- package/icc-x-api/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-message-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-message-x-api.ts"],"names":[],"mappings":";;;AAAA,wCAA0C;AAG1C,4BAA2B;AAK3B,MAAa,cAAe,SAAQ,uBAAa;IAG/C,YACE,IAAY,EACZ,OAAkC,EAC1B,MAAqB,EAC7B,
|
|
1
|
+
{"version":3,"file":"icc-message-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-message-x-api.ts"],"names":[],"mappings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AE,EAAE;gBACX,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;gBACd,OAAO,QAAQ,CAAA;YACjB,CAAC,CAAC,CACL,CAAC,CACL,CAAA;YACD,OAAO,OAAO,CAAA;QAChB,CAAC,CAAC,CAAA;IACN,CAAC;CACF;AA1ED,wCA0EC","sourcesContent":["import { IccMessageApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport * as _ from 'lodash'\n\nimport { Patient, User } from '../icc-api/model/models'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\n\nexport class IccMessageXApi extends IccMessageApi {\n dataOwnerApi: IccDataOwnerXApi\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, fetchImpl)\n this.crypto = crypto\n this.dataOwnerApi = dataOwnerApi\n }\n\n // noinspection JSUnusedGlobalSymbols\n newInstance(user: User, m: any) {\n return this.newInstanceWithPatient(user, null, m)\n }\n\n newInstanceWithPatient(user: User, patient: Patient | null, m: any = {}, delegates: string[] = []) {\n const message = _.extend(\n {\n id: this.crypto.randomUuid(),\n _type: 'org.taktik.icure.entities.Message',\n created: new Date().getTime(),\n modified: new Date().getTime(),\n responsible: this.dataOwnerApi.getDataOwnerOf(user),\n author: user.id,\n codes: [],\n tags: [],\n },\n m || {}\n )\n\n const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user)\n\n return this.crypto\n .extractDelegationsSFKs(patient, dataOwnerId)\n .then((secretForeignKeys) => this.crypto.initObjectDelegations(message, patient, dataOwnerId!, secretForeignKeys.extractedKeys[0]))\n .then((initData) => {\n _.extend(message, {\n delegations: initData.delegations,\n cryptedForeignKeys: initData.cryptedForeignKeys,\n secretForeignKeys: initData.secretForeignKeys,\n })\n\n let promise = Promise.resolve(message)\n _.uniq(\n delegates.concat(user.autoDelegations ? (user.autoDelegations.all || []).concat(user.autoDelegations.medicalInformation || []) : [])\n ).forEach(\n (delegateId) =>\n (promise = promise.then((helement) =>\n this.crypto\n .extendedDelegationsAndCryptedForeignKeys(helement, patient, dataOwnerId!, delegateId, initData.secretId)\n .then((extraData) =>\n _.extend(helement, {\n delegations: extraData.delegations,\n cryptedForeignKeys: extraData.cryptedForeignKeys,\n })\n )\n .catch((e) => {\n console.log(e)\n return helement\n })\n ))\n )\n return promise\n })\n }\n}\n"]}
|
|
@@ -9,7 +9,7 @@ import { IccHelementXApi } from './icc-helement-x-api';
|
|
|
9
9
|
import { IccClassificationXApi } from './icc-classification-x-api';
|
|
10
10
|
import * as models from '../icc-api/model/models';
|
|
11
11
|
import { IccCalendarItemXApi } from './icc-calendar-item-x-api';
|
|
12
|
-
import {
|
|
12
|
+
import { IccDataOwnerXApi } from './icc-data-owner-x-api';
|
|
13
13
|
export declare class IccPatientXApi extends IccPatientApi {
|
|
14
14
|
crypto: IccCryptoXApi;
|
|
15
15
|
contactApi: IccContactXApi;
|
|
@@ -20,11 +20,11 @@ export declare class IccPatientXApi extends IccPatientApi {
|
|
|
20
20
|
documentApi: IccDocumentXApi;
|
|
21
21
|
classificationApi: IccClassificationXApi;
|
|
22
22
|
calendarItemApi: IccCalendarItemXApi;
|
|
23
|
-
|
|
23
|
+
dataOwnerApi: IccDataOwnerXApi;
|
|
24
24
|
private readonly encryptedKeys;
|
|
25
25
|
constructor(host: string, headers: {
|
|
26
26
|
[key: string]: string;
|
|
27
|
-
}, crypto: IccCryptoXApi, contactApi: IccContactXApi, formApi: IccFormXApi, helementApi: IccHelementXApi, invoiceApi: IccInvoiceXApi, documentApi: IccDocumentXApi, hcpartyApi: IccHcpartyXApi, classificationApi: IccClassificationXApi,
|
|
27
|
+
}, crypto: IccCryptoXApi, contactApi: IccContactXApi, formApi: IccFormXApi, helementApi: IccHelementXApi, invoiceApi: IccInvoiceXApi, documentApi: IccDocumentXApi, hcpartyApi: IccHcpartyXApi, classificationApi: IccClassificationXApi, dataOwnerApi: IccDataOwnerXApi, calendarItemaApi: IccCalendarItemXApi, encryptedKeys?: Array<string>, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
|
|
28
28
|
newInstance(user: models.User, p?: any, delegates?: string[]): Promise<models.Patient>;
|
|
29
29
|
completeNames(patient: models.Patient): models.Patient;
|
|
30
30
|
initDelegationsAndEncryptionKeys(patient: models.Patient, user: models.User, secretForeignKey?: string | undefined, delegates?: string[]): Promise<models.Patient>;
|
|
@@ -20,7 +20,7 @@ const person_util_1 = require("./utils/person-util");
|
|
|
20
20
|
const utils_1 = require("./utils");
|
|
21
21
|
// noinspection JSUnusedGlobalSymbols
|
|
22
22
|
class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
23
|
-
constructor(host, headers, crypto, contactApi, formApi, helementApi, invoiceApi, documentApi, hcpartyApi, classificationApi,
|
|
23
|
+
constructor(host, headers, crypto, contactApi, formApi, helementApi, invoiceApi, documentApi, hcpartyApi, classificationApi, dataOwnerApi, calendarItemaApi, encryptedKeys = ['note'], fetchImpl = typeof window !== 'undefined'
|
|
24
24
|
? window.fetch
|
|
25
25
|
: typeof self !== 'undefined'
|
|
26
26
|
? self.fetch
|
|
@@ -35,7 +35,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
35
35
|
this.documentApi = documentApi;
|
|
36
36
|
this.classificationApi = classificationApi;
|
|
37
37
|
this.calendarItemApi = calendarItemaApi;
|
|
38
|
-
this.
|
|
38
|
+
this.dataOwnerApi = dataOwnerApi;
|
|
39
39
|
this.encryptedKeys = encryptedKeys;
|
|
40
40
|
}
|
|
41
41
|
// noinspection JSUnusedGlobalSymbols
|
|
@@ -45,7 +45,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
45
45
|
_type: 'org.taktik.icure.entities.Patient',
|
|
46
46
|
created: new Date().getTime(),
|
|
47
47
|
modified: new Date().getTime(),
|
|
48
|
-
responsible: this.
|
|
48
|
+
responsible: this.dataOwnerApi.getDataOwnerOf(user),
|
|
49
49
|
author: user.id,
|
|
50
50
|
codes: [],
|
|
51
51
|
tags: [],
|
|
@@ -65,7 +65,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
65
65
|
finalPatient = (0, person_util_1.garnishPersonWithName)(finalPatient, models.PersonName.UseEnum.Nickname, finalPatient.alias, finalPatient.firstName);
|
|
66
66
|
}
|
|
67
67
|
if (!finalPatient.lastName && !!(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Official)) {
|
|
68
|
-
|
|
68
|
+
const officialName = (0, person_util_1.findName)(finalPatient, models.PersonName.UseEnum.Official);
|
|
69
69
|
finalPatient = Object.assign(Object.assign({}, finalPatient), { lastName: officialName.lastName, firstName: (_a = officialName.firstNames) === null || _a === void 0 ? void 0 : _a[0] });
|
|
70
70
|
}
|
|
71
71
|
if (!finalPatient.maidenName && !!(0, person_util_1.hasName)(finalPatient, models.PersonName.UseEnum.Maiden)) {
|
|
@@ -78,7 +78,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
78
78
|
}
|
|
79
79
|
initDelegationsAndEncryptionKeys(patient, user, secretForeignKey = undefined, delegates = []) {
|
|
80
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
const dataOwnerId = this.
|
|
81
|
+
const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user);
|
|
82
82
|
const dels = yield this.crypto.initObjectDelegations(patient, null, dataOwnerId, null);
|
|
83
83
|
const eks = yield this.crypto.initEncryptionKeys(patient, dataOwnerId);
|
|
84
84
|
_.extend(patient, {
|
|
@@ -98,7 +98,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
initConfidentialDelegation(patient, user) {
|
|
101
|
-
const dataOwnerId = this.
|
|
101
|
+
const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user);
|
|
102
102
|
return this.crypto.extractPreferredSfk(patient, dataOwnerId, true).then((k) => {
|
|
103
103
|
if (!k) {
|
|
104
104
|
const secretId = this.crypto.randomUuid();
|
|
@@ -284,7 +284,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
encrypt(user, pats) {
|
|
287
|
-
const dataOwnerId = this.
|
|
287
|
+
const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user);
|
|
288
288
|
const fixEncryptionKeys = (p) => {
|
|
289
289
|
if (p.delegations && p.delegations[dataOwnerId])
|
|
290
290
|
return this.initEncryptionKeys(user, p, Object.keys(p.delegations));
|
|
@@ -312,7 +312,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
312
312
|
}))), this.encryptedKeys))));
|
|
313
313
|
}
|
|
314
314
|
decrypt(user, pats, fillDelegations = true) {
|
|
315
|
-
const dataOwnerId = this.
|
|
315
|
+
const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user);
|
|
316
316
|
return (user.healthcarePartyId ? this.hcpartyApi.getHealthcarePartyHierarchyIds(user.healthcarePartyId) : Promise.resolve([dataOwnerId])).then((ids) => {
|
|
317
317
|
const hcpId = ids[0];
|
|
318
318
|
//First check that we have no dangling delegation
|
|
@@ -371,7 +371,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
371
371
|
/** By default, an encryptionKey will be added for every hcp in the autoDelegations of the provided user.
|
|
372
372
|
* In optional field additionalDelegateIds, you can ask the method to create encryptionKeys for additional hcps */
|
|
373
373
|
initEncryptionKeys(user, pat, additionalDelegateIds) {
|
|
374
|
-
const dataOwnerId = this.
|
|
374
|
+
const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user);
|
|
375
375
|
const userAutoDelegations = user.autoDelegations ? (user.autoDelegations.all || []).concat(user.autoDelegations.medicalInformation || []) : [];
|
|
376
376
|
return this.crypto.initEncryptionKeys(pat, dataOwnerId).then((eks) => {
|
|
377
377
|
let promise = Promise.resolve(_.extend(pat, {
|