@icure/api 8.8.0 → 8.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/icc-api/api/IccAccesslogApi.d.ts +48 -0
- package/icc-api/api/IccAccesslogApi.js +100 -0
- package/icc-api/api/IccAccesslogApi.js.map +1 -1
- package/icc-api/api/IccAgendaApi.d.ts +25 -0
- package/icc-api/api/IccAgendaApi.js +49 -0
- package/icc-api/api/IccAgendaApi.js.map +1 -1
- package/icc-api/api/IccCalendarItemApi.d.ts +25 -0
- package/icc-api/api/IccCalendarItemApi.js +49 -0
- package/icc-api/api/IccCalendarItemApi.js.map +1 -1
- package/icc-api/api/IccCalendarItemTypeApi.d.ts +25 -0
- package/icc-api/api/IccCalendarItemTypeApi.js +49 -0
- package/icc-api/api/IccCalendarItemTypeApi.js.map +1 -1
- package/icc-api/api/IccCodeApi.d.ts +25 -0
- package/icc-api/api/IccCodeApi.js +49 -0
- package/icc-api/api/IccCodeApi.js.map +1 -1
- package/icc-api/api/IccContactApi.d.ts +48 -0
- package/icc-api/api/IccContactApi.js +100 -0
- package/icc-api/api/IccContactApi.js.map +1 -1
- package/icc-api/api/IccDeviceApi.d.ts +48 -0
- package/icc-api/api/IccDeviceApi.js +100 -0
- package/icc-api/api/IccDeviceApi.js.map +1 -1
- package/icc-api/api/IccDocumentApi.d.ts +48 -0
- package/icc-api/api/IccDocumentApi.js +100 -0
- package/icc-api/api/IccDocumentApi.js.map +1 -1
- package/icc-api/api/IccFormApi.d.ts +48 -0
- package/icc-api/api/IccFormApi.js +101 -4
- package/icc-api/api/IccFormApi.js.map +1 -1
- package/icc-api/api/IccHcpartyApi.d.ts +48 -0
- package/icc-api/api/IccHcpartyApi.js +100 -0
- package/icc-api/api/IccHcpartyApi.js.map +1 -1
- package/icc-api/api/IccHelementApi.d.ts +48 -0
- package/icc-api/api/IccHelementApi.js +100 -0
- package/icc-api/api/IccHelementApi.js.map +1 -1
- package/icc-api/api/IccInsuranceApi.d.ts +50 -2
- package/icc-api/api/IccInsuranceApi.js +100 -0
- package/icc-api/api/IccInsuranceApi.js.map +1 -1
- package/icc-api/api/IccInvoiceApi.d.ts +48 -0
- package/icc-api/api/IccInvoiceApi.js +100 -0
- package/icc-api/api/IccInvoiceApi.js.map +1 -1
- package/icc-api/api/IccMessageApi.d.ts +48 -0
- package/icc-api/api/IccMessageApi.js +100 -0
- package/icc-api/api/IccMessageApi.js.map +1 -1
- package/icc-api/api/IccPatientApi.d.ts +48 -0
- package/icc-api/api/IccPatientApi.js +100 -0
- package/icc-api/api/IccPatientApi.js.map +1 -1
- package/icc-api/api/IccPlaceApi.d.ts +25 -0
- package/icc-api/api/IccPlaceApi.js +49 -0
- package/icc-api/api/IccPlaceApi.js.map +1 -1
- package/icc-api/api/IccReceiptApi.d.ts +25 -0
- package/icc-api/api/IccReceiptApi.js +49 -0
- package/icc-api/api/IccReceiptApi.js.map +1 -1
- package/icc-api/api/IccTopicApi.d.ts +48 -0
- package/icc-api/api/IccTopicApi.js +100 -0
- package/icc-api/api/IccTopicApi.js.map +1 -1
- package/icc-api/api/IccUserApi.d.ts +25 -0
- package/icc-api/api/IccUserApi.js +49 -0
- package/icc-api/api/IccUserApi.js.map +1 -1
- package/icc-api/model/ConflictResolutionRequest.d.ts +18 -0
- package/icc-api/model/ConflictResolutionRequest.js +17 -0
- package/icc-api/model/ConflictResolutionRequest.js.map +1 -0
- package/icc-api/model/ConflictResolutionResult.d.ts +22 -0
- package/icc-api/model/ConflictResolutionResult.js +24 -0
- package/icc-api/model/ConflictResolutionResult.js.map +1 -0
- package/icc-api/model/models.d.ts +2 -0
- package/icc-api/model/models.js +2 -0
- package/icc-api/model/models.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.d.ts +31 -0
- package/icc-x-api/icc-accesslog-x-api.js +57 -0
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +15 -0
- package/icc-x-api/icc-calendar-item-x-api.js +28 -0
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +31 -0
- package/icc-x-api/icc-contact-x-api.js +60 -1
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +31 -0
- package/icc-x-api/icc-document-x-api.js +64 -0
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +31 -0
- package/icc-x-api/icc-form-x-api.js +58 -0
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +31 -0
- package/icc-x-api/icc-helement-x-api.js +57 -0
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.d.ts +31 -0
- package/icc-x-api/icc-invoice-x-api.js +58 -0
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.d.ts +31 -0
- package/icc-x-api/icc-message-x-api.js +64 -0
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +31 -0
- package/icc-x-api/icc-patient-x-api.js +57 -0
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-topic-x-api.d.ts +31 -0
- package/icc-x-api/icc-topic-x-api.js +58 -0
- package/icc-x-api/icc-topic-x-api.js.map +1 -1
- package/icc-x-api/utils/formatting-util.d.ts +10 -4
- package/icc-x-api/utils/formatting-util.js +47 -6
- package/icc-x-api/utils/formatting-util.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,uCAA2F;AAC3F,+DAAoE;AACpE,kDAAiD;AACjD,oDAAqG;AAErG,uDAA+C;AAC/C,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C,MAAM,CAAC,0BAA0B,CAAC,iCAAiC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAA;IACpJ,CAAC;CACF;AA13CD,wCA03CC","sourcesContent":["import { IccAuthApi, IccContactApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport i18n from './rsrc/contact.i18n'\n\nimport { format as formatDate, isAfter as isDateAfter, parse as parseDate } from 'date-fns'\nimport { cloneDeep, uniqBy, sortBy } from './utils/collection-utils'\nimport * as models from '../icc-api/model/models'\nimport { Contact, FilterChainService, ListOfIds, Service, TimingInfo } 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(formatDate(new Date(), '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, [...new Set(extractedKeys)])\n : this.findByHCPartyPatientSecretFKeys(hcpartyId, [...new Set(extractedKeys)].join(','))\n )\n ).then((results) => uniqBy(results.flat(), (x) => x.id))\n : Promise.resolve([])\n )\n }\n\n /**\n * Same as {@link findBy} 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) => [...new Set(results.flat())])\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 (\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 ).flat(),\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 /**\n * Filters contacts using a filter chain and decrypts the results for the given user.\n * @param user the user for decryption\n * @param startDocumentId optional document id to start pagination from\n * @param limit maximum number of results to return\n * @param body the filter chain to apply\n * @param collectTiming add timing information to the response\n * @return a paginated list of decrypted contacts\n */\n filterByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainContact,\n collectTiming?: false\n ): Promise<PaginatedListContact | any>\n filterByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainContact,\n collectTiming?: true\n ): Promise<(PaginatedListContact & TimingInfo) | any>\n filterByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainContact,\n collectTiming: boolean = false\n ): Promise<PaginatedListContact | any> {\n return super\n .filterContactsBy(startDocumentId, limit, body, collectTiming as any)\n .then((ctcs) =>\n this.decrypt(user.healthcarePartyId! || user.patientId!, ctcs.rows!).then((decryptedRows) => Object.assign(ctcs, { rows: decryptedRows }))\n )\n }\n\n /**\n * Filters services using a filter chain and decrypts the results for the given user.\n * @param user the user for decryption\n * @param startDocumentId optional document id to start pagination from\n * @param limit maximum number of results to return\n * @param body the filter chain to apply\n * @param collectTiming add timing information to the response\n * @return a paginated list of decrypted services\n */\n filterServicesByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainService,\n collectTiming?: false\n ): Promise<PaginatedListContact | any>\n filterServicesByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainService,\n collectTiming?: true\n ): Promise<(PaginatedListContact & TimingInfo) | any>\n filterServicesByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainService,\n collectTiming: boolean = false\n ): Promise<PaginatedListContact | any> {\n return super\n .filterServicesBy(startDocumentId, limit, body, collectTiming as any)\n .then((svcs) =>\n this.decryptServices(user.healthcarePartyId! || user.patientId!, svcs.rows!).then((decryptedRows) => Object.assign(svcs, { rows: decryptedRows }))\n )\n }\n\n /**\n * Lists contacts by opening date within a date range and decrypts the results for the given user.\n * @param user the user for decryption\n * @param startDate start of the date range (format: YYYYMMDDHHmmss)\n * @param endDate end of the date range (format: YYYYMMDDHHmmss)\n * @param hcpartyid the healthcare party id\n * @param startKey optional start key for pagination\n * @param startDocumentId optional document id to start pagination from\n * @param limit maximum number of results to return\n * @return a paginated list of decrypted contacts\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 /**\n * Gets a service by id and decrypts it for the given user.\n * @param user the user for decryption\n * @param serviceId the service id\n * @return the decrypted service\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 /**\n * Lists services by their ids and decrypts them for the given user.\n * @param user the user for decryption\n * @param serviceIds the list of service ids to retrieve\n * @return an array of decrypted services\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 /**\n * Finds contacts by healthcare party and form id and decrypts them for the given user.\n * @param user the user for decryption\n * @param hcPartyId the healthcare party id\n * @param formId the form id\n * @return an array of decrypted contacts\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 /**\n * Finds contacts by healthcare party and multiple form ids and decrypts them for the given user.\n * @param user the user for decryption\n * @param hcPartyId the healthcare party id\n * @param body the list of form ids\n * @return an array of decrypted contacts\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 /**\n * Gets a contact by id and decrypts it for the given user.\n * @param user the user for decryption\n * @param contactId the contact id\n * @return the decrypted contact\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 /**\n * Gets multiple contacts by their ids and decrypts them for the given user.\n * @param user the user for decryption\n * @param body the list of contact ids\n * @return an array of decrypted contacts\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 /**\n * Modifies an existing contact by encrypting it and saving it to the database.\n * @param user the user for encryption\n * @param body the contact to modify\n * @return the modified and decrypted contact\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 /**\n * Modifies multiple existing contacts by encrypting them and saving them to the database.\n * @param user the user for encryption\n * @param bodies the array of contacts to modify\n * @return an array of modified and decrypted contacts\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 /**\n * Creates a new contact by encrypting it and saving it to the database.\n * @param user the user for encryption\n * @param body the contact to create\n * @return the created and decrypted contact\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 /**\n * Creates multiple new contacts by encrypting them and saving them to the database.\n * @param user the user for encryption\n * @param bodies the array of contacts to create\n * @return an array of created and decrypted contacts\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 /**\n * Encrypts the content and custom encrypted fields of services.\n * Services with compound values are recursively encrypted.\n * @param key the encryption key\n * @param rawKey the raw encryption key as a string\n * @param services the array of services to encrypt\n * @return a promise containing the encrypted services\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 (encryptedSelf) => this.crypto.xapi.tryDecryptJson([{ key, raw: rawKey }], encryptedSelf, false),\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 (encryptedSelf) => this.crypto.xapi.tryDecryptJson([{ key, raw: rawKey }], encryptedSelf, false),\n this.serviceEncryptedFieldsWithContent,\n 'service'\n )\n }\n })\n )\n }\n\n /**\n * Encrypts contacts for the given user including all services within the contacts.\n * @param user the user for encryption\n * @param ctcs the array of contacts to encrypt\n * @return a promise containing the encrypted contacts\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 (encryptedSelf) => this.crypto.xapi.tryDecryptJson(keys, encryptedSelf, false),\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 /**\n * Decrypts contacts and all their encrypted content.\n * @param hcpartyId the healthcare party id (deprecated parameter, kept for compatibility)\n * @param ctcs the array of encrypted contacts\n * @return a promise containing the decrypted contacts\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 /**\n * Decrypts services and all their encrypted content.\n * @param hcpartyId the healthcare party id (deprecated parameter, kept for compatibility)\n * @param svcs the array of encrypted services\n * @return a promise containing the decrypted services\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 /**\n * Finds the contact containing the given service id, prioritizing the latest version by valueDate.\n * @param ctcs the array of contacts to search\n * @param svcId the service id to find\n * @return the contact containing the service or undefined if not found\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 || isDateAfter(parseDate('' + s.valueDate, 'yyyyMMddHHmmss', new Date()), parseDate('' + latestService.valueDate, 'yyyyMMddHHmmss', new Date())))) {\n latestContact = c\n latestService = s\n }\n })\n return latestContact\n }\n\n /**\n * Extracts and filters services from contacts, keeping only the latest version of each service and excluding deleted services.\n * @param ctcs the array of contacts containing services\n * @param filter a predicate function to filter services: (service, contact) => boolean\n * @return an array of filtered services with contactId set\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 Object.values(byIds).filter((s: any) => !s.deleted && !s.endOfLife)\n }\n\n /**\n * Extracts and filters services from contacts, returning a promise. Same as filteredServices but wrapped in a promise.\n * @param ctcs the array of contacts containing services\n * @param filter a predicate function to filter services: (service, contact) => boolean\n * @return a promise containing an array of filtered services\n */\n filterServices(ctcs: Array<models.Contact>, filter: any): Promise<Array<models.Service>> {\n return Promise.resolve(this.filteredServices(ctcs, filter))\n }\n\n /**\n * Gets all services from a contact that have the specified label.\n * @param ctc the contact\n * @param label the service label to filter by\n * @return an array of services with the given label\n */\n services(ctc: models.Contact, label: string) {\n return ctc.services!.filter((s) => s.label === label)\n }\n\n /**\n * Gets the preferred content for a service based on language preference, falling back to French then first available language.\n * @param svc the service\n * @param lng the preferred language code\n * @return the content in the preferred language or null if no content exists\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 /**\n * Extracts the value from content, prioritizing string, number, measure, medication, and boolean values in that order.\n * @param c the content\n * @return the extracted value or undefined if no value is present\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 /**\n * Gets a short human-readable description of a service in the preferred language.\n * @param svc the service\n * @param lng the preferred language code\n * @return a short description of the service content or empty string\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 /**\n * Gets a short human-readable description of content, formatted appropriately for the content type.\n * @param c the content\n * @param lng the language code for medication formatting\n * @param label optional label used for boolean content display\n * @return a short description of the content\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 /**\n * Extracts the medication value from a service's content in the preferred language.\n * @param svc the service\n * @param lng the preferred language code\n * @return the medication value or undefined if not present\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 /**\n * Checks if content has any data value set (string, number, measure, boolean, medication, or document).\n * @param c the content to check\n * @return true if content has data, false otherwise\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 /**\n * Localizes a value by selecting the appropriate language from an object, falling back through FR, EN, and NL.\n * @param e the object with language-keyed values or a simple value\n * @param lng the preferred language code\n * @return the localized value or null if e is null/undefined\n */\n localize(e: any, lng: string) {\n if (!e) {\n return null\n }\n return e[lng] || e.fr || e.FR || e.en || e.EN || e.nl || 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 = Object.assign(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] = [...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 = { ...psc, services: [{ serviceId: svc.id }] }\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 /**\n * Checks if a service has numeric content (measure or number value) in the preferred language.\n * @param svc the service\n * @param lng the preferred language code\n * @return true if the service has numeric content, false otherwise\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 /**\n * Returns utility functions for working with services.\n * @return an object with helper methods for creating and manipulating services\n */\n service() {\n return {\n newInstance: (user: models.User, s: any) => ({\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(formatDate(new Date(), 'yyyyMMddHHmmss')),\n ...s,\n }),\n }\n }\n\n /**\n * Returns utility functions for working with medication content.\n * @return an object with helper methods for formatting and displaying medication information\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: any) =>\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} ${formatDate(r.date, '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 * @param service a service\n * @return the id of the patient that the service 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 decryptPatientIdOfService(service: models.Service): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: service, 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 /**\n * Gets the data owners that have access to the contact and their permission levels.\n * @param entity the contact\n * @return a promise containing the permissions by data owner id and whether there are unknown anonymous data owners\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 /**\n * Gets all encryption keys available for the contact.\n * @param entity the contact\n * @return a promise containing an array of encryption key hex strings\n */\n getEncryptionKeysOf(entity: models.Contact): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.Contact }, undefined)\n }\n\n /**\n * Subscribes to service events (create, update, delete) and receives decrypted services.\n * @param eventTypes the types of events to subscribe to\n * @param filter optional filter to apply to services\n * @param eventFired callback function invoked when an event occurs, receives the decrypted service\n * @param options optional subscription options\n * @return a connection that can be closed to unsubscribe\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 /**\n * Subscribes to contact events (create, update, delete) and receives decrypted contacts.\n * @param eventTypes the types of events to subscribe to\n * @param filter optional filter to apply to contacts\n * @param eventFired callback function invoked when an event occurs, receives the decrypted contact\n * @param options optional subscription options\n * @return a connection that can be closed to unsubscribe\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 /**\n * Creates or updates de-anonymization metadata for delegations in a contact.\n * @param entity the contact\n * @param delegates the array of delegate ids to create de-anonymization metadata for\n * @return a promise that completes when the metadata is created/updated\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,uCAA2F;AAC3F,+DAAoE;AACpE,kDAAiD;AACjD,oDAAqG;AAErG,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,CAA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C,IAAA,4BAAS,EAAC,OAAO,CAAC,QAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/E,MAAM,MAAM,GAAG,MAAM,OAAM,4BAA4B,YAAC,OAAO,kCAAO,OAAO,KAAE,QAAQ,EAAE,SAAS,IAAG,CAAA;YACrG,IAAI,MAAM,CAAC,QAAQ;gBAAE,MAAM,CAAC,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YAC3H,OAAO,MAAM,CAAA;QACf,CAAC;KAAA;CACF;AA37CD,wCA27CC","sourcesContent":["import { IccAuthApi, IccContactApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport i18n from './rsrc/contact.i18n'\n\nimport { format as formatDate, isAfter as isDateAfter, parse as parseDate } from 'date-fns'\nimport { cloneDeep, uniqBy, sortBy } from './utils/collection-utils'\nimport * as models from '../icc-api/model/models'\nimport { Contact, FilterChainService, ListOfIds, Service, TimingInfo } 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(formatDate(new Date(), '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, [...new Set(extractedKeys)])\n : this.findByHCPartyPatientSecretFKeys(hcpartyId, [...new Set(extractedKeys)].join(','))\n )\n ).then((results) => uniqBy(results.flat(), (x) => x.id))\n : Promise.resolve([])\n )\n }\n\n /**\n * Same as {@link findBy} 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) => [...new Set(results.flat())])\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 (\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 ).flat(),\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 /**\n * Filters contacts using a filter chain and decrypts the results for the given user.\n * @param user the user for decryption\n * @param startDocumentId optional document id to start pagination from\n * @param limit maximum number of results to return\n * @param body the filter chain to apply\n * @param collectTiming add timing information to the response\n * @return a paginated list of decrypted contacts\n */\n filterByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainContact,\n collectTiming?: false\n ): Promise<PaginatedListContact | any>\n filterByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainContact,\n collectTiming?: true\n ): Promise<(PaginatedListContact & TimingInfo) | any>\n filterByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainContact,\n collectTiming: boolean = false\n ): Promise<PaginatedListContact | any> {\n return super\n .filterContactsBy(startDocumentId, limit, body, collectTiming as any)\n .then((ctcs) =>\n this.decrypt(user.healthcarePartyId! || user.patientId!, ctcs.rows!).then((decryptedRows) => Object.assign(ctcs, { rows: decryptedRows }))\n )\n }\n\n /**\n * Filters services using a filter chain and decrypts the results for the given user.\n * @param user the user for decryption\n * @param startDocumentId optional document id to start pagination from\n * @param limit maximum number of results to return\n * @param body the filter chain to apply\n * @param collectTiming add timing information to the response\n * @return a paginated list of decrypted services\n */\n filterServicesByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainService,\n collectTiming?: false\n ): Promise<PaginatedListContact | any>\n filterServicesByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainService,\n collectTiming?: true\n ): Promise<(PaginatedListContact & TimingInfo) | any>\n filterServicesByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainService,\n collectTiming: boolean = false\n ): Promise<PaginatedListContact | any> {\n return super\n .filterServicesBy(startDocumentId, limit, body, collectTiming as any)\n .then((svcs) =>\n this.decryptServices(user.healthcarePartyId! || user.patientId!, svcs.rows!).then((decryptedRows) =>\n Object.assign(svcs, { rows: decryptedRows })\n )\n )\n }\n\n /**\n * Lists contacts by opening date within a date range and decrypts the results for the given user.\n * @param user the user for decryption\n * @param startDate start of the date range (format: YYYYMMDDHHmmss)\n * @param endDate end of the date range (format: YYYYMMDDHHmmss)\n * @param hcpartyid the healthcare party id\n * @param startKey optional start key for pagination\n * @param startDocumentId optional document id to start pagination from\n * @param limit maximum number of results to return\n * @return a paginated list of decrypted contacts\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 /**\n * Gets a service by id and decrypts it for the given user.\n * @param user the user for decryption\n * @param serviceId the service id\n * @return the decrypted service\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 /**\n * Lists services by their ids and decrypts them for the given user.\n * @param user the user for decryption\n * @param serviceIds the list of service ids to retrieve\n * @return an array of decrypted services\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 /**\n * Finds contacts by healthcare party and form id and decrypts them for the given user.\n * @param user the user for decryption\n * @param hcPartyId the healthcare party id\n * @param formId the form id\n * @return an array of decrypted contacts\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 /**\n * Finds contacts by healthcare party and multiple form ids and decrypts them for the given user.\n * @param user the user for decryption\n * @param hcPartyId the healthcare party id\n * @param body the list of form ids\n * @return an array of decrypted contacts\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 /**\n * Gets a contact by id and decrypts it for the given user.\n * @param user the user for decryption\n * @param contactId the contact id\n * @return the decrypted contact\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 /**\n * Gets multiple contacts by their ids and decrypts them for the given user.\n * @param user the user for decryption\n * @param body the list of contact ids\n * @return an array of decrypted contacts\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 /**\n * Modifies an existing contact by encrypting it and saving it to the database.\n * @param user the user for encryption\n * @param body the contact to modify\n * @return the modified and decrypted contact\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 /**\n * Modifies multiple existing contacts by encrypting them and saving them to the database.\n * @param user the user for encryption\n * @param bodies the array of contacts to modify\n * @return an array of modified and decrypted contacts\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 /**\n * Creates a new contact by encrypting it and saving it to the database.\n * @param user the user for encryption\n * @param body the contact to create\n * @return the created and decrypted contact\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 /**\n * Creates multiple new contacts by encrypting them and saving them to the database.\n * @param user the user for encryption\n * @param bodies the array of contacts to create\n * @return an array of created and decrypted contacts\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 /**\n * Encrypts the content and custom encrypted fields of services.\n * Services with compound values are recursively encrypted.\n * @param key the encryption key\n * @param rawKey the raw encryption key as a string\n * @param services the array of services to encrypt\n * @return a promise containing the encrypted services\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 (encryptedSelf) => this.crypto.xapi.tryDecryptJson([{ key, raw: rawKey }], encryptedSelf, false),\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 (encryptedSelf) => this.crypto.xapi.tryDecryptJson([{ key, raw: rawKey }], encryptedSelf, false),\n this.serviceEncryptedFieldsWithContent,\n 'service'\n )\n }\n })\n )\n }\n\n /**\n * Encrypts contacts for the given user including all services within the contacts.\n * @param user the user for encryption\n * @param ctcs the array of contacts to encrypt\n * @return a promise containing the encrypted contacts\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 (encryptedSelf) => this.crypto.xapi.tryDecryptJson(keys, encryptedSelf, false),\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 /**\n * Decrypts contacts and all their encrypted content.\n * @param hcpartyId the healthcare party id (deprecated parameter, kept for compatibility)\n * @param ctcs the array of encrypted contacts\n * @return a promise containing the decrypted contacts\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 /**\n * Decrypts services and all their encrypted content.\n * @param hcpartyId the healthcare party id (deprecated parameter, kept for compatibility)\n * @param svcs the array of encrypted services\n * @return a promise containing the decrypted services\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 /**\n * Finds the contact containing the given service id, prioritizing the latest version by valueDate.\n * @param ctcs the array of contacts to search\n * @param svcId the service id to find\n * @return the contact containing the service or undefined if not found\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 (\n s &&\n (!latestService ||\n isDateAfter(\n parseDate('' + s.valueDate, 'yyyyMMddHHmmss', new Date()),\n parseDate('' + latestService.valueDate, 'yyyyMMddHHmmss', new Date())\n ))\n ) {\n latestContact = c\n latestService = s\n }\n })\n return latestContact\n }\n\n /**\n * Extracts and filters services from contacts, keeping only the latest version of each service and excluding deleted services.\n * @param ctcs the array of contacts containing services\n * @param filter a predicate function to filter services: (service, contact) => boolean\n * @return an array of filtered services with contactId set\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 Object.values(byIds).filter((s: any) => !s.deleted && !s.endOfLife)\n }\n\n /**\n * Extracts and filters services from contacts, returning a promise. Same as filteredServices but wrapped in a promise.\n * @param ctcs the array of contacts containing services\n * @param filter a predicate function to filter services: (service, contact) => boolean\n * @return a promise containing an array of filtered services\n */\n filterServices(ctcs: Array<models.Contact>, filter: any): Promise<Array<models.Service>> {\n return Promise.resolve(this.filteredServices(ctcs, filter))\n }\n\n /**\n * Gets all services from a contact that have the specified label.\n * @param ctc the contact\n * @param label the service label to filter by\n * @return an array of services with the given label\n */\n services(ctc: models.Contact, label: string) {\n return ctc.services!.filter((s) => s.label === label)\n }\n\n /**\n * Gets the preferred content for a service based on language preference, falling back to French then first available language.\n * @param svc the service\n * @param lng the preferred language code\n * @return the content in the preferred language or null if no content exists\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 /**\n * Extracts the value from content, prioritizing string, number, measure, medication, and boolean values in that order.\n * @param c the content\n * @return the extracted value or undefined if no value is present\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 /**\n * Gets a short human-readable description of a service in the preferred language.\n * @param svc the service\n * @param lng the preferred language code\n * @return a short description of the service content or empty string\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 /**\n * Gets a short human-readable description of content, formatted appropriately for the content type.\n * @param c the content\n * @param lng the language code for medication formatting\n * @param label optional label used for boolean content display\n * @return a short description of the content\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 /**\n * Extracts the medication value from a service's content in the preferred language.\n * @param svc the service\n * @param lng the preferred language code\n * @return the medication value or undefined if not present\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 /**\n * Checks if content has any data value set (string, number, measure, boolean, medication, or document).\n * @param c the content to check\n * @return true if content has data, false otherwise\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 /**\n * Localizes a value by selecting the appropriate language from an object, falling back through FR, EN, and NL.\n * @param e the object with language-keyed values or a simple value\n * @param lng the preferred language code\n * @return the localized value or null if e is null/undefined\n */\n localize(e: any, lng: string) {\n if (!e) {\n return null\n }\n return e[lng] || e.fr || e.FR || e.en || e.EN || e.nl || 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 = Object.assign(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] = [...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 = { ...psc, services: [{ serviceId: svc.id }] }\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 /**\n * Checks if a service has numeric content (measure or number value) in the preferred language.\n * @param svc the service\n * @param lng the preferred language code\n * @return true if the service has numeric content, false otherwise\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 /**\n * Returns utility functions for working with services.\n * @return an object with helper methods for creating and manipulating services\n */\n service() {\n return {\n newInstance: (user: models.User, s: any) => ({\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(formatDate(new Date(), 'yyyyMMddHHmmss')),\n ...s,\n }),\n }\n }\n\n /**\n * Returns utility functions for working with medication content.\n * @return an object with helper methods for formatting and displaying medication information\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: any) =>\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} ${formatDate(r.date, '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 * @param service a service\n * @return the id of the patient that the service 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 decryptPatientIdOfService(service: models.Service): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: service, 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 /**\n * Gets the data owners that have access to the contact and their permission levels.\n * @param entity the contact\n * @return a promise containing the permissions by data owner id and whether there are unknown anonymous data owners\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 /**\n * Gets all encryption keys available for the contact.\n * @param entity the contact\n * @return a promise containing an array of encryption key hex strings\n */\n getEncryptionKeysOf(entity: models.Contact): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.Contact }, undefined)\n }\n\n /**\n * Subscribes to service events (create, update, delete) and receives decrypted services.\n * @param eventTypes the types of events to subscribe to\n * @param filter optional filter to apply to services\n * @param eventFired callback function invoked when an event occurs, receives the decrypted service\n * @param options optional subscription options\n * @return a connection that can be closed to unsubscribe\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 /**\n * Subscribes to contact events (create, update, delete) and receives decrypted contacts.\n * @param eventTypes the types of events to subscribe to\n * @param filter optional filter to apply to contacts\n * @param eventFired callback function invoked when an event occurs, receives the decrypted contact\n * @param options optional subscription options\n * @return a connection that can be closed to unsubscribe\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 /**\n * Creates or updates de-anonymization metadata for delegations in a contact.\n * @param entity the contact\n * @param delegates the array of delegate ids to create de-anonymization metadata for\n * @return a promise that completes when the metadata is created/updated\n */\n createDelegationDeAnonymizationMetadata(entity: Contact, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: EntityWithDelegationTypeName.Contact }, delegates)\n }\n\n /**\n * Like {@link getConflictsForEntity} but additionally decrypts the conflicting revisions for the given user.\n * @param user the current user, used to determine the data owner that will decrypt the entities.\n * @param entityId the id of the contact to retrieve the conflicts for.\n * @return the decrypted conflicting revisions of the contact.\n */\n getConflictsForEntityWithUser(user: models.User, entityId: string): Promise<Array<models.Contact>> {\n return super.getConflictsForEntity(entityId).then((cs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user), cs))\n }\n\n /**\n * Like {@link declareConflictWinner} but encrypts the winning revision before sending it and decrypts the saved\n * winner returned by the backend.\n * @param user the current user, used to determine the data owner that will encrypt/decrypt the entity.\n * @param request the {@link models.ConflictResolutionRequest} carrying the (decrypted) winning revision and the conflicts to purge.\n * @return the {@link models.ConflictResolutionResult} with the decrypted saved winner and the conflicts that are still unresolved.\n */\n async declareConflictWinnerWithUser(\n user: models.User,\n request: models.ConflictResolutionRequest<models.Contact>\n ): Promise<models.ConflictResolutionResult<models.Contact>> {\n const encrypted = (await this.encrypt(user, [cloneDeep(request.document!)]))[0]\n const result = await super.declareConflictWinner({ ...request, document: encrypted })\n if (result.document) result.document = (await this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user), [result.document]))[0]\n return result\n }\n\n /**\n * Like {@link getConflictsForEntityWithUser} but targets the entity of the group with the given id.\n * @param user the current user, used to determine the data owner that will decrypt the entities.\n * @param groupId the id of the group the contact belongs to.\n * @param entityId the id of the contact to retrieve the conflicts for.\n * @return the decrypted conflicting revisions of the contact.\n */\n getConflictsForEntityInGroupWithUser(user: models.User, groupId: string, entityId: string): Promise<Array<models.Contact>> {\n return super.getConflictsForEntityInGroup(groupId, entityId).then((cs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user), cs))\n }\n\n /**\n * Like {@link declareConflictWinnerWithUser} but targets the entity of the group with the given id.\n * @param user the current user, used to determine the data owner that will encrypt/decrypt the entity.\n * @param groupId the id of the group the contact belongs to.\n * @param request the {@link models.ConflictResolutionRequest} carrying the (decrypted) winning revision and the conflicts to purge.\n * @return the {@link models.ConflictResolutionResult} with the decrypted saved winner and the conflicts that are still unresolved.\n */\n async declareConflictWinnerInGroupWithUser(\n user: models.User,\n groupId: string,\n request: models.ConflictResolutionRequest<models.Contact>\n ): Promise<models.ConflictResolutionResult<models.Contact>> {\n const encrypted = (await this.encrypt(user, [cloneDeep(request.document!)]))[0]\n const result = await super.declareConflictWinnerInGroup(groupId, { ...request, document: encrypted })\n if (result.document) result.document = (await this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user), [result.document]))[0]\n return result\n }\n}\n"]}
|
|
@@ -406,4 +406,35 @@ export declare class IccDocumentXApi extends IccDocumentApi implements Encrypted
|
|
|
406
406
|
setDocumentAttachmentMulti(attachment: ArrayBuffer, documentRev: string, documentId: string, enckeys?: null): never;
|
|
407
407
|
setSecondaryAttachment(documentId: string, key: string, rev: string, attachment: Object, utis?: Array<string>, dataIsEncrypted?: boolean): never;
|
|
408
408
|
deleteSecondaryAttachment(documentId: string, key: string, rev: string): never;
|
|
409
|
+
/**
|
|
410
|
+
* Like {@link getConflictsForEntity} but additionally decrypts the conflicting revisions.
|
|
411
|
+
* @param user the current user (unused for documents, kept for API consistency).
|
|
412
|
+
* @param entityId the id of the document to retrieve the conflicts for.
|
|
413
|
+
* @return the decrypted conflicting revisions of the document.
|
|
414
|
+
*/
|
|
415
|
+
getConflictsForEntityWithUser(user: models.User, entityId: string): Promise<Array<models.Document>>;
|
|
416
|
+
/**
|
|
417
|
+
* Like {@link declareConflictWinner} but encrypts the winning revision before sending it and decrypts the saved
|
|
418
|
+
* winner returned by the backend.
|
|
419
|
+
* @param user the current user (unused for documents, kept for API consistency).
|
|
420
|
+
* @param request the {@link models.ConflictResolutionRequest} carrying the (decrypted) winning revision and the conflicts to purge.
|
|
421
|
+
* @return the {@link models.ConflictResolutionResult} with the decrypted saved winner and the conflicts that are still unresolved.
|
|
422
|
+
*/
|
|
423
|
+
declareConflictWinnerWithUser(user: models.User, request: models.ConflictResolutionRequest<models.Document>): Promise<models.ConflictResolutionResult<models.Document>>;
|
|
424
|
+
/**
|
|
425
|
+
* Like {@link getConflictsForEntityWithUser} but targets the entity of the group with the given id.
|
|
426
|
+
* @param user the current user (unused for documents, kept for API consistency).
|
|
427
|
+
* @param groupId the id of the group the document belongs to.
|
|
428
|
+
* @param entityId the id of the document to retrieve the conflicts for.
|
|
429
|
+
* @return the decrypted conflicting revisions of the document.
|
|
430
|
+
*/
|
|
431
|
+
getConflictsForEntityInGroupWithUser(user: models.User, groupId: string, entityId: string): Promise<Array<models.Document>>;
|
|
432
|
+
/**
|
|
433
|
+
* Like {@link declareConflictWinnerWithUser} but targets the entity of the group with the given id.
|
|
434
|
+
* @param user the current user (unused for documents, kept for API consistency).
|
|
435
|
+
* @param groupId the id of the group the document belongs to.
|
|
436
|
+
* @param request the {@link models.ConflictResolutionRequest} carrying the (decrypted) winning revision and the conflicts to purge.
|
|
437
|
+
* @return the {@link models.ConflictResolutionResult} with the decrypted saved winner and the conflicts that are still unresolved.
|
|
438
|
+
*/
|
|
439
|
+
declareConflictWinnerInGroupWithUser(user: models.User, groupId: string, request: models.ConflictResolutionRequest<models.Document>): Promise<models.ConflictResolutionResult<models.Document>>;
|
|
409
440
|
}
|