@icure/api 4.2.34 → 4.2.37
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 +6 -0
- package/icc-api/api/IccAuthApi.js +15 -0
- package/icc-api/api/IccAuthApi.js.map +1 -1
- package/icc-x-api/crypto/utils.js +2 -1
- package/icc-x-api/crypto/utils.js.map +1 -1
- 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 +4 -2
- package/icc-x-api/icc-crypto-x-api.js +4 -2
- 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 +3 -1
- package/icc-x-api/index.js +28 -20
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/utils/uuid-encoder.js +2 -0
- package/icc-x-api/utils/uuid-encoder.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":";;;AAAA,wCAA0C;AAG1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AC,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
|
initDelegations(patient: models.Patient, user: models.User, secretForeignKey?: string | undefined, delegates?: string[]): Promise<models.Patient>;
|
|
@@ -21,7 +21,7 @@ const person_util_1 = require("./utils/person-util");
|
|
|
21
21
|
const net_utils_1 = require("./utils/net-utils");
|
|
22
22
|
// noinspection JSUnusedGlobalSymbols
|
|
23
23
|
class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
24
|
-
constructor(host, headers, crypto, contactApi, formApi, helementApi, invoiceApi, documentApi, hcpartyApi, classificationApi,
|
|
24
|
+
constructor(host, headers, crypto, contactApi, formApi, helementApi, invoiceApi, documentApi, hcpartyApi, classificationApi, dataOwnerApi, calendarItemaApi, encryptedKeys = ['note'], fetchImpl = typeof window !== 'undefined'
|
|
25
25
|
? window.fetch
|
|
26
26
|
: typeof self !== 'undefined'
|
|
27
27
|
? self.fetch
|
|
@@ -36,7 +36,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
36
36
|
this.documentApi = documentApi;
|
|
37
37
|
this.classificationApi = classificationApi;
|
|
38
38
|
this.calendarItemApi = calendarItemaApi;
|
|
39
|
-
this.
|
|
39
|
+
this.dataOwnerApi = dataOwnerApi;
|
|
40
40
|
this.encryptedKeys = encryptedKeys;
|
|
41
41
|
}
|
|
42
42
|
// noinspection JSUnusedGlobalSymbols
|
|
@@ -46,7 +46,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
46
46
|
_type: 'org.taktik.icure.entities.Patient',
|
|
47
47
|
created: new Date().getTime(),
|
|
48
48
|
modified: new Date().getTime(),
|
|
49
|
-
responsible: this.
|
|
49
|
+
responsible: this.dataOwnerApi.getDataOwnerOf(user),
|
|
50
50
|
author: user.id,
|
|
51
51
|
codes: [],
|
|
52
52
|
tags: [],
|
|
@@ -66,7 +66,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
66
66
|
finalPatient = person_util_1.garnishPersonWithName(finalPatient, models.PersonName.UseEnum.Nickname, finalPatient.alias, finalPatient.firstName);
|
|
67
67
|
}
|
|
68
68
|
if (!finalPatient.lastName && !!person_util_1.hasName(finalPatient, models.PersonName.UseEnum.Official)) {
|
|
69
|
-
|
|
69
|
+
const officialName = person_util_1.findName(finalPatient, models.PersonName.UseEnum.Official);
|
|
70
70
|
finalPatient = Object.assign(Object.assign({}, finalPatient), { lastName: officialName.lastName, firstName: (_a = officialName.firstNames) === null || _a === void 0 ? void 0 : _a[0] });
|
|
71
71
|
}
|
|
72
72
|
if (!finalPatient.maidenName && !!person_util_1.hasName(finalPatient, models.PersonName.UseEnum.Maiden)) {
|
|
@@ -78,7 +78,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
78
78
|
return finalPatient;
|
|
79
79
|
}
|
|
80
80
|
initDelegations(patient, user, secretForeignKey = undefined, delegates = []) {
|
|
81
|
-
const dataOwnerId = this.
|
|
81
|
+
const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user);
|
|
82
82
|
return this.crypto.initObjectDelegations(patient, null, dataOwnerId, secretForeignKey || null).then((initData) => {
|
|
83
83
|
_.extend(patient, { delegations: initData.delegations });
|
|
84
84
|
let promise = Promise.resolve(patient);
|
|
@@ -93,7 +93,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
initConfidentialDelegation(patient, user) {
|
|
96
|
-
const dataOwnerId = this.
|
|
96
|
+
const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user);
|
|
97
97
|
return this.crypto.extractPreferredSfk(patient, dataOwnerId, true).then((k) => {
|
|
98
98
|
if (!k) {
|
|
99
99
|
const secretId = this.crypto.randomUuid();
|
|
@@ -271,7 +271,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
271
271
|
.then((pats) => pats[0]);
|
|
272
272
|
}
|
|
273
273
|
encrypt(user, pats) {
|
|
274
|
-
const dataOwnerId = this.
|
|
274
|
+
const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user);
|
|
275
275
|
const fixEncryptionKeys = (p) => {
|
|
276
276
|
if (p.delegations && p.delegations[dataOwnerId])
|
|
277
277
|
return this.initEncryptionKeys(user, p, Object.keys(p.delegations));
|
|
@@ -291,7 +291,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
291
291
|
}));
|
|
292
292
|
}
|
|
293
293
|
decrypt(user, pats, fillDelegations = true) {
|
|
294
|
-
const dataOwnerId = this.
|
|
294
|
+
const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user);
|
|
295
295
|
return (user.healthcarePartyId ? this.hcpartyApi.getHealthcarePartyHierarchyIds(user.healthcarePartyId) : Promise.resolve([dataOwnerId])).then((ids) => {
|
|
296
296
|
const hcpId = ids[0];
|
|
297
297
|
//First check that we have no dangling delegation
|
|
@@ -352,7 +352,7 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
352
352
|
/** By default, an encryptionKey will be added for every hcp in the autoDelegations of the provided user.
|
|
353
353
|
* In optional field additionalDelegateIds, you can ask the method to create encryptionKeys for additional hcps */
|
|
354
354
|
initEncryptionKeys(user, pat, additionalDelegateIds) {
|
|
355
|
-
const dataOwnerId = this.
|
|
355
|
+
const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user);
|
|
356
356
|
const userAutoDelegations = user.autoDelegations ? (user.autoDelegations.all || []).concat(user.autoDelegations.medicalInformation || []) : [];
|
|
357
357
|
return this.crypto.initEncryptionKeys(pat, dataOwnerId).then((eks) => {
|
|
358
358
|
let promise = Promise.resolve(_.extend(pat, {
|