@icure/api 8.2.7 → 8.2.8
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-x-api/icc-accesslog-x-api.d.ts +5 -2
- package/icc-x-api/icc-accesslog-x-api.js +9 -4
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.d.ts +3 -2
- package/icc-x-api/icc-classification-x-api.js +5 -3
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +2 -5
- package/icc-x-api/icc-contact-x-api.js +3 -6
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +3 -2
- package/icc-x-api/icc-document-x-api.js +5 -3
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +3 -2
- package/icc-x-api/icc-form-x-api.js +5 -3
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +2 -5
- package/icc-x-api/icc-helement-x-api.js +3 -6
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.d.ts +3 -2
- package/icc-x-api/icc-invoice-x-api.js +5 -3
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.d.ts +2 -0
- package/icc-x-api/icc-maintenance-task-x-api.js +2 -1
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +2 -0
- package/icc-x-api/icc-patient-x-api.js +4 -1
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +2 -0
- package/icc-x-api/icc-receipt-x-api.js +4 -1
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.d.ts +2 -1
- package/icc-x-api/icc-time-table-x-api.js +4 -1
- package/icc-x-api/icc-time-table-x-api.js.map +1 -1
- package/icc-x-api/icc-topic-x-api.d.ts +3 -2
- package/icc-x-api/icc-topic-x-api.js +3 -3
- package/icc-x-api/icc-topic-x-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-contact-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-contact-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsD;AAGtD,sDAAsC;AAEtC,iCAAgC;AAChC,4BAA2B;AAC3B,kDAAiD;AACjD,oDAAyF;AAEzF,uDAA+C;AAC/C,qEAAiE;AAEjE,mCASgB;AAChB,0EAAgG;AAChG,wEAAoE;AAQpE,4DAAwE;AACxE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAEzD,kEAA8D;AAE9D,MAAa,cAAe,SAAQ,uBAAa;IAM/C,IAAI,OAAO;QACT,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,2BAA2B,CAAC,CAAC,EAAE,oCAA4B,CAAC,OAAO,CAAC,CAAC,CAAA;IAC7I,CAAC;IAED,YACE,IAAY,EACZ,OAAkC,EACjB,MAAqB,EACrB,YAA8B,EAC9B,OAAoB,EACpB,OAAmB,EACnB,cAAuB,EACxC,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,KAAK,EACT,uBAAiC,CAAC,OAAO,CAAC,EAC1C,uBAAiC,EAAE;QAEnC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAA;QAdtC,WAAM,GAAN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AAC,CAAA;IACpJ,CAAC;CACF;AAxmCD,wCAwmCC","sourcesContent":["import { IccAuthApi, IccContactApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport i18n from './rsrc/contact.i18n'\n\nimport * as moment from 'moment'\nimport * as _ from 'lodash'\nimport * as models from '../icc-api/model/models'\nimport { Contact, FilterChainService, ListOfIds, Service } from '../icc-api/model/models'\nimport { PaginatedListContact } from '../icc-api/model/PaginatedListContact'\nimport { utf8_2ua } from './utils/binary-utils'\nimport { ServiceByIdsFilter } from './filters/ServiceByIdsFilter'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport {\n before,\n decryptObject,\n EncryptedFieldsManifest,\n encryptObject,\n EntityWithDelegationTypeName,\n parseEncryptedFields,\n subscribeToEntityEvents,\n SubscriptionOptions,\n} from './utils'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { ShareResult } from './utils/ShareResult'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport { XHR } from '../icc-api/api/XHR'\nimport { IccUserXApi } from './icc-user-x-api'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { AbstractFilter } from './filters/filters'\nimport { Connection, ConnectionImpl } from '../icc-api/model/Connection'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\n\nexport class IccContactXApi extends IccContactApi implements EncryptedEntityXApi<models.Contact> {\n i18n: any = i18n\n private readonly contactEncryptedFields: EncryptedFieldsManifest\n private readonly serviceEncryptedFieldsNoContent: EncryptedFieldsManifest | undefined\n private readonly serviceEncryptedFieldsWithContent: EncryptedFieldsManifest\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.Contact))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private readonly crypto: IccCryptoXApi,\n private readonly dataOwnerApi: IccDataOwnerXApi,\n private readonly userApi: IccUserXApi,\n private readonly authApi: IccAuthApi,\n private readonly autofillAuthor: boolean,\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n contactEncryptedKeys: string[] = ['descr'],\n serviceEncryptedKeys: string[] = []\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n if (contactEncryptedKeys.some((key) => key.startsWith('services'))) {\n throw new Error(\"You can't customise encryption of the `services` field of Contact. Use the serviceEncryptedKeys parameter instead.\")\n }\n if (serviceEncryptedKeys.some((key) => key.startsWith('content'))) {\n throw new Error(\"You can't customise encryption of the `content` of a Service. The content values for services is automatically encrypted.\")\n }\n this.crypto = crypto\n this.dataOwnerApi = dataOwnerApi\n this.userApi = userApi\n this.authApi = authApi\n this.contactEncryptedFields = parseEncryptedFields(contactEncryptedKeys, 'Contact.')\n const customServiceEncryptedFields = parseEncryptedFields(serviceEncryptedKeys, 'Service.')\n if (serviceEncryptedKeys.length > 0) {\n this.serviceEncryptedFieldsNoContent = customServiceEncryptedFields\n }\n this.serviceEncryptedFieldsWithContent = {\n ...customServiceEncryptedFields,\n topLevelFields: [...customServiceEncryptedFields.topLevelFields, { fieldName: 'content', fieldPath: 'Service.content' }],\n }\n }\n\n /**\n * Creates a new instance of contact with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this contact refers to.\n * @param c initialised data for the contact. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify other\n * kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with\n * auto-delegations, in such case the access level specified here will be used.\n * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the contact. The default value will be a\n * secret id of patient known by the topmost parent in the current data owner hierarchy if the confidential is set to false, else a secret id that\n * the data owner did not share with any of his parents.\n * - confidential: if true, the entity will be created as confidential. Confidential entities are not shared with auto-delegations, and the default\n * foreign key used is any key that is not shared with any of the data owner parents. By default entities are created as non-confidential.\n * - alternateRootDelegation: by default a new entity is created with a root delegation from self to self. In keyless mode this is not possible,\n * and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.\n * @return a new instance of contact.\n */\n async newInstance(\n user: models.User,\n patient: models.Patient,\n c: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n ignoreAutoDelegations?: boolean // default is considered false\n alternateRootDelegation?: string\n } = {}\n ): Promise<models.Contact> {\n const contact = new models.Contact({\n ...(c ?? {}),\n _type: 'org.taktik.icure.entities.Contact',\n id: c?.id ?? this.crypto.primitives.randomUuid(),\n created: c?.created ?? new Date().getTime(),\n modified: c?.modified ?? new Date().getTime(),\n responsible: c?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: c?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: c?.codes ?? [],\n tags: c?.tags ?? [],\n groupId: c?.groupId ?? this.crypto.primitives.randomUuid(),\n subContacts: c?.subContacts ?? [],\n services: c?.services ?? [],\n openingDate: c?.openingDate ?? parseInt(moment().format('YYYYMMDDHHmmss')),\n })\n\n const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (ownerId !== (await this.dataOwnerApi.getCurrentDataOwnerId())) throw new Error('Can only initialise entities as current data owner.')\n const sfk = await this.crypto.xapi.resolveSecretIdUseOptions(\n { entity: patient, type: EntityWithDelegationTypeName.Patient },\n options.sfkOption ?? SecretIdUseOption.UseAnySharedWithParent\n )\n const extraDelegations = {\n ...(options.ignoreAutoDelegations\n ? {}\n : Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.medicalInformation ?? [])].map((d) => [d, AccessLevelEnum.WRITE])\n )),\n ...(options?.additionalDelegates ?? {}),\n }\n const initialisationInfo = await this.crypto.xapi.entityWithInitialisedEncryptedMetadata(\n contact,\n EntityWithDelegationTypeName.Contact,\n patient.id,\n sfk,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n return new models.Contact(initialisationInfo.updatedEntity)\n }\n\n /**\n * 1. Check whether there is a delegation with 'hcpartyId' or not.\n * 2. 'fetchHcParty[hcpartyId][1]': is encrypted AES exchange key by RSA public key of him.\n * 3. Obtain the AES exchange key, by decrypting the previous step value with hcparty private key\n * 3.1. KeyPair should be fetch from cache (in jwk)\n * 3.2. if it doesn't exist in the cache, it has to be loaded from Browser Local store, and then import it to WebCrypto\n * 4. Obtain the array of delegations which are delegated to his ID (hcpartyId) in this patient\n * 5. Decrypt and collect all keys (secretForeignKeys) within delegations of previous step (with obtained AES key of step 4)\n * 6. Do the REST call to get all contacts with (allSecretForeignKeysDelimitedByComa, hcpartyId)\n *\n * After these painful steps, you have the contacts of the patient.\n *\n * @deprecated use {@link findIdsBy} instead.\n * @param hcpartyId\n * @param patient (Promise)\n * @param usingPost\n */\n async findBy(hcpartyId: string, patient: models.Patient, usingPost: boolean = false) {\n return await this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }).then((keysHierarchy) =>\n keysHierarchy && keysHierarchy.length > 0\n ? Promise.all(\n keysHierarchy\n .reduce((acc, level) => {\n return acc.concat([\n {\n hcpartyId: level.ownerId,\n extractedKeys: level.extracted.filter((key) => !acc.some((previousLevel) => previousLevel.extractedKeys.includes(key))),\n },\n ])\n }, [] as Array<{ hcpartyId: string; extractedKeys: Array<string> }>)\n .filter((l) => l.extractedKeys.length > 0)\n .map(({ hcpartyId, extractedKeys }) =>\n usingPost\n ? this.findByHCPartyPatientSecretFKeysArray(hcpartyId, _.uniq(extractedKeys))\n : this.findByHCPartyPatientSecretFKeys(hcpartyId, _.uniq(extractedKeys).join(','))\n )\n ).then((results) => _.uniqBy(_.flatMap(results), (x) => x.id))\n : Promise.resolve([])\n )\n }\n\n /**\n * Same as {@link findIdsBy} but it will only return the ids of the contacts. It can also filter the contacts where Contact.openingDate is between\n * startDate and endDate in ascending or descending order by that field. (default: ascending).\n */\n async findIdsBy(hcpartyId: string, patient: models.Patient, startDate?: number, endDate?: number, descending?: boolean) {\n return await this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }).then((keysHierarchy) =>\n keysHierarchy && keysHierarchy.length > 0\n ? Promise.all(\n keysHierarchy\n .reduce((acc, level) => {\n return acc.concat([\n {\n hcpartyId: level.ownerId,\n extractedKeys: level.extracted.filter((key) => !acc.some((previousLevel) => previousLevel.extractedKeys.includes(key))),\n },\n ])\n }, [] as Array<{ hcpartyId: string; extractedKeys: Array<string> }>)\n .filter((l) => l.extractedKeys.length > 0)\n .map(({ hcpartyId, extractedKeys }) =>\n this.findContactIdsByDataOwnerPatientOpeningDate(hcpartyId, extractedKeys, startDate, endDate, descending)\n )\n ).then((results) => _.uniq(_.flatMap(results)))\n : Promise.resolve([])\n )\n }\n\n /**\n * @deprecated Unused method, bugged: won't work if `hcpartyId` is not the parent hcp and doesn't decrypt contacts.\n * Will be permanently removed in version 8.2.0\n */\n async findByPatientSFKs(hcpartyId: string, patients: Array<models.Patient>): Promise<Array<models.Contact>> {\n const perHcpId: { [key: string]: string[] } = {}\n for (const patient of patients) {\n ;(await this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }))\n .reduce((acc, level) => {\n return acc.concat([\n {\n hcpartyId: level.ownerId,\n extractedKeys: level.extracted.filter((key) => !acc.some((previousLevel) => previousLevel.extractedKeys.includes(key))),\n },\n ])\n }, [] as Array<{ hcpartyId: string; extractedKeys: Array<string> }>)\n .filter((l) => l.extractedKeys.length > 0)\n .forEach(({ hcpartyId, extractedKeys }) => {\n ;(perHcpId[hcpartyId] || (perHcpId[hcpartyId] = [])).push(...extractedKeys)\n })\n }\n\n return _.uniqBy(\n _.flatMap(\n await Promise.all(\n Object.keys(perHcpId).map((hcpId) =>\n this.findContactsByHCPartyPatientForeignKeys(\n hcpartyId,\n new models.ListOfIds({\n ids: perHcpId[hcpId],\n })\n )\n )\n )\n ),\n (x) => x.id\n )\n }\n\n filterBy(startKey?: string, startDocumentId?: string, limit?: number, body?: models.FilterChainContact): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listContactsByOpeningDate(\n startDate: number,\n endDate: number,\n hcpartyid: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listServices(body?: ListOfIds): Promise<Array<Service>> {\n throw new Error('Cannot call a method that returns services without providing a user for de/encryption')\n }\n\n findByHCPartyFormId(hcPartyId?: string, formId?: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n findByHCPartyFormIds(hcPartyId?: string, body?: models.ListOfIds): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n getContact(contactId: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n getContacts(body?: models.ListOfIds): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n modifyContact(body?: Contact): never {\n throw new Error('Cannot call a method that modify contacts without providing a user for de/encryption')\n }\n\n modifyContacts(body?: Array<Contact>): never {\n throw new Error('Cannot call a method that modify contacts without providing a user for de/encryption')\n }\n\n createContact(body?: Contact): never {\n throw new Error('Cannot call a method that modify contacts without providing a user for de/encryption')\n }\n\n /**\n * @deprecated use {@link findContactIdsByDataOwnerPatientOpeningDate} instead.\n */\n findByHCPartyPatientSecretFKeys(\n hcPartyId: string,\n secretFKeys: string,\n planOfActionIds?: string,\n skipClosedContacts?: boolean\n ): Promise<Array<models.Contact>> {\n return super\n .findByHCPartyPatientSecretFKeys(hcPartyId, secretFKeys, planOfActionIds, skipClosedContacts)\n .then((contacts) => this.decrypt(hcPartyId, contacts))\n }\n\n /**\n * @deprecated use {@link findContactIdsByDataOwnerPatientOpeningDate} instead.\n */\n findByHCPartyPatientSecretFKeysArray(\n hcPartyId: string,\n secretFKeys: string[],\n planOfActionIds?: string,\n skipClosedContacts?: boolean\n ): Promise<Array<models.Contact> | any> {\n return super\n .findByHCPartyPatientSecretFKeysUsingPost(hcPartyId, planOfActionIds, skipClosedContacts, secretFKeys)\n .then((contacts) => this.decrypt(hcPartyId, contacts))\n }\n\n filterByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainContact\n ): Promise<PaginatedListContact | any> {\n return super\n .filterContactsBy(startDocumentId, limit, body)\n .then((ctcs) =>\n this.decrypt(user.healthcarePartyId! || user.patientId!, ctcs.rows!).then((decryptedRows) => Object.assign(ctcs, { rows: decryptedRows }))\n )\n }\n\n listContactsByOpeningDateWithUser(\n user: models.User,\n startDate: number,\n endDate: number,\n hcpartyid: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): Promise<PaginatedListContact | any> {\n return super\n .listContactsByOpeningDate(startDate, endDate, hcpartyid, startKey, startDocumentId, limit)\n .then((ctcs) =>\n this.decrypt(user.healthcarePartyId! || user.patientId!, ctcs.rows!).then((decryptedRows) => Object.assign(ctcs, { rows: decryptedRows }))\n )\n }\n\n getServiceWithUser(user: models.User, serviceId: string): Promise<Service> {\n return super\n .getService(serviceId)\n .then((service) => this.decryptServices(user.healthcarePartyId ?? user.patientId ?? user.deviceId!, [service]))\n .then((decrypted) => decrypted[0])\n }\n\n listServicesWithUser(user: models.User, serviceIds: ListOfIds): Promise<Array<Service> | any> {\n return super\n .filterServicesBy(undefined, serviceIds.ids?.length, new FilterChainService({ filter: new ServiceByIdsFilter({ ids: serviceIds.ids }) }))\n .then((paginatedList) => this.decryptServices(user.healthcarePartyId ?? user.patientId ?? user.deviceId!, paginatedList.rows ?? []))\n }\n\n findByHCPartyFormIdWithUser(user: models.User, hcPartyId: string, formId: string): Promise<Array<models.Contact> | any> {\n return super.findByHCPartyFormId(hcPartyId, formId).then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n }\n\n findByHCPartyFormIdsWithUser(user: models.User, hcPartyId: string, body: models.ListOfIds): Promise<Array<models.Contact> | any> {\n return super.findByHCPartyFormIds(hcPartyId, body).then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n }\n\n getContactWithUser(user: models.User, contactId: string): Promise<models.Contact> {\n return super\n .getContact(contactId)\n .then((ctc) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [ctc]))\n .then((ctcs) => ctcs[0])\n }\n\n getContactsWithUser(user: models.User, body?: models.ListOfIds): Promise<Array<models.Contact> | any> {\n return super.getContacts(body).then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n }\n\n async modifyContactWithUser(user: models.User, body?: models.Contact): Promise<models.Contact | any> {\n return body ? this.modifyContactAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, body) : null\n }\n\n private modifyContactAs(dataOwner: string, body: models.Contact): Promise<models.Contact> {\n return this.encryptAs(dataOwner, [_.cloneDeep(body)])\n .then((ctcs) => super.modifyContact(ctcs[0]))\n .then((ctc) => this.decrypt(dataOwner, [ctc]))\n .then((ctcs) => ctcs[0])\n }\n\n async modifyContactsWithUser(user: models.User, bodies?: Array<models.Contact>): Promise<models.Contact[] | any> {\n return bodies\n ? this.encrypt(\n user,\n bodies.map((c) => _.cloneDeep(c))\n )\n .then((ctcs) => super.modifyContacts(ctcs))\n .then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n : null\n }\n\n async createContactWithUser(user: models.User, body?: models.Contact): Promise<models.Contact | null> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((ctcs) => super.createContact(ctcs[0]))\n .then((ctc) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [ctc]))\n .then((ctcs) => ctcs[0])\n : null\n }\n\n async createContactsWithUser(user: models.User, bodies?: Array<models.Contact>): Promise<models.Contact[] | null> {\n return bodies\n ? this.encrypt(\n user,\n bodies.map((c) => _.cloneDeep(c))\n )\n .then((ctcs) => super.createContacts(ctcs))\n .then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n : null\n }\n\n encryptServices(key: CryptoKey, rawKey: string, services: Service[]): PromiseLike<Service[]> {\n return Promise.all(\n services.map(async (svc) => {\n if (\n svc.content &&\n Object.values(svc.content).every(\n (c) =>\n c.compoundValue &&\n !c.stringValue &&\n !c.documentId &&\n !c.measureValue &&\n !c.medicationValue &&\n (c.booleanValue === null || c.booleanValue === undefined) &&\n (c.numberValue === null || c.numberValue === undefined) &&\n !c.instantValue &&\n !c.fuzzyDateValue &&\n !c.binaryValue\n )\n ) {\n const recursivelyEncryptedContent = Object.fromEntries(\n await Promise.all(\n Object.entries(svc.content).map(async (p) => {\n if (p[1].compoundValue?.length) {\n return [p[0], { ...p[1], compoundValue: await this.encryptServices(key, rawKey, p[1].compoundValue!) }]\n } else return p\n })\n )\n )\n const copyWithEncryptedContent = { ...svc, content: recursivelyEncryptedContent }\n return this.serviceEncryptedFieldsNoContent\n ? encryptObject(\n copyWithEncryptedContent,\n (obj) => {\n return this.crypto.primitives.AES.encrypt(key, utf8_2ua(JSON.stringify(obj)), rawKey)\n },\n this.serviceEncryptedFieldsNoContent,\n 'service'\n )\n : copyWithEncryptedContent\n } else {\n return encryptObject(\n svc,\n (obj) => {\n return this.crypto.primitives.AES.encrypt(key, utf8_2ua(JSON.stringify(obj)), rawKey)\n },\n this.serviceEncryptedFieldsWithContent,\n 'service'\n )\n }\n })\n )\n }\n\n encrypt(user: models.User, ctcs: Array<models.Contact>) {\n return this.encryptAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs)\n }\n\n private async encryptAs(hcpartyId: string, ctcs: Array<models.Contact>): Promise<models.Contact[]> {\n const initializedContacts: models.Contact[] = []\n for (const ctc of ctcs) {\n initializedContacts.push((await this.crypto.xapi.ensureEncryptionKeysInitialised(ctc, EntityWithDelegationTypeName.Contact)) ?? ctc)\n }\n const allEncrypted = await this.crypto.xapi.doManyIncrementallyDecryptingKeys(\n initializedContacts,\n EntityWithDelegationTypeName.Contact,\n async (entity, t, keys) => {\n for (const k of keys) {\n try {\n const encrypted = new Contact(\n await encryptObject(\n {\n ...entity,\n services: entity.services ? await this.encryptServices(k.key, k.raw, entity.services) : [],\n },\n (obj) => {\n return this.crypto.primitives.AES.encrypt(k.key, utf8_2ua(JSON.stringify(obj)), k.raw)\n },\n this.contactEncryptedFields,\n EntityWithDelegationTypeName.Contact\n )\n )\n return { success: encrypted }\n } catch (e) {\n console.warn(`Failed to encrypt contact ${entity.id} with key ${k.raw}`)\n }\n }\n return null\n }\n )\n if (ctcs.length != allEncrypted.size) {\n throw new Error(`Couldn't encrypt contacts ${ctcs.flatMap((e) => (allEncrypted.has(e.id!) ? [] : [e.id!]))}`)\n }\n return ctcs.map((e) => allEncrypted.get(e.id!)!)\n }\n\n async decrypt(hcpartyId: string, ctcs: Array<models.Contact>): Promise<Array<models.Contact>> {\n return (await this.crypto.xapi.tryDecryptEntities(ctcs, EntityWithDelegationTypeName.Contact, (x) => new Contact(x))).map(({ entity }) => entity)\n }\n\n async decryptServices(hcpartyId: string, svcs: Array<models.Service>): Promise<Array<models.Service>> {\n /*TODO\n * not super efficient, re-decrypts the encryption key metadata of services multiple times, but should mostly rely\n * on cached exchange data after the first decryption and should not do any extra requests to the db.\n * We could ensure to use only cached exchange data by doing limited-size batches of services from the same contact\n * id.\n */\n return (await this.crypto.xapi.tryDecryptEntities(svcs, EntityWithDelegationTypeName.Contact, (x) => new Service(x))).map(({ entity }) => entity)\n }\n\n contactOfService(ctcs: Array<models.Contact>, svcId: string): models.Contact | undefined {\n let latestContact: models.Contact | undefined = undefined\n let latestService: models.Service\n ctcs.forEach((c) => {\n const s: models.Service | undefined = c.services!.find((it) => svcId === it.id)\n if (s && (!latestService || moment(s.valueDate).isAfter(moment(latestService.valueDate)))) {\n latestContact = c\n latestService = s\n }\n })\n return latestContact\n }\n\n filteredServices(ctcs: Array<models.Contact>, filter: any): Array<models.Service> {\n const byIds: { [key: string]: models.Service } = {}\n ctcs.forEach((c) =>\n (c.services || [])\n .filter((s) => filter(s, c))\n .forEach((s) => {\n const ps = byIds[s.id!]\n if (!ps || !ps.modified || (s.modified && ps.modified < s.modified)) {\n byIds[s.id!] = s\n s.contactId = c.id\n }\n })\n )\n return _.values(byIds).filter((s: any) => !s.deleted && !s.endOfLife)\n }\n\n //Return a promise\n filterServices(ctcs: Array<models.Contact>, filter: any): Promise<Array<models.Service>> {\n return Promise.resolve(this.filteredServices(ctcs, filter))\n }\n\n services(ctc: models.Contact, label: string) {\n return ctc.services!.filter((s) => s.label === label)\n }\n\n preferredContent(svc: models.Service, lng: string) {\n return (\n svc && svc.content && (svc.content[lng] || svc.content['fr'] || (Object.keys(svc.content)[0] ? svc.content[Object.keys(svc.content)[0]] : null))\n )\n }\n\n contentValue(c: models.Content) {\n return (\n c.stringValue ||\n ((c.numberValue || c.numberValue === 0) && c.numberValue) ||\n (c.measureValue && (c.measureValue.value || c.measureValue.value === 0) ? c.measureValue : null) ||\n c.medicationValue ||\n c.booleanValue\n )\n }\n\n shortServiceDescription(svc: models.Service, lng: string) {\n const c = this.preferredContent(svc, lng)\n return !c ? '' : this.shortContentDescription(c, lng, svc.label)\n }\n\n shortContentDescription(c: models.Content, lng: string, label?: string) {\n return (\n c.stringValue ||\n ((c.numberValue || c.numberValue === 0) && c.numberValue) ||\n (c.measureValue &&\n '' +\n (c.measureValue.value || c.measureValue.value === 0 ? c.measureValue.value : '-') +\n (c.measureValue.unit ? ' ' + c.measureValue.unit : '')) ||\n (c.medicationValue ? this.medication().medicationToString(c.medicationValue, lng) : null) ||\n (c.booleanValue && label) ||\n 'OK'\n )\n }\n\n medicationValue(svc: models.Service, lng: string) {\n const c =\n svc && svc.content && (svc.content[lng] || svc.content['fr'] || (Object.keys(svc.content)[0] ? svc.content[Object.keys(svc.content)[0]] : null))\n return c && c.medicationValue\n }\n\n contentHasData(c: any): boolean {\n return c.stringValue || c.numberValue || c.measureValue || c.booleanValue || c.booleanValue === false || c.medicationValue || c.documentId\n }\n\n localize(e: any, lng: string) {\n if (!e) {\n return null\n }\n return e[lng] || e.fr || e.en || e.nl\n }\n\n /**\n * Modifies the subcontacts this svc belongs to while minimizing the number of references to the svcs inside the subcontacts\n * After the invocation, there is at least one subcontact with provided poaId and heId that contains the svc\n * The svc is not removed from a previous subcontact it would belong to except if the new conditions are compatible\n * Note that undefined and null do not have the same meaning for formId\n * If formId is null: the subcontact which refers svc must have a null formId\n * If formId is undefined, the subcontact can have any value for formId\n *\n * When a svc does not exist yet in the current contact but exists in a previous contact, all the scs it was belonging to are\n * copied in the current contact\n *\n * the svc returned is the one that's inside the ctc\n *\n * @param ctc\n * @param user\n * @param ctcs\n * @param svc\n * @param formId\n * @param poaId aMap {heId2: [poaId11, poaId12], heId2: [poaId21] }\n * @param heId an Array of heIds, equivalent to poaIds = {heId: [], ...}\n * @param init\n * @returns {*}\n */\n\n promoteServiceInContact(\n ctc: models.Contact,\n user: models.User,\n ctcs: Array<models.Contact>,\n svc: models.Service,\n formId: string,\n poaIds?: { [key: string]: string[] },\n heIds?: Array<string>,\n init?: any\n ) {\n if (!ctc) {\n return null\n }\n const existing = ctc.services!.find((s) => s.id === svc.id)\n const promoted = _.extend(_.extend(existing || {}, svc), {\n author: user.id,\n responsible: this.dataOwnerApi.getDataOwnerIdOf(user),\n modified: new Date().getTime(),\n })\n if (!existing) {\n ;(ctc.services || (ctc.services = [])).push(promoted)\n }\n const allSubcontactsInCurrentContactContainingService = (ctc.subContacts || []).filter((csc) =>\n (csc.services || []).some((s) => s.serviceId === svc.id)\n )\n\n //Rearrange poaIds and heIds as a hierarchy\n const hierarchyOfHeAndPoaIds: { [key: string]: Array<any> } = {}\n ;(heIds || []).forEach((id) => (hierarchyOfHeAndPoaIds[id || '_'] = []))\n Object.keys(poaIds || {}).forEach((k: string) => {\n const poas = hierarchyOfHeAndPoaIds[k]\n if (poas) {\n hierarchyOfHeAndPoaIds[k] = _.concat(poas, (poaIds || {})[k])\n } else {\n hierarchyOfHeAndPoaIds[k] = (poaIds || {})[k]\n }\n })\n\n const pastCtc =\n (svc.contactId && svc.contactId !== ctc.id && ctcs.find((c) => c.id === svc.contactId)) ||\n ctcs.reduce(\n (selected: { s: models.Service | null; c: models.Contact | null }, c: models.Contact) => {\n const candidate = (c.services || []).find((s) => s.id === svc.id)\n return ctc.id !== c.id && candidate && (selected.s === null || before(selected.s.modified || 0, candidate.modified || 0))\n ? { s: candidate, c: c }\n : selected\n },\n { s: null, c: null }\n ).c\n //Make sure that all scs the svc was belonging to are copied inside the current contact\n pastCtc &&\n pastCtc\n .subContacts!.filter((psc) => psc.services!.some((s) => s.serviceId === svc.id))\n .forEach((psc) => {\n const sameInCurrent = allSubcontactsInCurrentContactContainingService.find(\n (csc) => csc.formId === psc.formId && csc.planOfActionId === psc.planOfActionId && csc.healthElementId === psc.healthElementId\n )\n if (sameInCurrent) {\n if (!sameInCurrent.services!.some((s) => s.serviceId === svc.id)) {\n sameInCurrent.services!.push({ serviceId: svc.id })\n }\n } else {\n const newSubContact = _.assign(_.assign({}, psc), {\n services: [{ serviceId: svc.id }],\n })\n ctc.subContacts!.push(newSubContact)\n allSubcontactsInCurrentContactContainingService.push(newSubContact)\n }\n })\n\n if (!Object.keys(hierarchyOfHeAndPoaIds).length) {\n hierarchyOfHeAndPoaIds._ = [] //Default is to have at least one option with heId equals to null (represented by _)\n }\n\n Object.keys(hierarchyOfHeAndPoaIds).forEach((heId: string | null) => {\n if (heId === '_') {\n heId = null\n }\n const subPoaIds = heId ? hierarchyOfHeAndPoaIds[heId] : []\n ;((subPoaIds || []).length ? subPoaIds : [null]).forEach((poaId) => {\n //Create or assign subcontacts for all pairs he/poa (can be null/null)\n let destinationSubcontact = ctc.subContacts!.find(\n (sc) =>\n (!formId || sc.formId === formId) &&\n ((!poaId && !sc.planOfActionId) || sc.planOfActionId === poaId) &&\n ((!heId && !sc.healthElementId) || sc.healthElementId === heId)\n )\n if (!destinationSubcontact) {\n ctc.subContacts!.push(\n (destinationSubcontact = new models.SubContact({\n formId: formId || undefined,\n planOfActionId: poaId,\n healthElementId: heId,\n services: [],\n }))\n )\n }\n\n const redundantSubcontact =\n allSubcontactsInCurrentContactContainingService.find((aSc) => destinationSubcontact === aSc) ||\n allSubcontactsInCurrentContactContainingService.find(\n (aSc) =>\n (!aSc.planOfActionId || aSc.planOfActionId === destinationSubcontact!.planOfActionId) &&\n (!aSc.healthElementId || aSc.healthElementId === destinationSubcontact!.healthElementId) &&\n (!aSc.formId || aSc.formId === destinationSubcontact!.formId)\n ) // Find a compatible sc: one that does not contain extra and ≠ information than the destination\n\n if (redundantSubcontact && redundantSubcontact !== destinationSubcontact) {\n redundantSubcontact.services!.splice(\n redundantSubcontact.services!.findIndex((link) => link.serviceId === svc.id),\n 1\n )\n }\n if (!destinationSubcontact.services!.some((s) => s.serviceId === svc.id)) {\n destinationSubcontact.services!.push({ serviceId: svc.id! })\n }\n })\n })\n\n return (init && init(promoted)) || promoted\n }\n\n isNumeric(svc: models.Service, lng: string) {\n const c = this.preferredContent(svc, lng)\n return c && (c.measureValue || c.numberValue || c.numberValue == 0)\n }\n\n service() {\n return {\n newInstance: (user: models.User, s: any) =>\n _.extend(\n {\n id: this.crypto.primitives.randomUuid(),\n _type: 'org.taktik.icure.entities.embed.Service',\n created: new Date().getTime(),\n modified: new Date().getTime(),\n responsible: s?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: s?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: [],\n tags: [],\n content: {},\n valueDate: parseInt(moment().format('YYYYMMDDHHmmss')),\n },\n s\n ),\n }\n }\n\n medication() {\n const regimenScores: any = {\n afterwakingup: 63000,\n beforebreakfast: 70000,\n duringbreakfast: 80000,\n afterbreakfast: 90000,\n morning: 100000,\n betweenbreakfastandlunch: 103000,\n beforelunch: 113000,\n midday: 120000,\n duringlunch: 123000,\n afterlunch: 130000,\n afternoon: 140000,\n betweenlunchanddinner: 160000,\n beforedinner: 180000,\n duringdinner: 190000,\n afterdinner: 200000,\n evening: 210000,\n betweendinnerandsleep: 213000,\n thehourofsleep: 220000,\n night: 230000,\n beforemeals: -30000,\n betweenmeals: -20000,\n aftermeals: -10000,\n }\n\n const myself = {\n regimenScores: function () {\n return regimenScores\n },\n medicationNameToString: function (m: any): string {\n return m && m.compoundPrescription\n ? m.compoundPrescription\n : m && m.substanceProduct\n ? myself.productToString(m && m.substanceProduct)\n : myself.productToString(m && m.medicinalProduct)\n },\n reimbursementReasonToString: (m: any, lang: string) => {\n return m && m.reimbursementReason && m.reimbursementReason.label && m.reimbursementReason.label.hasOwnProperty(lang)\n ? m.reimbursementReason.label[lang]\n : ''\n },\n medicationToString: (m: any, lang: string) => {\n let res = `${myself.medicationNameToString(m)}, ${myself.posologyToString(m, lang)}`\n const reason = myself.reimbursementReasonToString(m, lang)\n res = m.numberOfPackages\n ? `${m.numberOfPackages} ${m.numberOfPackages > 1 ? this.i18n[lang].packagesOf : this.i18n[lang].packageOf} ${res}`\n : res\n res = m.duration ? `${res} ${this.i18n[lang].during} ${myself.durationToString(m.duration, lang)}` : res\n res = reason ? `${res} (${reason})` : res\n return res\n },\n productToString: (m: any): string => {\n if (!m) {\n return ''\n }\n return m.intendedname\n },\n posologyToString: (m: any, lang: string) => {\n if (m) {\n if (m.instructionForPatient && m.instructionForPatient.length) {\n return m.instructionForPatient\n }\n if (!m.regimen || !m.regimen.length) {\n return ''\n }\n\n const unit =\n m.regimen[0].administratedQuantity && m.regimen[0].administratedQuantity.administrationUnit\n ? m.regimen[0].administratedQuantity.administrationUnit.code\n : m.regimen[0].administratedQuantity && m.regimen[0].administratedQuantity.unit\n let quantity = m.regimen[0].administratedQuantity && m.regimen[0].administratedQuantity.quantity\n\n m.regimen.slice(1).find((ri: any) => {\n const oUnit =\n ri.administratedQuantity && ri.administratedQuantity.administrationUnit\n ? ri.administratedQuantity.administrationUnit.code\n : ri.administratedQuantity && ri.administratedQuantity.unit\n const oQuantity = ri.administratedQuantity && ri.administratedQuantity.quantity\n\n if (oQuantity !== quantity) {\n quantity = -1\n }\n return oUnit !== unit && oQuantity !== quantity\n })\n\n const cplxRegimen = !unit || quantity < 0\n const quantityUnit = cplxRegimen ? `1 ${this.i18n[lang].take_s_}` : `${quantity} ${unit || this.i18n[lang].take_s_}`\n\n const dayPeriod = m.regimen.find((r: any) => r.weekday !== null && r.weekday !== undefined)\n ? this.i18n[lang].weekly\n : m.regimen.find((r: any) => r.date)\n ? this.i18n[lang].monthly\n : this.i18n[lang].daily\n\n return `${quantityUnit}, ${m.regimen.length} x ${dayPeriod}, ${_.sortBy(\n m.regimen,\n (r) =>\n (r.date ? r.date * 1000000 : 29990000000000) +\n (r.dayNumber || 0) * 1000000 +\n ((r.weekday && r.weekday.weekNumber) || 0) * 7 * 1000000 +\n (r.timeOfDay ? r.timeOfDay : r.dayPeriod && r.dayPeriod.code ? (regimenScores[r.dayPeriod.code] as number) : 0)\n )\n .map((r) => (cplxRegimen ? myself.regimenToExtString(r, lang) : myself.regimenToString(r, lang)))\n .join(', ')}`\n }\n },\n frequencyToString: (m: any, lang: string) => {\n if (m.instructionForPatient && m.instructionForPatient.length) {\n return m.instructionForPatient\n }\n if (!m.regimen || !m.regimen.length) {\n return ''\n }\n\n const dayPeriod = m.regimen.find((r: any) => r.weekday !== null && r.weekday !== undefined)\n ? this.i18n[lang].weekly\n : m.regimen.find((r: any) => r.date)\n ? this.i18n[lang].monthly\n : this.i18n[lang].daily\n\n return `${m.regimen.length} x ${dayPeriod}`\n },\n durationToString: (d: models.Duration, lang: string) => {\n return d.value ? `${d.value} ${this.localize(d.unit!.label, lang)}` : ''\n },\n regimenToExtString: (r: models.RegimenItem, lang: string) => {\n const desc = myself.regimenToString(r, lang)\n return (\n (r.administratedQuantity && r.administratedQuantity.quantity && desc\n ? `${desc} (${r.administratedQuantity.quantity} ${\n (r.administratedQuantity.administrationUnit ? r.administratedQuantity.administrationUnit.code : r.administratedQuantity.unit) ||\n this.i18n[lang].take_s_\n })`\n : desc) || ''\n )\n },\n regimenToString: (r: models.RegimenItem, lang: string) => {\n let res = r.date\n ? `${this.i18n[lang].the} ${moment(r.date).format('DD/MM/YYYY')}`\n : r.dayNumber\n ? `${this.i18n[lang].onDay} ${r.dayNumber}`\n : r.weekday && r.weekday.weekday\n ? `${this.i18n[lang].on} ${r.weekday.weekday}`\n : null\n if (r.dayPeriod && r.dayPeriod.code && r.dayPeriod.code.length) {\n res = res\n ? `${res} ${this.i18n[lang][r.dayPeriod.code] || this.localize(r.dayPeriod.label, lang) || r.dayPeriod.code}`\n : this.i18n[lang][r.dayPeriod.code] || this.localize(r.dayPeriod.label, lang) || r.dayPeriod.code\n }\n if (r.timeOfDay) {\n const timeOfDay =\n r.timeOfDay === 120000\n ? this.i18n[lang].noon\n : `${Math.floor(r.timeOfDay / 10000)}:${('' + (Math.floor(r.timeOfDay / 100) % 100)).replace(/^(.)$/, '0$1')}`\n res = res ? res + ' ' + this.i18n[lang].at + ' ' + timeOfDay : timeOfDay\n }\n return res\n },\n localize: (s: any, lang: string) => {\n if (!s) {\n return s\n }\n return (\n this.i18n[lang][s] ||\n (this.i18n[lang][s.toLowerCase()] &&\n this.i18n[lang][s.toLowerCase()]\n .split('')\n .map((c: string, idx: number) => (idx >= s.length || s[idx].toLocaleLowerCase() === s[idx] ? c : c.toLocaleUpperCase()))\n .join('')) ||\n s\n ) //Applies the (lower/upper)case to the translated lowercase version of the input string (s)\n },\n }\n return myself\n }\n\n /**\n * @param contact a contact\n * @return the id of the patient that the contact refers to, retrieved from the encrypted metadata. Normally there should only be one element\n * in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(contact: models.Contact): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: contact, type: EntityWithDelegationTypeName.Contact }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given contact\n */\n async hasWriteAccess(contact: models.Contact): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: contact, type: EntityWithDelegationTypeName.Contact })\n }\n\n /**\n * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param delegateId the id of the data owner which will be granted access to the contact.\n * @param contact the contact to share.\n * @param options optional parameters to customize the sharing behaviour:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * contact does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWith(\n delegateId: string,\n contact: models.Contact,\n options: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Contact> {\n return this.shareWithMany(contact, { [delegateId]: options })\n }\n\n /**\n * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param contact the contact to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * contact does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWithMany(\n contact: models.Contact,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Contact> {\n return (await this.tryShareWithMany(contact, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param contact the contact to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * contact does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return a promise which will contain the result of the operation: the updated entity if the operation was successful or details of the error if\n * the operation failed.\n */\n async tryShareWithMany(\n contact: models.Contact,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.Contact>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(contact, EntityWithDelegationTypeName.Contact)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyContactAs(self, entityWithEncryptionKey) : contact\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.Contact,\n },\n Object.fromEntries(\n Object.entries(delegates).map(([delegateId, options]) => [\n delegateId,\n {\n requestedPermissions: options.requestedPermissions,\n shareEncryptionKeys: options.shareEncryptionKey,\n shareOwningEntityIds: options.sharePatientId,\n shareSecretIds: options.shareSecretIds,\n },\n ])\n ),\n (x) => this.bulkShareContacts(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: models.Contact\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.Contact })\n }\n\n getEncryptionKeysOf(entity: models.Contact): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.Contact }, undefined)\n }\n\n async subscribeToServiceEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Service> | undefined,\n eventFired: (dataSample: Service) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n const currentUser = await this.userApi.getCurrentUser()\n return subscribeToEntityEvents(\n this.host,\n this.authApi,\n 'Service',\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted: Service) => (await this.decryptServices(currentUser.healthcarePartyId!, [encrypted]))[0]\n ).then((ws) => new ConnectionImpl(ws))\n }\n\n async subscribeToContactEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Contact> | undefined,\n eventFired: (dataSample: Contact) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n const currentUser = await this.userApi.getCurrentUser()\n return subscribeToEntityEvents(\n this.host,\n this.authApi,\n EntityWithDelegationTypeName.Contact,\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted: Contact) => (await this.decrypt(currentUser.healthcarePartyId!, [encrypted]))[0]\n ).then((ws) => new ConnectionImpl(ws))\n }\n\n createDelegationDeAnonymizationMetadata(entity: Contact, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: EntityWithDelegationTypeName.Contact }, delegates)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"icc-contact-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-contact-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsD;AAGtD,sDAAsC;AAEtC,iCAAgC;AAChC,4BAA2B;AAC3B,kDAAiD;AACjD,oDAAyF;AAEzF,uDAA+C;AAC/C,qEAAiE;AAEjE,mCASgB;AAChB,0EAAgG;AAChG,wEAAoE;AAQpE,4DAAwE;AACxE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAEzD,kEAA8D;AAE9D,MAAa,cAAe,SAAQ,uBAAa;IAM/C,IAAI,OAAO;QACT,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,C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AAA;YACvD,OAAO,IAAA,+BAAuB,EAC5B,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ,oCAA4B,CAAC,OAAO,EACpC,UAAU,EACV,MAAM,EACN,UAAU,EACV,OAAO,EACP,CAAO,SAAkB,EAAE,EAAE,gDAAC,OAAA,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,iBAAkB,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,GAAA,CACnG,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,2BAAc,CAAC,EAAE,CAAC,CAAC,CAAA;QACxC,CAAC;KAAA;IAED,uCAAuC,CAAC,MAAe,EAAE,SAAmB;QAC1E,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,iCAAiC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAA;IACpJ,CAAC;CACF;AArmCD,wCAqmCC","sourcesContent":["import { IccAuthApi, IccContactApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport i18n from './rsrc/contact.i18n'\n\nimport * as moment from 'moment'\nimport * as _ from 'lodash'\nimport * as models from '../icc-api/model/models'\nimport { Contact, FilterChainService, ListOfIds, Service } from '../icc-api/model/models'\nimport { PaginatedListContact } from '../icc-api/model/PaginatedListContact'\nimport { utf8_2ua } from './utils/binary-utils'\nimport { ServiceByIdsFilter } from './filters/ServiceByIdsFilter'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport {\n before,\n decryptObject,\n EncryptedFieldsManifest,\n encryptObject,\n EntityWithDelegationTypeName,\n parseEncryptedFields,\n subscribeToEntityEvents,\n SubscriptionOptions,\n} from './utils'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { ShareResult } from './utils/ShareResult'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport { XHR } from '../icc-api/api/XHR'\nimport { IccUserXApi } from './icc-user-x-api'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { AbstractFilter } from './filters/filters'\nimport { Connection, ConnectionImpl } from '../icc-api/model/Connection'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\n\nexport class IccContactXApi extends IccContactApi implements EncryptedEntityXApi<models.Contact> {\n i18n: any = i18n\n private readonly contactEncryptedFields: EncryptedFieldsManifest\n private readonly serviceEncryptedFieldsNoContent: EncryptedFieldsManifest | undefined\n private readonly serviceEncryptedFieldsWithContent: EncryptedFieldsManifest\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.Contact))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private readonly crypto: IccCryptoXApi,\n private readonly dataOwnerApi: IccDataOwnerXApi,\n private readonly userApi: IccUserXApi,\n private readonly authApi: IccAuthApi,\n private readonly autofillAuthor: boolean,\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n contactEncryptedKeys: string[] = ['descr'],\n serviceEncryptedKeys: string[] = []\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n if (contactEncryptedKeys.some((key) => key.startsWith('services'))) {\n throw new Error(\"You can't customise encryption of the `services` field of Contact. Use the serviceEncryptedKeys parameter instead.\")\n }\n if (serviceEncryptedKeys.some((key) => key.startsWith('content'))) {\n throw new Error(\"You can't customise encryption of the `content` of a Service. The content values for services is automatically encrypted.\")\n }\n this.crypto = crypto\n this.dataOwnerApi = dataOwnerApi\n this.userApi = userApi\n this.authApi = authApi\n this.contactEncryptedFields = parseEncryptedFields(contactEncryptedKeys, 'Contact.')\n const customServiceEncryptedFields = parseEncryptedFields(serviceEncryptedKeys, 'Service.')\n if (serviceEncryptedKeys.length > 0) {\n this.serviceEncryptedFieldsNoContent = customServiceEncryptedFields\n }\n this.serviceEncryptedFieldsWithContent = {\n ...customServiceEncryptedFields,\n topLevelFields: [...customServiceEncryptedFields.topLevelFields, { fieldName: 'content', fieldPath: 'Service.content' }],\n }\n }\n\n /**\n * Creates a new instance of contact with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this contact refers to.\n * @param c initialised data for the contact. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify other\n * kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with\n * auto-delegations, in such case the access level specified here will be used.\n * - sfkOption: specifies which sfk of the owning entity to use.\n * - ignoreAutoDelegations: if true the data won't be shared with the autodelegations of the user, but only with additional delegates\n * - alternateRootDelegation: by default a new entity is created with a root delegation from self to self. In keyless mode this is not possible,\n * and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.\n * @return a new instance of contact.\n */\n async newInstance(\n user: models.User,\n patient: models.Patient,\n c: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n ignoreAutoDelegations?: boolean // default is considered false\n alternateRootDelegation?: string\n } = {}\n ): Promise<models.Contact> {\n const contact = new models.Contact({\n ...(c ?? {}),\n _type: 'org.taktik.icure.entities.Contact',\n id: c?.id ?? this.crypto.primitives.randomUuid(),\n created: c?.created ?? new Date().getTime(),\n modified: c?.modified ?? new Date().getTime(),\n responsible: c?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: c?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: c?.codes ?? [],\n tags: c?.tags ?? [],\n groupId: c?.groupId ?? this.crypto.primitives.randomUuid(),\n subContacts: c?.subContacts ?? [],\n services: c?.services ?? [],\n openingDate: c?.openingDate ?? parseInt(moment().format('YYYYMMDDHHmmss')),\n })\n\n const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (ownerId !== (await this.dataOwnerApi.getCurrentDataOwnerId())) throw new Error('Can only initialise entities as current data owner.')\n const sfk = await this.crypto.xapi.resolveSecretIdUseOptions(\n { entity: patient, type: EntityWithDelegationTypeName.Patient },\n options.sfkOption ?? SecretIdUseOption.UseAnySharedWithParent\n )\n const extraDelegations = {\n ...(options.ignoreAutoDelegations == true\n ? {}\n : Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.medicalInformation ?? [])].map((d) => [d, AccessLevelEnum.WRITE])\n )),\n ...(options?.additionalDelegates ?? {}),\n }\n const initialisationInfo = await this.crypto.xapi.entityWithInitialisedEncryptedMetadata(\n contact,\n EntityWithDelegationTypeName.Contact,\n patient.id,\n sfk,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n return new models.Contact(initialisationInfo.updatedEntity)\n }\n\n /**\n * 1. Check whether there is a delegation with 'hcpartyId' or not.\n * 2. 'fetchHcParty[hcpartyId][1]': is encrypted AES exchange key by RSA public key of him.\n * 3. Obtain the AES exchange key, by decrypting the previous step value with hcparty private key\n * 3.1. KeyPair should be fetch from cache (in jwk)\n * 3.2. if it doesn't exist in the cache, it has to be loaded from Browser Local store, and then import it to WebCrypto\n * 4. Obtain the array of delegations which are delegated to his ID (hcpartyId) in this patient\n * 5. Decrypt and collect all keys (secretForeignKeys) within delegations of previous step (with obtained AES key of step 4)\n * 6. Do the REST call to get all contacts with (allSecretForeignKeysDelimitedByComa, hcpartyId)\n *\n * After these painful steps, you have the contacts of the patient.\n *\n * @deprecated use {@link findIdsBy} instead.\n * @param hcpartyId\n * @param patient (Promise)\n * @param usingPost\n */\n async findBy(hcpartyId: string, patient: models.Patient, usingPost: boolean = false) {\n return await this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }).then((keysHierarchy) =>\n keysHierarchy && keysHierarchy.length > 0\n ? Promise.all(\n keysHierarchy\n .reduce((acc, level) => {\n return acc.concat([\n {\n hcpartyId: level.ownerId,\n extractedKeys: level.extracted.filter((key) => !acc.some((previousLevel) => previousLevel.extractedKeys.includes(key))),\n },\n ])\n }, [] as Array<{ hcpartyId: string; extractedKeys: Array<string> }>)\n .filter((l) => l.extractedKeys.length > 0)\n .map(({ hcpartyId, extractedKeys }) =>\n usingPost\n ? this.findByHCPartyPatientSecretFKeysArray(hcpartyId, _.uniq(extractedKeys))\n : this.findByHCPartyPatientSecretFKeys(hcpartyId, _.uniq(extractedKeys).join(','))\n )\n ).then((results) => _.uniqBy(_.flatMap(results), (x) => x.id))\n : Promise.resolve([])\n )\n }\n\n /**\n * Same as {@link findIdsBy} but it will only return the ids of the contacts. It can also filter the contacts where Contact.openingDate is between\n * startDate and endDate in ascending or descending order by that field. (default: ascending).\n */\n async findIdsBy(hcpartyId: string, patient: models.Patient, startDate?: number, endDate?: number, descending?: boolean) {\n return await this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }).then((keysHierarchy) =>\n keysHierarchy && keysHierarchy.length > 0\n ? Promise.all(\n keysHierarchy\n .reduce((acc, level) => {\n return acc.concat([\n {\n hcpartyId: level.ownerId,\n extractedKeys: level.extracted.filter((key) => !acc.some((previousLevel) => previousLevel.extractedKeys.includes(key))),\n },\n ])\n }, [] as Array<{ hcpartyId: string; extractedKeys: Array<string> }>)\n .filter((l) => l.extractedKeys.length > 0)\n .map(({ hcpartyId, extractedKeys }) =>\n this.findContactIdsByDataOwnerPatientOpeningDate(hcpartyId, extractedKeys, startDate, endDate, descending)\n )\n ).then((results) => _.uniq(_.flatMap(results)))\n : Promise.resolve([])\n )\n }\n\n /**\n * @deprecated Unused method, bugged: won't work if `hcpartyId` is not the parent hcp and doesn't decrypt contacts.\n * Will be permanently removed in version 8.2.0\n */\n async findByPatientSFKs(hcpartyId: string, patients: Array<models.Patient>): Promise<Array<models.Contact>> {\n const perHcpId: { [key: string]: string[] } = {}\n for (const patient of patients) {\n ;(await this.crypto.xapi.secretIdsForHcpHierarchyOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }))\n .reduce((acc, level) => {\n return acc.concat([\n {\n hcpartyId: level.ownerId,\n extractedKeys: level.extracted.filter((key) => !acc.some((previousLevel) => previousLevel.extractedKeys.includes(key))),\n },\n ])\n }, [] as Array<{ hcpartyId: string; extractedKeys: Array<string> }>)\n .filter((l) => l.extractedKeys.length > 0)\n .forEach(({ hcpartyId, extractedKeys }) => {\n ;(perHcpId[hcpartyId] || (perHcpId[hcpartyId] = [])).push(...extractedKeys)\n })\n }\n\n return _.uniqBy(\n _.flatMap(\n await Promise.all(\n Object.keys(perHcpId).map((hcpId) =>\n this.findContactsByHCPartyPatientForeignKeys(\n hcpartyId,\n new models.ListOfIds({\n ids: perHcpId[hcpId],\n })\n )\n )\n )\n ),\n (x) => x.id\n )\n }\n\n filterBy(startKey?: string, startDocumentId?: string, limit?: number, body?: models.FilterChainContact): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listContactsByOpeningDate(\n startDate: number,\n endDate: number,\n hcpartyid: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n listServices(body?: ListOfIds): Promise<Array<Service>> {\n throw new Error('Cannot call a method that returns services without providing a user for de/encryption')\n }\n\n findByHCPartyFormId(hcPartyId?: string, formId?: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n findByHCPartyFormIds(hcPartyId?: string, body?: models.ListOfIds): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n getContact(contactId: string): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n getContacts(body?: models.ListOfIds): never {\n throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption')\n }\n\n modifyContact(body?: Contact): never {\n throw new Error('Cannot call a method that modify contacts without providing a user for de/encryption')\n }\n\n modifyContacts(body?: Array<Contact>): never {\n throw new Error('Cannot call a method that modify contacts without providing a user for de/encryption')\n }\n\n createContact(body?: Contact): never {\n throw new Error('Cannot call a method that modify contacts without providing a user for de/encryption')\n }\n\n /**\n * @deprecated use {@link findContactIdsByDataOwnerPatientOpeningDate} instead.\n */\n findByHCPartyPatientSecretFKeys(\n hcPartyId: string,\n secretFKeys: string,\n planOfActionIds?: string,\n skipClosedContacts?: boolean\n ): Promise<Array<models.Contact>> {\n return super\n .findByHCPartyPatientSecretFKeys(hcPartyId, secretFKeys, planOfActionIds, skipClosedContacts)\n .then((contacts) => this.decrypt(hcPartyId, contacts))\n }\n\n /**\n * @deprecated use {@link findContactIdsByDataOwnerPatientOpeningDate} instead.\n */\n findByHCPartyPatientSecretFKeysArray(\n hcPartyId: string,\n secretFKeys: string[],\n planOfActionIds?: string,\n skipClosedContacts?: boolean\n ): Promise<Array<models.Contact> | any> {\n return super\n .findByHCPartyPatientSecretFKeysUsingPost(hcPartyId, planOfActionIds, skipClosedContacts, secretFKeys)\n .then((contacts) => this.decrypt(hcPartyId, contacts))\n }\n\n filterByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainContact\n ): Promise<PaginatedListContact | any> {\n return super\n .filterContactsBy(startDocumentId, limit, body)\n .then((ctcs) =>\n this.decrypt(user.healthcarePartyId! || user.patientId!, ctcs.rows!).then((decryptedRows) => Object.assign(ctcs, { rows: decryptedRows }))\n )\n }\n\n listContactsByOpeningDateWithUser(\n user: models.User,\n startDate: number,\n endDate: number,\n hcpartyid: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): Promise<PaginatedListContact | any> {\n return super\n .listContactsByOpeningDate(startDate, endDate, hcpartyid, startKey, startDocumentId, limit)\n .then((ctcs) =>\n this.decrypt(user.healthcarePartyId! || user.patientId!, ctcs.rows!).then((decryptedRows) => Object.assign(ctcs, { rows: decryptedRows }))\n )\n }\n\n getServiceWithUser(user: models.User, serviceId: string): Promise<Service> {\n return super\n .getService(serviceId)\n .then((service) => this.decryptServices(user.healthcarePartyId ?? user.patientId ?? user.deviceId!, [service]))\n .then((decrypted) => decrypted[0])\n }\n\n listServicesWithUser(user: models.User, serviceIds: ListOfIds): Promise<Array<Service> | any> {\n return super\n .filterServicesBy(undefined, serviceIds.ids?.length, new FilterChainService({ filter: new ServiceByIdsFilter({ ids: serviceIds.ids }) }))\n .then((paginatedList) => this.decryptServices(user.healthcarePartyId ?? user.patientId ?? user.deviceId!, paginatedList.rows ?? []))\n }\n\n findByHCPartyFormIdWithUser(user: models.User, hcPartyId: string, formId: string): Promise<Array<models.Contact> | any> {\n return super.findByHCPartyFormId(hcPartyId, formId).then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n }\n\n findByHCPartyFormIdsWithUser(user: models.User, hcPartyId: string, body: models.ListOfIds): Promise<Array<models.Contact> | any> {\n return super.findByHCPartyFormIds(hcPartyId, body).then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n }\n\n getContactWithUser(user: models.User, contactId: string): Promise<models.Contact> {\n return super\n .getContact(contactId)\n .then((ctc) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [ctc]))\n .then((ctcs) => ctcs[0])\n }\n\n getContactsWithUser(user: models.User, body?: models.ListOfIds): Promise<Array<models.Contact> | any> {\n return super.getContacts(body).then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n }\n\n async modifyContactWithUser(user: models.User, body?: models.Contact): Promise<models.Contact | any> {\n return body ? this.modifyContactAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, body) : null\n }\n\n private modifyContactAs(dataOwner: string, body: models.Contact): Promise<models.Contact> {\n return this.encryptAs(dataOwner, [_.cloneDeep(body)])\n .then((ctcs) => super.modifyContact(ctcs[0]))\n .then((ctc) => this.decrypt(dataOwner, [ctc]))\n .then((ctcs) => ctcs[0])\n }\n\n async modifyContactsWithUser(user: models.User, bodies?: Array<models.Contact>): Promise<models.Contact[] | any> {\n return bodies\n ? this.encrypt(\n user,\n bodies.map((c) => _.cloneDeep(c))\n )\n .then((ctcs) => super.modifyContacts(ctcs))\n .then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n : null\n }\n\n async createContactWithUser(user: models.User, body?: models.Contact): Promise<models.Contact | null> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((ctcs) => super.createContact(ctcs[0]))\n .then((ctc) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [ctc]))\n .then((ctcs) => ctcs[0])\n : null\n }\n\n async createContactsWithUser(user: models.User, bodies?: Array<models.Contact>): Promise<models.Contact[] | null> {\n return bodies\n ? this.encrypt(\n user,\n bodies.map((c) => _.cloneDeep(c))\n )\n .then((ctcs) => super.createContacts(ctcs))\n .then((ctcs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs))\n : null\n }\n\n encryptServices(key: CryptoKey, rawKey: string, services: Service[]): PromiseLike<Service[]> {\n return Promise.all(\n services.map(async (svc) => {\n if (\n svc.content &&\n Object.values(svc.content).every(\n (c) =>\n c.compoundValue &&\n !c.stringValue &&\n !c.documentId &&\n !c.measureValue &&\n !c.medicationValue &&\n (c.booleanValue === null || c.booleanValue === undefined) &&\n (c.numberValue === null || c.numberValue === undefined) &&\n !c.instantValue &&\n !c.fuzzyDateValue &&\n !c.binaryValue\n )\n ) {\n const recursivelyEncryptedContent = Object.fromEntries(\n await Promise.all(\n Object.entries(svc.content).map(async (p) => {\n if (p[1].compoundValue?.length) {\n return [p[0], { ...p[1], compoundValue: await this.encryptServices(key, rawKey, p[1].compoundValue!) }]\n } else return p\n })\n )\n )\n const copyWithEncryptedContent = { ...svc, content: recursivelyEncryptedContent }\n return this.serviceEncryptedFieldsNoContent\n ? encryptObject(\n copyWithEncryptedContent,\n (obj) => {\n return this.crypto.primitives.AES.encrypt(key, utf8_2ua(JSON.stringify(obj)), rawKey)\n },\n this.serviceEncryptedFieldsNoContent,\n 'service'\n )\n : copyWithEncryptedContent\n } else {\n return encryptObject(\n svc,\n (obj) => {\n return this.crypto.primitives.AES.encrypt(key, utf8_2ua(JSON.stringify(obj)), rawKey)\n },\n this.serviceEncryptedFieldsWithContent,\n 'service'\n )\n }\n })\n )\n }\n\n encrypt(user: models.User, ctcs: Array<models.Contact>) {\n return this.encryptAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, ctcs)\n }\n\n private async encryptAs(hcpartyId: string, ctcs: Array<models.Contact>): Promise<models.Contact[]> {\n const initializedContacts: models.Contact[] = []\n for (const ctc of ctcs) {\n initializedContacts.push((await this.crypto.xapi.ensureEncryptionKeysInitialised(ctc, EntityWithDelegationTypeName.Contact)) ?? ctc)\n }\n const allEncrypted = await this.crypto.xapi.doManyIncrementallyDecryptingKeys(\n initializedContacts,\n EntityWithDelegationTypeName.Contact,\n async (entity, t, keys) => {\n for (const k of keys) {\n try {\n const encrypted = new Contact(\n await encryptObject(\n {\n ...entity,\n services: entity.services ? await this.encryptServices(k.key, k.raw, entity.services) : [],\n },\n (obj) => {\n return this.crypto.primitives.AES.encrypt(k.key, utf8_2ua(JSON.stringify(obj)), k.raw)\n },\n this.contactEncryptedFields,\n EntityWithDelegationTypeName.Contact\n )\n )\n return { success: encrypted }\n } catch (e) {\n console.warn(`Failed to encrypt contact ${entity.id} with key ${k.raw}`)\n }\n }\n return null\n }\n )\n if (ctcs.length != allEncrypted.size) {\n throw new Error(`Couldn't encrypt contacts ${ctcs.flatMap((e) => (allEncrypted.has(e.id!) ? [] : [e.id!]))}`)\n }\n return ctcs.map((e) => allEncrypted.get(e.id!)!)\n }\n\n async decrypt(hcpartyId: string, ctcs: Array<models.Contact>): Promise<Array<models.Contact>> {\n return (await this.crypto.xapi.tryDecryptEntities(ctcs, EntityWithDelegationTypeName.Contact, (x) => new Contact(x))).map(({ entity }) => entity)\n }\n\n async decryptServices(hcpartyId: string, svcs: Array<models.Service>): Promise<Array<models.Service>> {\n /*TODO\n * not super efficient, re-decrypts the encryption key metadata of services multiple times, but should mostly rely\n * on cached exchange data after the first decryption and should not do any extra requests to the db.\n * We could ensure to use only cached exchange data by doing limited-size batches of services from the same contact\n * id.\n */\n return (await this.crypto.xapi.tryDecryptEntities(svcs, EntityWithDelegationTypeName.Contact, (x) => new Service(x))).map(({ entity }) => entity)\n }\n\n contactOfService(ctcs: Array<models.Contact>, svcId: string): models.Contact | undefined {\n let latestContact: models.Contact | undefined = undefined\n let latestService: models.Service\n ctcs.forEach((c) => {\n const s: models.Service | undefined = c.services!.find((it) => svcId === it.id)\n if (s && (!latestService || moment(s.valueDate).isAfter(moment(latestService.valueDate)))) {\n latestContact = c\n latestService = s\n }\n })\n return latestContact\n }\n\n filteredServices(ctcs: Array<models.Contact>, filter: any): Array<models.Service> {\n const byIds: { [key: string]: models.Service } = {}\n ctcs.forEach((c) =>\n (c.services || [])\n .filter((s) => filter(s, c))\n .forEach((s) => {\n const ps = byIds[s.id!]\n if (!ps || !ps.modified || (s.modified && ps.modified < s.modified)) {\n byIds[s.id!] = s\n s.contactId = c.id\n }\n })\n )\n return _.values(byIds).filter((s: any) => !s.deleted && !s.endOfLife)\n }\n\n //Return a promise\n filterServices(ctcs: Array<models.Contact>, filter: any): Promise<Array<models.Service>> {\n return Promise.resolve(this.filteredServices(ctcs, filter))\n }\n\n services(ctc: models.Contact, label: string) {\n return ctc.services!.filter((s) => s.label === label)\n }\n\n preferredContent(svc: models.Service, lng: string) {\n return (\n svc && svc.content && (svc.content[lng] || svc.content['fr'] || (Object.keys(svc.content)[0] ? svc.content[Object.keys(svc.content)[0]] : null))\n )\n }\n\n contentValue(c: models.Content) {\n return (\n c.stringValue ||\n ((c.numberValue || c.numberValue === 0) && c.numberValue) ||\n (c.measureValue && (c.measureValue.value || c.measureValue.value === 0) ? c.measureValue : null) ||\n c.medicationValue ||\n c.booleanValue\n )\n }\n\n shortServiceDescription(svc: models.Service, lng: string) {\n const c = this.preferredContent(svc, lng)\n return !c ? '' : this.shortContentDescription(c, lng, svc.label)\n }\n\n shortContentDescription(c: models.Content, lng: string, label?: string) {\n return (\n c.stringValue ||\n ((c.numberValue || c.numberValue === 0) && c.numberValue) ||\n (c.measureValue &&\n '' +\n (c.measureValue.value || c.measureValue.value === 0 ? c.measureValue.value : '-') +\n (c.measureValue.unit ? ' ' + c.measureValue.unit : '')) ||\n (c.medicationValue ? this.medication().medicationToString(c.medicationValue, lng) : null) ||\n (c.booleanValue && label) ||\n 'OK'\n )\n }\n\n medicationValue(svc: models.Service, lng: string) {\n const c =\n svc && svc.content && (svc.content[lng] || svc.content['fr'] || (Object.keys(svc.content)[0] ? svc.content[Object.keys(svc.content)[0]] : null))\n return c && c.medicationValue\n }\n\n contentHasData(c: any): boolean {\n return c.stringValue || c.numberValue || c.measureValue || c.booleanValue || c.booleanValue === false || c.medicationValue || c.documentId\n }\n\n localize(e: any, lng: string) {\n if (!e) {\n return null\n }\n return e[lng] || e.fr || e.en || e.nl\n }\n\n /**\n * Modifies the subcontacts this svc belongs to while minimizing the number of references to the svcs inside the subcontacts\n * After the invocation, there is at least one subcontact with provided poaId and heId that contains the svc\n * The svc is not removed from a previous subcontact it would belong to except if the new conditions are compatible\n * Note that undefined and null do not have the same meaning for formId\n * If formId is null: the subcontact which refers svc must have a null formId\n * If formId is undefined, the subcontact can have any value for formId\n *\n * When a svc does not exist yet in the current contact but exists in a previous contact, all the scs it was belonging to are\n * copied in the current contact\n *\n * the svc returned is the one that's inside the ctc\n *\n * @param ctc\n * @param user\n * @param ctcs\n * @param svc\n * @param formId\n * @param poaId aMap {heId2: [poaId11, poaId12], heId2: [poaId21] }\n * @param heId an Array of heIds, equivalent to poaIds = {heId: [], ...}\n * @param init\n * @returns {*}\n */\n\n promoteServiceInContact(\n ctc: models.Contact,\n user: models.User,\n ctcs: Array<models.Contact>,\n svc: models.Service,\n formId: string,\n poaIds?: { [key: string]: string[] },\n heIds?: Array<string>,\n init?: any\n ) {\n if (!ctc) {\n return null\n }\n const existing = ctc.services!.find((s) => s.id === svc.id)\n const promoted = _.extend(_.extend(existing || {}, svc), {\n author: user.id,\n responsible: this.dataOwnerApi.getDataOwnerIdOf(user),\n modified: new Date().getTime(),\n })\n if (!existing) {\n ;(ctc.services || (ctc.services = [])).push(promoted)\n }\n const allSubcontactsInCurrentContactContainingService = (ctc.subContacts || []).filter((csc) =>\n (csc.services || []).some((s) => s.serviceId === svc.id)\n )\n\n //Rearrange poaIds and heIds as a hierarchy\n const hierarchyOfHeAndPoaIds: { [key: string]: Array<any> } = {}\n ;(heIds || []).forEach((id) => (hierarchyOfHeAndPoaIds[id || '_'] = []))\n Object.keys(poaIds || {}).forEach((k: string) => {\n const poas = hierarchyOfHeAndPoaIds[k]\n if (poas) {\n hierarchyOfHeAndPoaIds[k] = _.concat(poas, (poaIds || {})[k])\n } else {\n hierarchyOfHeAndPoaIds[k] = (poaIds || {})[k]\n }\n })\n\n const pastCtc =\n (svc.contactId && svc.contactId !== ctc.id && ctcs.find((c) => c.id === svc.contactId)) ||\n ctcs.reduce(\n (selected: { s: models.Service | null; c: models.Contact | null }, c: models.Contact) => {\n const candidate = (c.services || []).find((s) => s.id === svc.id)\n return ctc.id !== c.id && candidate && (selected.s === null || before(selected.s.modified || 0, candidate.modified || 0))\n ? { s: candidate, c: c }\n : selected\n },\n { s: null, c: null }\n ).c\n //Make sure that all scs the svc was belonging to are copied inside the current contact\n pastCtc &&\n pastCtc\n .subContacts!.filter((psc) => psc.services!.some((s) => s.serviceId === svc.id))\n .forEach((psc) => {\n const sameInCurrent = allSubcontactsInCurrentContactContainingService.find(\n (csc) => csc.formId === psc.formId && csc.planOfActionId === psc.planOfActionId && csc.healthElementId === psc.healthElementId\n )\n if (sameInCurrent) {\n if (!sameInCurrent.services!.some((s) => s.serviceId === svc.id)) {\n sameInCurrent.services!.push({ serviceId: svc.id })\n }\n } else {\n const newSubContact = _.assign(_.assign({}, psc), {\n services: [{ serviceId: svc.id }],\n })\n ctc.subContacts!.push(newSubContact)\n allSubcontactsInCurrentContactContainingService.push(newSubContact)\n }\n })\n\n if (!Object.keys(hierarchyOfHeAndPoaIds).length) {\n hierarchyOfHeAndPoaIds._ = [] //Default is to have at least one option with heId equals to null (represented by _)\n }\n\n Object.keys(hierarchyOfHeAndPoaIds).forEach((heId: string | null) => {\n if (heId === '_') {\n heId = null\n }\n const subPoaIds = heId ? hierarchyOfHeAndPoaIds[heId] : []\n ;((subPoaIds || []).length ? subPoaIds : [null]).forEach((poaId) => {\n //Create or assign subcontacts for all pairs he/poa (can be null/null)\n let destinationSubcontact = ctc.subContacts!.find(\n (sc) =>\n (!formId || sc.formId === formId) &&\n ((!poaId && !sc.planOfActionId) || sc.planOfActionId === poaId) &&\n ((!heId && !sc.healthElementId) || sc.healthElementId === heId)\n )\n if (!destinationSubcontact) {\n ctc.subContacts!.push(\n (destinationSubcontact = new models.SubContact({\n formId: formId || undefined,\n planOfActionId: poaId,\n healthElementId: heId,\n services: [],\n }))\n )\n }\n\n const redundantSubcontact =\n allSubcontactsInCurrentContactContainingService.find((aSc) => destinationSubcontact === aSc) ||\n allSubcontactsInCurrentContactContainingService.find(\n (aSc) =>\n (!aSc.planOfActionId || aSc.planOfActionId === destinationSubcontact!.planOfActionId) &&\n (!aSc.healthElementId || aSc.healthElementId === destinationSubcontact!.healthElementId) &&\n (!aSc.formId || aSc.formId === destinationSubcontact!.formId)\n ) // Find a compatible sc: one that does not contain extra and ≠ information than the destination\n\n if (redundantSubcontact && redundantSubcontact !== destinationSubcontact) {\n redundantSubcontact.services!.splice(\n redundantSubcontact.services!.findIndex((link) => link.serviceId === svc.id),\n 1\n )\n }\n if (!destinationSubcontact.services!.some((s) => s.serviceId === svc.id)) {\n destinationSubcontact.services!.push({ serviceId: svc.id! })\n }\n })\n })\n\n return (init && init(promoted)) || promoted\n }\n\n isNumeric(svc: models.Service, lng: string) {\n const c = this.preferredContent(svc, lng)\n return c && (c.measureValue || c.numberValue || c.numberValue == 0)\n }\n\n service() {\n return {\n newInstance: (user: models.User, s: any) =>\n _.extend(\n {\n id: this.crypto.primitives.randomUuid(),\n _type: 'org.taktik.icure.entities.embed.Service',\n created: new Date().getTime(),\n modified: new Date().getTime(),\n responsible: s?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: s?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: [],\n tags: [],\n content: {},\n valueDate: parseInt(moment().format('YYYYMMDDHHmmss')),\n },\n s\n ),\n }\n }\n\n medication() {\n const regimenScores: any = {\n afterwakingup: 63000,\n beforebreakfast: 70000,\n duringbreakfast: 80000,\n afterbreakfast: 90000,\n morning: 100000,\n betweenbreakfastandlunch: 103000,\n beforelunch: 113000,\n midday: 120000,\n duringlunch: 123000,\n afterlunch: 130000,\n afternoon: 140000,\n betweenlunchanddinner: 160000,\n beforedinner: 180000,\n duringdinner: 190000,\n afterdinner: 200000,\n evening: 210000,\n betweendinnerandsleep: 213000,\n thehourofsleep: 220000,\n night: 230000,\n beforemeals: -30000,\n betweenmeals: -20000,\n aftermeals: -10000,\n }\n\n const myself = {\n regimenScores: function () {\n return regimenScores\n },\n medicationNameToString: function (m: any): string {\n return m && m.compoundPrescription\n ? m.compoundPrescription\n : m && m.substanceProduct\n ? myself.productToString(m && m.substanceProduct)\n : myself.productToString(m && m.medicinalProduct)\n },\n reimbursementReasonToString: (m: any, lang: string) => {\n return m && m.reimbursementReason && m.reimbursementReason.label && m.reimbursementReason.label.hasOwnProperty(lang)\n ? m.reimbursementReason.label[lang]\n : ''\n },\n medicationToString: (m: any, lang: string) => {\n let res = `${myself.medicationNameToString(m)}, ${myself.posologyToString(m, lang)}`\n const reason = myself.reimbursementReasonToString(m, lang)\n res = m.numberOfPackages\n ? `${m.numberOfPackages} ${m.numberOfPackages > 1 ? this.i18n[lang].packagesOf : this.i18n[lang].packageOf} ${res}`\n : res\n res = m.duration ? `${res} ${this.i18n[lang].during} ${myself.durationToString(m.duration, lang)}` : res\n res = reason ? `${res} (${reason})` : res\n return res\n },\n productToString: (m: any): string => {\n if (!m) {\n return ''\n }\n return m.intendedname\n },\n posologyToString: (m: any, lang: string) => {\n if (m) {\n if (m.instructionForPatient && m.instructionForPatient.length) {\n return m.instructionForPatient\n }\n if (!m.regimen || !m.regimen.length) {\n return ''\n }\n\n const unit =\n m.regimen[0].administratedQuantity && m.regimen[0].administratedQuantity.administrationUnit\n ? m.regimen[0].administratedQuantity.administrationUnit.code\n : m.regimen[0].administratedQuantity && m.regimen[0].administratedQuantity.unit\n let quantity = m.regimen[0].administratedQuantity && m.regimen[0].administratedQuantity.quantity\n\n m.regimen.slice(1).find((ri: any) => {\n const oUnit =\n ri.administratedQuantity && ri.administratedQuantity.administrationUnit\n ? ri.administratedQuantity.administrationUnit.code\n : ri.administratedQuantity && ri.administratedQuantity.unit\n const oQuantity = ri.administratedQuantity && ri.administratedQuantity.quantity\n\n if (oQuantity !== quantity) {\n quantity = -1\n }\n return oUnit !== unit && oQuantity !== quantity\n })\n\n const cplxRegimen = !unit || quantity < 0\n const quantityUnit = cplxRegimen ? `1 ${this.i18n[lang].take_s_}` : `${quantity} ${unit || this.i18n[lang].take_s_}`\n\n const dayPeriod = m.regimen.find((r: any) => r.weekday !== null && r.weekday !== undefined)\n ? this.i18n[lang].weekly\n : m.regimen.find((r: any) => r.date)\n ? this.i18n[lang].monthly\n : this.i18n[lang].daily\n\n return `${quantityUnit}, ${m.regimen.length} x ${dayPeriod}, ${_.sortBy(\n m.regimen,\n (r) =>\n (r.date ? r.date * 1000000 : 29990000000000) +\n (r.dayNumber || 0) * 1000000 +\n ((r.weekday && r.weekday.weekNumber) || 0) * 7 * 1000000 +\n (r.timeOfDay ? r.timeOfDay : r.dayPeriod && r.dayPeriod.code ? (regimenScores[r.dayPeriod.code] as number) : 0)\n )\n .map((r) => (cplxRegimen ? myself.regimenToExtString(r, lang) : myself.regimenToString(r, lang)))\n .join(', ')}`\n }\n },\n frequencyToString: (m: any, lang: string) => {\n if (m.instructionForPatient && m.instructionForPatient.length) {\n return m.instructionForPatient\n }\n if (!m.regimen || !m.regimen.length) {\n return ''\n }\n\n const dayPeriod = m.regimen.find((r: any) => r.weekday !== null && r.weekday !== undefined)\n ? this.i18n[lang].weekly\n : m.regimen.find((r: any) => r.date)\n ? this.i18n[lang].monthly\n : this.i18n[lang].daily\n\n return `${m.regimen.length} x ${dayPeriod}`\n },\n durationToString: (d: models.Duration, lang: string) => {\n return d.value ? `${d.value} ${this.localize(d.unit!.label, lang)}` : ''\n },\n regimenToExtString: (r: models.RegimenItem, lang: string) => {\n const desc = myself.regimenToString(r, lang)\n return (\n (r.administratedQuantity && r.administratedQuantity.quantity && desc\n ? `${desc} (${r.administratedQuantity.quantity} ${\n (r.administratedQuantity.administrationUnit ? r.administratedQuantity.administrationUnit.code : r.administratedQuantity.unit) ||\n this.i18n[lang].take_s_\n })`\n : desc) || ''\n )\n },\n regimenToString: (r: models.RegimenItem, lang: string) => {\n let res = r.date\n ? `${this.i18n[lang].the} ${moment(r.date).format('DD/MM/YYYY')}`\n : r.dayNumber\n ? `${this.i18n[lang].onDay} ${r.dayNumber}`\n : r.weekday && r.weekday.weekday\n ? `${this.i18n[lang].on} ${r.weekday.weekday}`\n : null\n if (r.dayPeriod && r.dayPeriod.code && r.dayPeriod.code.length) {\n res = res\n ? `${res} ${this.i18n[lang][r.dayPeriod.code] || this.localize(r.dayPeriod.label, lang) || r.dayPeriod.code}`\n : this.i18n[lang][r.dayPeriod.code] || this.localize(r.dayPeriod.label, lang) || r.dayPeriod.code\n }\n if (r.timeOfDay) {\n const timeOfDay =\n r.timeOfDay === 120000\n ? this.i18n[lang].noon\n : `${Math.floor(r.timeOfDay / 10000)}:${('' + (Math.floor(r.timeOfDay / 100) % 100)).replace(/^(.)$/, '0$1')}`\n res = res ? res + ' ' + this.i18n[lang].at + ' ' + timeOfDay : timeOfDay\n }\n return res\n },\n localize: (s: any, lang: string) => {\n if (!s) {\n return s\n }\n return (\n this.i18n[lang][s] ||\n (this.i18n[lang][s.toLowerCase()] &&\n this.i18n[lang][s.toLowerCase()]\n .split('')\n .map((c: string, idx: number) => (idx >= s.length || s[idx].toLocaleLowerCase() === s[idx] ? c : c.toLocaleUpperCase()))\n .join('')) ||\n s\n ) //Applies the (lower/upper)case to the translated lowercase version of the input string (s)\n },\n }\n return myself\n }\n\n /**\n * @param contact a contact\n * @return the id of the patient that the contact refers to, retrieved from the encrypted metadata. Normally there should only be one element\n * in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(contact: models.Contact): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: contact, type: EntityWithDelegationTypeName.Contact }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given contact\n */\n async hasWriteAccess(contact: models.Contact): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: contact, type: EntityWithDelegationTypeName.Contact })\n }\n\n /**\n * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param delegateId the id of the data owner which will be granted access to the contact.\n * @param contact the contact to share.\n * @param options optional parameters to customize the sharing behaviour:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * contact does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWith(\n delegateId: string,\n contact: models.Contact,\n options: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Contact> {\n return this.shareWithMany(contact, { [delegateId]: options })\n }\n\n /**\n * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param contact the contact to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * contact does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWithMany(\n contact: models.Contact,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Contact> {\n return (await this.tryShareWithMany(contact, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing contact with other data owners, allowing them to access the non-encrypted data of the contact and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param contact the contact to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * contact does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this contact refers to should be shared with the delegate (defaults to\n * {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return a promise which will contain the result of the operation: the updated entity if the operation was successful or details of the error if\n * the operation failed.\n */\n async tryShareWithMany(\n contact: models.Contact,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.Contact>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(contact, EntityWithDelegationTypeName.Contact)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyContactAs(self, entityWithEncryptionKey) : contact\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.Contact,\n },\n Object.fromEntries(\n Object.entries(delegates).map(([delegateId, options]) => [\n delegateId,\n {\n requestedPermissions: options.requestedPermissions,\n shareEncryptionKeys: options.shareEncryptionKey,\n shareOwningEntityIds: options.sharePatientId,\n shareSecretIds: options.shareSecretIds,\n },\n ])\n ),\n (x) => this.bulkShareContacts(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: models.Contact\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.Contact })\n }\n\n getEncryptionKeysOf(entity: models.Contact): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.Contact }, undefined)\n }\n\n async subscribeToServiceEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Service> | undefined,\n eventFired: (dataSample: Service) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n const currentUser = await this.userApi.getCurrentUser()\n return subscribeToEntityEvents(\n this.host,\n this.authApi,\n 'Service',\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted: Service) => (await this.decryptServices(currentUser.healthcarePartyId!, [encrypted]))[0]\n ).then((ws) => new ConnectionImpl(ws))\n }\n\n async subscribeToContactEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Contact> | undefined,\n eventFired: (dataSample: Contact) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n const currentUser = await this.userApi.getCurrentUser()\n return subscribeToEntityEvents(\n this.host,\n this.authApi,\n EntityWithDelegationTypeName.Contact,\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted: Contact) => (await this.decrypt(currentUser.healthcarePartyId!, [encrypted]))[0]\n ).then((ws) => new ConnectionImpl(ws))\n }\n\n createDelegationDeAnonymizationMetadata(entity: Contact, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: EntityWithDelegationTypeName.Contact }, delegates)\n }\n}\n"]}
|
|
@@ -46,8 +46,8 @@ export declare class IccDocumentXApi extends IccDocumentApi implements Encrypted
|
|
|
46
46
|
* - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
|
|
47
47
|
* auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with
|
|
48
48
|
* auto-delegations, in such case the access level specified here will be used.
|
|
49
|
-
* -
|
|
50
|
-
*
|
|
49
|
+
* - sfkOption: specifies which sfk of the owning entity to use.
|
|
50
|
+
* - ignoreAutoDelegations: if true the data won't be shared with the autodelegations of the user, but only with additional delegates
|
|
51
51
|
* - alternateRootDelegation: by default a new entity is created with a root delegation from self to self. In keyless mode this is not possible,
|
|
52
52
|
* and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.
|
|
53
53
|
* @return a new instance of document.
|
|
@@ -57,6 +57,7 @@ export declare class IccDocumentXApi extends IccDocumentApi implements Encrypted
|
|
|
57
57
|
[dataOwnerId: string]: AccessLevelEnum;
|
|
58
58
|
};
|
|
59
59
|
sfkOption?: SecretIdUseOption;
|
|
60
|
+
ignoreAutoDelegations?: boolean;
|
|
60
61
|
alternateRootDelegation?: string;
|
|
61
62
|
}): Promise<models.Document>;
|
|
62
63
|
/**
|
|
@@ -437,8 +437,8 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
|
|
|
437
437
|
* - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
|
|
438
438
|
* auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with
|
|
439
439
|
* auto-delegations, in such case the access level specified here will be used.
|
|
440
|
-
* -
|
|
441
|
-
*
|
|
440
|
+
* - sfkOption: specifies which sfk of the owning entity to use.
|
|
441
|
+
* - ignoreAutoDelegations: if true the data won't be shared with the autodelegations of the user, but only with additional delegates
|
|
442
442
|
* - alternateRootDelegation: by default a new entity is created with a root delegation from self to self. In keyless mode this is not possible,
|
|
443
443
|
* and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.
|
|
444
444
|
* @return a new instance of document.
|
|
@@ -453,7 +453,9 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
|
|
|
453
453
|
const sfk = message
|
|
454
454
|
? yield this.crypto.xapi.resolveSecretIdUseOptions({ entity: message, type: utils_1.EntityWithDelegationTypeName.Message }, (_h = options.sfkOption) !== null && _h !== void 0 ? _h : SecretIdUseOption_1.SecretIdUseOption.UseAnySharedWithParent)
|
|
455
455
|
: [];
|
|
456
|
-
const extraDelegations = Object.assign(Object.assign({},
|
|
456
|
+
const extraDelegations = Object.assign(Object.assign({}, (options.ignoreAutoDelegations == true
|
|
457
|
+
? Object.fromEntries([...((_k = (_j = user.autoDelegations) === null || _j === void 0 ? void 0 : _j.all) !== null && _k !== void 0 ? _k : []), ...((_m = (_l = user.autoDelegations) === null || _l === void 0 ? void 0 : _l.medicalInformation) !== null && _m !== void 0 ? _m : [])].map((d) => [d, AccessLevelEnum.WRITE]))
|
|
458
|
+
: {})), ((_o = options === null || options === void 0 ? void 0 : options.additionalDelegates) !== null && _o !== void 0 ? _o : {}));
|
|
457
459
|
return new models.Document(yield this.crypto.xapi
|
|
458
460
|
.entityWithInitialisedEncryptedMetadata(document, utils_1.EntityWithDelegationTypeName.Document, message === null || message === void 0 ? void 0 : message.id, sfk, true, extraDelegations, options.alternateRootDelegation)
|
|
459
461
|
.then((x) => x.updatedEntity));
|