@icure/api 4.2.11 → 4.2.15
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/IccBesamv2Api.js +1 -1
- package/icc-api/api/IccBesamv2Api.js.map +1 -1
- package/icc-api/api/IccUserApi.d.ts +2 -1
- package/icc-api/api/IccUserApi.js +5 -3
- package/icc-api/api/IccUserApi.js.map +1 -1
- package/icc-api/api/XHR.js +6 -9
- package/icc-api/api/XHR.js.map +1 -1
- package/icc-api/model/Contact.d.ts +5 -0
- package/icc-api/model/Contact.js.map +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +3 -1
- package/icc-x-api/icc-crypto-x-api.js +16 -2
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { CodeStub } from './CodeStub';
|
|
13
13
|
import { Delegation } from './Delegation';
|
|
14
|
+
import { Identifier } from './Identifier';
|
|
14
15
|
import { Service } from './Service';
|
|
15
16
|
import { SubContact } from './SubContact';
|
|
16
17
|
/**
|
|
@@ -54,6 +55,10 @@ export declare class Contact {
|
|
|
54
55
|
* A code is an item from a codification system that qualifies the content of this entity. SNOMED-CT, ICPC-2 or ICD-10 codifications systems can be used for codes
|
|
55
56
|
*/
|
|
56
57
|
codes?: Array<CodeStub>;
|
|
58
|
+
/**
|
|
59
|
+
* The identifiers of the Contact
|
|
60
|
+
*/
|
|
61
|
+
identifier?: Array<Identifier>;
|
|
57
62
|
/**
|
|
58
63
|
* Soft delete (unix epoch in ms) timestamp of the object.
|
|
59
64
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contact.js","sourceRoot":"","sources":["../../../icc-api/model/Contact.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Contact.js","sourceRoot":"","sources":["../../../icc-api/model/Contact.ts"],"names":[],"mappings":";;;AAiBA;;GAEG;AACH,MAAa,OAAO;IAClB,YAAY,IAAgB;QAC1B,MAAM,CAAC,MAAM,CAAC,IAAe,EAAE,IAAI,CAAC,CAAA;IACtC,CAAC;CAyGF;AA5GD,0BA4GC","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\nimport { CodeStub } from './CodeStub'\nimport { Delegation } from './Delegation'\nimport { Identifier } from './Identifier'\nimport { Service } from './Service'\nimport { SubContact } from './SubContact'\n\n/**\n * This entity is a root-level object. It represents a contact. It is serialized in JSON and saved in the underlying icure-contact CouchDB database. The contact is the entity that records the medical information about the patient chronologically. A visit to the patient's house, a consultation at the practice, a phone call between the patient and the healthcare party or integrating lab reports into the medical file are examples of when a contact can be recorded. A contact can occur with or without direct interaction between the patient and the healthcare party. For example, when a healthcare party encodes data received from laboratory's test result, this is done in the absence of a patient. A contact groups together pieces of information collected during one single event, for one single patient and for one or more healthcare parties. Patient's complaints, the diagnosis of a new problem, a surgical procedure, etc. are collected inside a contact. The main sub-element of the contact is the service. Each atomic piece of information collected during a contact is a service and is stored inside the services list of a contact.\n */\nexport class Contact {\n constructor(json: JSON | any) {\n Object.assign(this as Contact, json)\n }\n\n /**\n * the Id of the contact. We encourage using either a v4 UUID or a HL7 Id.\n */\n id?: string\n /**\n * the revision of the contact in the database, used for conflict management / optimistic locking.\n */\n rev?: string\n /**\n * The timestamp (unix epoch in ms) of creation of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n created?: number\n /**\n * The date (unix epoch in ms) of the latest modification of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n modified?: number\n /**\n * The id of the User that has created this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n author?: string\n /**\n * The id of the HealthcareParty that is responsible for this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n responsible?: string\n /**\n * The id of the medical location where this entity was created.\n */\n medicalLocationId?: string\n /**\n * A tag is an item from a codification system that qualifies an entity as being member of a certain class, whatever the value it might have taken. If the tag qualifies the content of a field, it means that whatever the content of the field, the tag will always apply. For example, the label of a field is qualified using a tag. LOINC is a codification system typically used for tags.\n */\n tags?: Array<CodeStub>\n /**\n * A code is an item from a codification system that qualifies the content of this entity. SNOMED-CT, ICPC-2 or ICD-10 codifications systems can be used for codes\n */\n codes?: Array<CodeStub>\n /**\n * The identifiers of the Contact\n */\n identifier?: Array<Identifier>\n /**\n * Soft delete (unix epoch in ms) timestamp of the object.\n */\n endOfLife?: number\n /**\n * hard delete (unix epoch in ms) timestamp of the object. Filled automatically when deletePatient is called.\n */\n deletionDate?: number\n /**\n * Separate contacts can merged in one logical contact if they share the same groupId. When a contact must be split to selectively assign rights to healthcare parties, the split contacts all share the same groupId\n */\n groupId?: string\n /**\n * The date (YYYYMMDDhhmmss) of the start of the contact.\n */\n openingDate?: number\n /**\n * The date (YYYYMMDDhhmmss) marking the end of the contact.\n */\n closingDate?: number\n /**\n * Description of the contact\n */\n descr?: string\n /**\n * Location where the contact was recorded.\n */\n location?: string\n /**\n * An external (from another source) id with no guarantee or requirement for unicity.\n */\n externalId?: string\n encounterType?: CodeStub\n /**\n * Set of all sub-contacts recorded during the given contact. Sub-contacts are used to link services embedded inside this contact to healthcare elements, healthcare approaches and/or forms.\n */\n subContacts?: Array<SubContact>\n /**\n * Set of all services provided to the patient during the contact.\n */\n services?: Array<Service>\n healthcarePartyId?: string\n modifiedContactId?: string\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find all contacts for a specific patient. These keys are in clear. You can have several to partition the medical document space.\n */\n secretForeignKeys?: Array<string>\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find the patient for a specific contact. These keys are the encrypted id (using the hcParty key for the delegate) that can be found in clear inside the patient. ids encrypted using the hcParty keys.\n */\n cryptedForeignKeys?: { [key: string]: Array<Delegation> }\n /**\n * When a document is created, the responsible generates a cryptographically random master key (never to be used for something else than referencing from other entities). He/she encrypts it using his own AES exchange key and stores it as a delegation. The responsible is thus always in the delegations as well\n */\n delegations?: { [key: string]: Array<Delegation> }\n /**\n * When a document needs to be encrypted, the responsible generates a cryptographically random master key (different from the delegation key, never to appear in clear anywhere in the db. He/she encrypts it using his own AES exchange key and stores it as a delegation\n */\n encryptionKeys?: { [key: string]: Array<Delegation> }\n /**\n * The base64 encoded data of this object, formatted as JSON and encrypted in AES using the random master key from encryptionKeys.\n */\n encryptedSelf?: string\n}\n"]}
|
|
@@ -35,6 +35,7 @@ export declare class IccCryptoXApi {
|
|
|
35
35
|
[delegatorId: string]: string;
|
|
36
36
|
}>;
|
|
37
37
|
};
|
|
38
|
+
cacheLastDeletionTimestamp: number | undefined;
|
|
38
39
|
dataOwnerCache: {
|
|
39
40
|
[key: string]: Promise<CachedDataOwner>;
|
|
40
41
|
};
|
|
@@ -110,10 +111,11 @@ export declare class IccCryptoXApi {
|
|
|
110
111
|
*
|
|
111
112
|
* @param delegatorsHcPartyIdsSet array of delegator HcP IDs that could have delegated something to the HcP with ID `delegateHcPartyId`
|
|
112
113
|
* @param delegateHcPartyId the HcP for which the HcPs with IDs in `delegatorsHcPartyIdsSet` could have delegated something
|
|
114
|
+
* @param minCacheDurationInSeconds The minimum cache duration
|
|
113
115
|
* @returns - **delegatorId** : the id of the delegator HcP that shares the **key** with the `delegateHcPartyId`
|
|
114
116
|
* - **key** the decrypted HcPartyKey, shared between **delegatorId** and `delegateHcPartyId`
|
|
115
117
|
*/
|
|
116
|
-
decryptAndImportAesHcPartyKeysForDelegators(delegatorsHcPartyIdsSet: Array<string>, delegateHcPartyId: string): Promise<Array<DelegatorAndKeys>>;
|
|
118
|
+
decryptAndImportAesHcPartyKeysForDelegators(delegatorsHcPartyIdsSet: Array<string>, delegateHcPartyId: string, minCacheDurationInSeconds?: number): Promise<Array<DelegatorAndKeys>>;
|
|
117
119
|
/**
|
|
118
120
|
* Gets an array of decrypted HcPartyKeys from the given `delegations`, that are shared with / can be decrypted by the HcP with the given `healthcarePartyId` (or by its parents when `fallbackOnParent` is true)
|
|
119
121
|
*
|
|
@@ -23,6 +23,7 @@ class IccCryptoXApi {
|
|
|
23
23
|
//[delegateId][delegatorId] = delegateEncryptedHcPartyKey
|
|
24
24
|
//for each delegate, it stores the list of delegators and the corresponding delegateEncryptedHcPartyKey (shared HcPartyKey, from delegator to delegate, encrypted with the RSA key of the delegate)
|
|
25
25
|
this.hcPartyKeysRequestsCache = {};
|
|
26
|
+
this.cacheLastDeletionTimestamp = undefined;
|
|
26
27
|
this.dataOwnerCache = {};
|
|
27
28
|
this.keychainLocalStoreIdPrefix = 'org.taktik.icure.ehealth.keychain.';
|
|
28
29
|
this.keychainValidityDateLocalStoreIdPrefix = 'org.taktik.icure.ehealth.keychain-date.';
|
|
@@ -233,12 +234,13 @@ class IccCryptoXApi {
|
|
|
233
234
|
*
|
|
234
235
|
* @param delegatorsHcPartyIdsSet array of delegator HcP IDs that could have delegated something to the HcP with ID `delegateHcPartyId`
|
|
235
236
|
* @param delegateHcPartyId the HcP for which the HcPs with IDs in `delegatorsHcPartyIdsSet` could have delegated something
|
|
237
|
+
* @param minCacheDurationInSeconds The minimum cache duration
|
|
236
238
|
* @returns - **delegatorId** : the id of the delegator HcP that shares the **key** with the `delegateHcPartyId`
|
|
237
239
|
* - **key** the decrypted HcPartyKey, shared between **delegatorId** and `delegateHcPartyId`
|
|
238
240
|
*/
|
|
239
241
|
decryptAndImportAesHcPartyKeysForDelegators(
|
|
240
242
|
//TODO: suggested name: getDecryptedHcPKeysSharedBetweenDelegateAndDelegators
|
|
241
|
-
delegatorsHcPartyIdsSet, delegateHcPartyId) {
|
|
243
|
+
delegatorsHcPartyIdsSet, delegateHcPartyId, minCacheDurationInSeconds = 60) {
|
|
242
244
|
return (this.hcPartyKeysRequestsCache[delegateHcPartyId] ||
|
|
243
245
|
(this.hcPartyKeysRequestsCache[delegateHcPartyId] = this.getHcPartyKeysForDelegate(delegateHcPartyId))).then((delegatorIDsWithDelegateEncryptedHcPartyKey) => {
|
|
244
246
|
// [key: delegatorId] = delegateEncryptedHcPartyKey
|
|
@@ -251,7 +253,19 @@ class IccCryptoXApi {
|
|
|
251
253
|
console.log(`failed to decrypt hcPartyKey from ${delegatorId} to ${delegateHcPartyId}`);
|
|
252
254
|
return undefined;
|
|
253
255
|
});
|
|
254
|
-
})).then((hcPartyKeys) =>
|
|
256
|
+
})).then((hcPartyKeys) => {
|
|
257
|
+
const filteredHcPartyKeys = hcPartyKeys.filter((hcPartyKey) => !!hcPartyKey);
|
|
258
|
+
if (filteredHcPartyKeys.length > 0) {
|
|
259
|
+
return filteredHcPartyKeys;
|
|
260
|
+
}
|
|
261
|
+
const nowTimestamp = +new Date();
|
|
262
|
+
if (!this.cacheLastDeletionTimestamp || ((nowTimestamp - this.cacheLastDeletionTimestamp) / 1000) >= minCacheDurationInSeconds) {
|
|
263
|
+
delete this.hcPartyKeysRequestsCache[delegateHcPartyId];
|
|
264
|
+
this.cacheLastDeletionTimestamp = nowTimestamp;
|
|
265
|
+
return this.decryptAndImportAesHcPartyKeysForDelegators(delegatorsHcPartyIdsSet, delegateHcPartyId);
|
|
266
|
+
}
|
|
267
|
+
return filteredHcPartyKeys;
|
|
268
|
+
});
|
|
255
269
|
});
|
|
256
270
|
}
|
|
257
271
|
/**
|