@icure/api 8.6.4 → 8.6.6

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.
Files changed (61) hide show
  1. package/icc-api/api/IccFormApi.d.ts +81 -0
  2. package/icc-api/api/IccFormApi.js +213 -0
  3. package/icc-api/api/IccFormApi.js.map +1 -1
  4. package/icc-x-api/icc-accesslog-x-api.d.ts +93 -0
  5. package/icc-x-api/icc-accesslog-x-api.js +93 -0
  6. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  7. package/icc-x-api/icc-calendar-item-x-api.d.ts +122 -0
  8. package/icc-x-api/icc-calendar-item-x-api.js +122 -0
  9. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  10. package/icc-x-api/icc-classification-x-api.d.ts +20 -0
  11. package/icc-x-api/icc-classification-x-api.js +20 -0
  12. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  13. package/icc-x-api/icc-code-x-api.d.ts +23 -0
  14. package/icc-x-api/icc-code-x-api.js +23 -0
  15. package/icc-x-api/icc-code-x-api.js.map +1 -1
  16. package/icc-x-api/icc-contact-x-api.d.ts +219 -1
  17. package/icc-x-api/icc-contact-x-api.js +219 -2
  18. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  19. package/icc-x-api/icc-data-owner-x-api.d.ts +14 -3
  20. package/icc-x-api/icc-data-owner-x-api.js +14 -3
  21. package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
  22. package/icc-x-api/icc-device-x-api.d.ts +8 -0
  23. package/icc-x-api/icc-device-x-api.js +8 -0
  24. package/icc-x-api/icc-device-x-api.js.map +1 -1
  25. package/icc-x-api/icc-doctemplate-x-api.d.ts +26 -0
  26. package/icc-x-api/icc-doctemplate-x-api.js +26 -0
  27. package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
  28. package/icc-x-api/icc-document-x-api.d.ts +114 -1
  29. package/icc-x-api/icc-document-x-api.js +127 -1
  30. package/icc-x-api/icc-document-x-api.js.map +1 -1
  31. package/icc-x-api/icc-form-x-api.d.ts +34 -4
  32. package/icc-x-api/icc-form-x-api.js +34 -4
  33. package/icc-x-api/icc-form-x-api.js.map +1 -1
  34. package/icc-x-api/icc-hcparty-x-api.d.ts +67 -0
  35. package/icc-x-api/icc-hcparty-x-api.js +67 -0
  36. package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
  37. package/icc-x-api/icc-helement-x-api.d.ts +141 -0
  38. package/icc-x-api/icc-helement-x-api.js +141 -0
  39. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  40. package/icc-x-api/icc-invoice-x-api.d.ts +54 -0
  41. package/icc-x-api/icc-invoice-x-api.js +54 -0
  42. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  43. package/icc-x-api/icc-message-x-api.d.ts +162 -0
  44. package/icc-x-api/icc-message-x-api.js +162 -0
  45. package/icc-x-api/icc-message-x-api.js.map +1 -1
  46. package/icc-x-api/icc-patient-x-api.d.ts +245 -0
  47. package/icc-x-api/icc-patient-x-api.js +245 -1
  48. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  49. package/icc-x-api/icc-receipt-x-api.d.ts +25 -0
  50. package/icc-x-api/icc-receipt-x-api.js +25 -0
  51. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  52. package/icc-x-api/icc-user-x-api.d.ts +25 -0
  53. package/icc-x-api/icc-user-x-api.js +25 -0
  54. package/icc-x-api/icc-user-x-api.js.map +1 -1
  55. package/package.json +1 -1
  56. package/test/icc-x-api/icc-form-x-api.js +265 -1
  57. package/test/icc-x-api/icc-form-x-api.js.map +1 -1
  58. package/test/utils/roles.js +5 -0
  59. package/test/utils/roles.js.map +1 -1
  60. package/test/utils/test_utils.js +1 -21
  61. package/test/utils/test_utils.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"icc-message-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-message-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsD;AAGtD,kD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AC,CAAA;IACxC,CAAC;IAED,4BAA4B,CAAC,KAAa,EAAE,IAAgB;QAC1D,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,aAAa,CAAC,IAAc;QAC1B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,qBAAqB,CAAC,MAAc,EAAE,IAAgB;QACpD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,gBAAgB,CAAC,IAAwB,EAAE,eAAwB,EAAE,KAAc;QACjF,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,qBAAqB,CAAC,IAA+B;QACnD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;CACF;AA9eD,wCA8eC","sourcesContent":["import { IccAuthApi, IccMessageApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport * as models from '../icc-api/model/models'\nimport { DocIdentifier, ListOfIds, Message, MessagesReadStatusUpdate, PaginatedListMessage, Patient, User } from '../icc-api/model/models'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\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 { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { FilterChainMessage } from '../icc-api/model/FilterChainMessage'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { AbstractFilter } from './filters/filters'\nimport { EncryptedFieldsManifest, EntityWithDelegationTypeName, parseEncryptedFields, subscribeToEntityEvents, SubscriptionOptions } from './utils'\nimport { Connection, ConnectionImpl } from '../icc-api/model/Connection'\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\nimport { AbstractFilterMessage } from '../icc-api/model/AbstractFilterMessage'\nimport { BulkShareOrUpdateMetadataParams } from '../icc-api/model/requests/BulkShareOrUpdateMetadataParams'\n\nexport class IccMessageXApi extends IccMessageApi implements EncryptedEntityXApi<models.Message> {\n private readonly encryptedFields: EncryptedFieldsManifest\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.Message))\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 authApi: IccAuthApi,\n private readonly autofillAuthor: boolean,\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n encryptedKeys: Array<string> = [],\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'Message.')\n }\n\n // noinspection JSUnusedGlobalSymbols\n newInstance(user: User, m: any) {\n return this.newInstanceWithPatient(user, null, m)\n }\n\n /**\n * Creates a new instance of message with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this message refers to.\n * @param m initialised data for the message. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with\n * auto-delegations, in such case the access level specified here will be used.\n * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the message. The default value will be a\n * secret id of patient known by the topmost parent in the current data owner hierarchy.\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 message.\n */\n async newInstanceWithPatient(\n user: User,\n patient: Patient | null,\n m: any = {},\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n alternateRootDelegation?: string\n } = {}\n ) {\n const message = {\n ...(m ?? {}),\n _type: 'org.taktik.icure.entities.Message',\n id: m?.id ?? this.crypto.primitives.randomUuid(),\n created: m?.created ?? new Date().getTime(),\n modified: m?.modified ?? new Date().getTime(),\n responsible: m?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: m?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: m?.codes ?? [],\n tags: m?.tags ?? [],\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 = patient\n ? await this.crypto.xapi.resolveSecretIdUseOptions(\n { entity: patient, type: EntityWithDelegationTypeName.Patient },\n options.sfkOption ?? SecretIdUseOption.UseAnySharedWithParent\n )\n : undefined\n if (patient && !sfk) throw new Error(`Couldn't find any sfk of parent patient ${patient.id}`)\n const extraDelegations = {\n ...Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.medicalInformation ?? [])].map((d) => [d, AccessLevelEnum.WRITE])\n ),\n ...(options?.additionalDelegates ?? {}),\n }\n return new models.Message(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(\n message,\n EntityWithDelegationTypeName.Message,\n patient?.id,\n sfk,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n .then((x) => x.updatedEntity)\n )\n }\n\n async decrypt(messages: Array<models.Message>) {\n return await this.crypto.xapi.tryDecryptEntities(messages, EntityWithDelegationTypeName.Message, (x) => new models.Message(x))\n }\n\n encrypt(messages: Array<models.Message>): Promise<Array<models.Message>> {\n return this.crypto.xapi.tryEncryptEntities(\n messages,\n EntityWithDelegationTypeName.Message,\n this.encryptedFields,\n true,\n false,\n (x) => new models.Message(x)\n )\n }\n\n /**\n * @param message a message\n * @return the id of the patient that the message 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(message: models.Message): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: message, type: EntityWithDelegationTypeName.Message }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given message\n */\n async hasWriteAccess(message: models.Message): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: message, type: EntityWithDelegationTypeName.Message })\n }\n\n /**\n * Share an existing message with other data owners, allowing them to access the non-encrypted data of the message 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 message.\n * @param message the message to share.\n * @param shareSecretIds the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the\n * shared Message is the owning entity id.\n * @param options optional parameters to customize the sharing behaviour:\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 * message does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this message 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 message: models.Message,\n shareSecretIds: string[],\n options: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Message> {\n return this.shareWithMany(message, { [delegateId]: { ...options, shareSecretIds } })\n }\n\n /**\n * Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param message the message 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 the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the\n * shared Message is the owning entity id. Mandatory.\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 * message does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this message 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 message: models.Message,\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.Message> {\n return (await this.tryShareWithMany(message, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param message the message 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 the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the\n * shared Message is the owning entity id. Mandatory.\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 * message does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this message 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 message: models.Message,\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.Message>> {\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(message, EntityWithDelegationTypeName.Message)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyMessageWithUser(undefined, entityWithEncryptionKey) : message\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.Message,\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) => super.bulkShareMessages(x)\n )\n .then((r) => r.mapSuccessAsync(async (m) => (await this.decrypt([m]))[0].entity))\n }\n\n /**\n * @param message a message\n * @return the secret ids of the message, retrieved from the encrypted metadata. The result may be used to find entities where the message is\n * the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.\n */\n decryptSecretIdsOf(message: models.Message): Promise<string[]> {\n return this.crypto.xapi.secretIdsOf({ entity: message, type: EntityWithDelegationTypeName.Message }, undefined)\n }\n\n createDelegationDeAnonymizationMetadata(entity: Message, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: EntityWithDelegationTypeName.Message }, delegates)\n }\n\n getDataOwnersWithAccessTo(\n entity: models.Message\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.Message })\n }\n\n getEncryptionKeysOf(entity: models.Message): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.Message }, undefined)\n }\n\n async subscribeToMessageEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Message> | undefined,\n eventFired: (message: Message) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n return await subscribeToEntityEvents(\n this.host,\n this.authApi,\n EntityWithDelegationTypeName.Message,\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted) => (await this.decrypt([encrypted]))[0].entity\n ).then((rs) => new ConnectionImpl(rs))\n }\n\n private async decryptPage(page: PaginatedListMessage): Promise<PaginatedListMessage> {\n return {\n ...page,\n rows: (await this.decrypt(page.rows ?? [])).map((x) => x.entity),\n }\n }\n\n async createMessageWithUser(user: models.User | undefined, body: Message): Promise<Message> {\n return (await this.decrypt([await super.createMessage((await this.encrypt([body]))[0])]))[0].entity\n }\n\n async findMessagesWithUser(\n user: models.User | undefined,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): Promise<PaginatedListMessage> {\n return await this.decryptPage(await super.findMessages(startKey, startDocumentId, limit))\n }\n\n async findMessagesByFromAddressWithUser(\n user: models.User | undefined,\n fromAddress?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n hcpId?: string\n ): Promise<PaginatedListMessage> {\n return await this.decryptPage(await super.findMessagesByFromAddress(fromAddress, startKey, startDocumentId, limit, hcpId))\n }\n\n /**\n * @deprecated\n */\n async findMessagesByHCPartyPatientForeignKeysUsingPostWithUser(user: models.User | undefined, body?: Array<string>): Promise<Array<Message>> {\n return (await this.decrypt(await super.findMessagesByHCPartyPatientForeignKeysUsingPost(body))).map((x) => x.entity)\n }\n\n /**\n * @deprecated\n */\n async findMessagesByHCPartyPatientForeignKeysWithUser(user: models.User | undefined, secretFKeys: string): Promise<Array<Message>> {\n return (await this.decrypt(await super.findMessagesByHCPartyPatientForeignKeys(secretFKeys))).map((x) => x.entity)\n }\n\n async findMessagesByToAddressWithUser(\n user: models.User | undefined,\n toAddress?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n reverse?: boolean,\n hcpId?: string\n ): Promise<PaginatedListMessage> {\n return await this.decryptPage(await super.findMessagesByToAddress(toAddress, startKey, startDocumentId, limit, reverse, hcpId))\n }\n\n async findMessagesByTransportGuidWithUser(\n user: models.User | undefined,\n transportGuid?: string,\n received?: boolean,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n hcpId?: string\n ): Promise<PaginatedListMessage> {\n return await this.decryptPage(await super.findMessagesByTransportGuid(transportGuid, received, startKey, startDocumentId, limit, hcpId))\n }\n\n async findMessagesByTransportGuidSentDateWithUser(\n user: models.User | undefined,\n transportGuid?: string,\n from?: number,\n to?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n hcpId?: string\n ): Promise<PaginatedListMessage> {\n return await this.decryptPage(await super.findMessagesByTransportGuidSentDate(transportGuid, from, to, startKey, startDocumentId, limit, hcpId))\n }\n\n async getChildrenMessagesWithUser(user: models.User | undefined, messageId: string): Promise<Array<Message>> {\n return (await this.decrypt(await super.getChildrenMessages(messageId))).map((x) => x.entity)\n }\n\n async getChildrenMessagesOfListWithUser(user: models.User | undefined, body?: ListOfIds): Promise<Array<Message>> {\n return (await this.decrypt(await super.getChildrenMessagesOfList(body))).map((x) => x.entity)\n }\n\n async getMessageWithUser(user: models.User | undefined, messageId: string): Promise<Message> {\n return (await this.decrypt([await super.getMessage(messageId)]))[0].entity\n }\n\n async getMessagesWithUser(user: models.User | undefined, messageIds: ListOfIds): Promise<Message[]> {\n return (await this.decrypt(await super.getMessages(messageIds))).map((x) => x.entity)\n }\n\n async listMessagesByInvoiceIdsWithUser(user: models.User | undefined, body?: ListOfIds): Promise<Array<Message>> {\n return (await this.decrypt(await super.listMessagesByInvoiceIds(body))).map((x) => x.entity)\n }\n\n async listMessagesByTransportGuidsWithUser(user: models.User | undefined, hcpId: string, body?: ListOfIds): Promise<Array<Message>> {\n return (await this.decrypt(await super.listMessagesByTransportGuids(hcpId, body))).map((x) => x.entity)\n }\n\n async modifyMessageWithUser(user: models.User | undefined, body: Message): Promise<Message> {\n return (await this.decrypt([await super.modifyMessage((await this.encrypt([body]))[0])]))[0].entity\n }\n\n async setMessagesStatusBitsWithUser(user: models.User | undefined, status: number, body?: ListOfIds): Promise<Array<Message>> {\n return (await this.decrypt(await super.setMessagesStatusBits(status, body))).map((x) => x.entity)\n }\n\n async filterMessagesByWithUser(\n user: models.User | undefined,\n body: FilterChainMessage,\n startDocumentId?: string,\n limit?: number\n ): Promise<PaginatedListMessage> {\n return await this.decryptPage(await super.filterMessagesBy(body, startDocumentId, limit))\n }\n\n async setMessagesReadStatusWithUser(user: models.User | undefined, body?: MessagesReadStatusUpdate): Promise<Array<Message>> {\n return (await this.decrypt(await super.setMessagesReadStatus(body))).map((x) => x.entity)\n }\n\n createMessage(body?: Message): never {\n throw new Error('Use withUser method')\n }\n\n findMessages(startKey?: string, startDocumentId?: string, limit?: number): never {\n throw new Error('Use withUser method')\n }\n\n findMessagesByFromAddress(fromAddress?: string, startKey?: string, startDocumentId?: string, limit?: number, hcpId?: string): never {\n throw new Error('Use withUser method')\n }\n\n findMessagesByHCPartyPatientForeignKeysUsingPost(body?: Array<string>): never {\n throw new Error('Use withUser method')\n }\n\n findMessagesByHCPartyPatientForeignKeys(secretFKeys: string): never {\n throw new Error('Use withUser method')\n }\n\n findMessagesByToAddress(toAddress?: string, startKey?: string, startDocumentId?: string, limit?: number, reverse?: boolean, hcpId?: string): never {\n throw new Error('Use withUser method')\n }\n\n findMessagesByTransportGuid(\n transportGuid?: string,\n received?: boolean,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n hcpId?: string\n ): never {\n throw new Error('Use withUser method')\n }\n\n findMessagesByTransportGuidSentDate(\n transportGuid?: string,\n from?: number,\n to?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n hcpId?: string\n ): never {\n throw new Error('Use withUser method')\n }\n\n getChildrenMessages(messageId: string): never {\n throw new Error('Use withUser method')\n }\n\n getChildrenMessagesOfList(body?: ListOfIds): never {\n throw new Error('Use withUser method')\n }\n\n getMessage(messageId: string): never {\n throw new Error('Use withUser method')\n }\n\n getMessages(messageIds: ListOfIds): never {\n throw new Error('Use withUser method')\n }\n\n listMessagesByInvoiceIds(body?: ListOfIds): never {\n throw new Error('Use withUser method')\n }\n\n listMessagesByTransportGuids(hcpId: string, body?: ListOfIds): never {\n throw new Error('Use withUser method')\n }\n\n modifyMessage(body?: Message): never {\n throw new Error('Use withUser method')\n }\n\n setMessagesStatusBits(status: number, body?: ListOfIds): never {\n throw new Error('Use withUser method')\n }\n\n filterMessagesBy(body: FilterChainMessage, startDocumentId?: string, limit?: number): never {\n throw new Error('Use withUser method')\n }\n\n setMessagesReadStatus(body?: MessagesReadStatusUpdate): never {\n throw new Error('Use withUser method')\n }\n}\n"]}
1
+ {"version":3,"file":"icc-message-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-message-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsD;AAGtD,kDAAiD;AAGjD,0EAAgG;AAChG,wEAAoE;AAOpE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAGzD,mCAAmJ;AACnJ,4DAAwE;AACxE,kEAA8D;AAI9D,MAAa,cAAe,SAAQ,uBAAa;IAG/C,IAAI,OAAO;QACT,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE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I,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,wBAAwB,CAAC,IAAgB;QACvC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,4BAA4B,CAAC,KAAa,EAAE,IAAgB;QAC1D,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,aAAa,CAAC,IAAc;QAC1B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,qBAAqB,CAAC,MAAc,EAAE,IAAgB;QACpD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,gBAAgB,CAAC,IAAwB,EAAE,eAAwB,EAAE,KAAc;QACjF,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;IAED,qBAAqB,CAAC,IAA+B;QACnD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACxC,CAAC;CACF;AAhpBD,wCAgpBC","sourcesContent":["import { IccAuthApi, IccMessageApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport * as models from '../icc-api/model/models'\nimport { DocIdentifier, ListOfIds, Message, MessagesReadStatusUpdate, PaginatedListMessage, Patient, User } from '../icc-api/model/models'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\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 { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { FilterChainMessage } from '../icc-api/model/FilterChainMessage'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { AbstractFilter } from './filters/filters'\nimport { EncryptedFieldsManifest, EntityWithDelegationTypeName, parseEncryptedFields, subscribeToEntityEvents, SubscriptionOptions } from './utils'\nimport { Connection, ConnectionImpl } from '../icc-api/model/Connection'\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\nimport { AbstractFilterMessage } from '../icc-api/model/AbstractFilterMessage'\nimport { BulkShareOrUpdateMetadataParams } from '../icc-api/model/requests/BulkShareOrUpdateMetadataParams'\n\nexport class IccMessageXApi extends IccMessageApi implements EncryptedEntityXApi<models.Message> {\n private readonly encryptedFields: EncryptedFieldsManifest\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.Message))\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 authApi: IccAuthApi,\n private readonly autofillAuthor: boolean,\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n encryptedKeys: Array<string> = [],\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'Message.')\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * Creates a new instance of message with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param m initialised data for the message. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @return a new instance of message.\n */\n newInstance(user: User, m: any) {\n return this.newInstanceWithPatient(user, null, m)\n }\n\n /**\n * Creates a new instance of message with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this message refers to.\n * @param m initialised data for the message. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with\n * auto-delegations, in such case the access level specified here will be used.\n * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the message. The default value will be a\n * secret id of patient known by the topmost parent in the current data owner hierarchy.\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 message.\n */\n async newInstanceWithPatient(\n user: User,\n patient: Patient | null,\n m: any = {},\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n alternateRootDelegation?: string\n } = {}\n ) {\n const message = {\n ...(m ?? {}),\n _type: 'org.taktik.icure.entities.Message',\n id: m?.id ?? this.crypto.primitives.randomUuid(),\n created: m?.created ?? new Date().getTime(),\n modified: m?.modified ?? new Date().getTime(),\n responsible: m?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: m?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: m?.codes ?? [],\n tags: m?.tags ?? [],\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 = patient\n ? await this.crypto.xapi.resolveSecretIdUseOptions(\n { entity: patient, type: EntityWithDelegationTypeName.Patient },\n options.sfkOption ?? SecretIdUseOption.UseAnySharedWithParent\n )\n : undefined\n if (patient && !sfk) throw new Error(`Couldn't find any sfk of parent patient ${patient.id}`)\n const extraDelegations = {\n ...Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.medicalInformation ?? [])].map((d) => [d, AccessLevelEnum.WRITE])\n ),\n ...(options?.additionalDelegates ?? {}),\n }\n return new models.Message(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(\n message,\n EntityWithDelegationTypeName.Message,\n patient?.id,\n sfk,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n .then((x) => x.updatedEntity)\n )\n }\n\n /**\n * Decrypts the encrypted content of messages.\n * @param messages the messages to decrypt.\n * @return the decrypted messages with their encryption status.\n */\n async decrypt(messages: Array<models.Message>) {\n return await this.crypto.xapi.tryDecryptEntities(messages, EntityWithDelegationTypeName.Message, (x) => new models.Message(x))\n }\n\n /**\n * Encrypts the content of messages.\n * @param messages the messages to encrypt.\n * @return the encrypted messages.\n */\n encrypt(messages: Array<models.Message>): Promise<Array<models.Message>> {\n return this.crypto.xapi.tryEncryptEntities(\n messages,\n EntityWithDelegationTypeName.Message,\n this.encryptedFields,\n true,\n false,\n (x) => new models.Message(x)\n )\n }\n\n /**\n * @param message a message\n * @return the id of the patient that the message 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(message: models.Message): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: message, type: EntityWithDelegationTypeName.Message }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given message\n */\n async hasWriteAccess(message: models.Message): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: message, type: EntityWithDelegationTypeName.Message })\n }\n\n /**\n * Share an existing message with other data owners, allowing them to access the non-encrypted data of the message 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 message.\n * @param message the message to share.\n * @param shareSecretIds the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the\n * shared Message is the owning entity id.\n * @param options optional parameters to customize the sharing behaviour:\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 * message does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this message 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 message: models.Message,\n shareSecretIds: string[],\n options: {\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Message> {\n return this.shareWithMany(message, { [delegateId]: { ...options, shareSecretIds } })\n }\n\n /**\n * Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param message the message 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 the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the\n * shared Message is the owning entity id. Mandatory.\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 * message does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this message 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 message: models.Message,\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.Message> {\n return (await this.tryShareWithMany(message, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing message with other data owners, allowing them to access the non-encrypted data of the message and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param message the message 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 the secret ids of the Message that the delegate will be given access to. Allows the delegate to search for data where the\n * shared Message is the owning entity id. Mandatory.\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 * message does not have encrypted content.\n * - sharePatientId: specifies if the id of the patient that this message 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 message: models.Message,\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.Message>> {\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(message, EntityWithDelegationTypeName.Message)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyMessageWithUser(undefined, entityWithEncryptionKey) : message\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.Message,\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) => super.bulkShareMessages(x)\n )\n .then((r) => r.mapSuccessAsync(async (m) => (await this.decrypt([m]))[0].entity))\n }\n\n /**\n * @param message a message\n * @return the secret ids of the message, retrieved from the encrypted metadata. The result may be used to find entities where the message is\n * the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.\n */\n decryptSecretIdsOf(message: models.Message): Promise<string[]> {\n return this.crypto.xapi.secretIdsOf({ entity: message, type: EntityWithDelegationTypeName.Message }, undefined)\n }\n\n /**\n * Creates or updates de-anonymization metadata for the message, allowing resolution of anonymous delegations.\n * @param entity the message.\n * @param delegates the data owner ids of the delegates.\n */\n createDelegationDeAnonymizationMetadata(entity: Message, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: EntityWithDelegationTypeName.Message }, delegates)\n }\n\n /**\n * Retrieves the data owners that have access to the message.\n * @param entity the message.\n * @return the data owners with their access levels and a flag indicating if there are unknown anonymous data owners.\n */\n getDataOwnersWithAccessTo(\n entity: models.Message\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.Message })\n }\n\n /**\n * Retrieves the encryption keys of the message.\n * @param entity the message.\n * @return the encryption keys.\n */\n getEncryptionKeysOf(entity: models.Message): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.Message }, undefined)\n }\n\n /**\n * Subscribes to message events (create, update, delete).\n * @param eventTypes the types of events to subscribe to.\n * @param filter optional filter to apply to the events.\n * @param eventFired callback function to be called when an event is fired.\n * @param options optional subscription options.\n * @return a connection that can be used to close the subscription.\n */\n async subscribeToMessageEvents(\n eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[],\n filter: AbstractFilter<Message> | undefined,\n eventFired: (message: Message) => Promise<void>,\n options: SubscriptionOptions = {}\n ): Promise<Connection> {\n return await subscribeToEntityEvents(\n this.host,\n this.authApi,\n EntityWithDelegationTypeName.Message,\n eventTypes,\n filter,\n eventFired,\n options,\n async (encrypted) => (await this.decrypt([encrypted]))[0].entity\n ).then((rs) => new ConnectionImpl(rs))\n }\n\n private async decryptPage(page: PaginatedListMessage): Promise<PaginatedListMessage> {\n return {\n ...page,\n rows: (await this.decrypt(page.rows ?? [])).map((x) => x.entity),\n }\n }\n\n /**\n * Creates a message.\n * @param user the current user (unused, for compatibility).\n * @param body the message to create.\n * @return the created message.\n */\n async createMessageWithUser(user: models.User | undefined, body: Message): Promise<Message> {\n return (await this.decrypt([await super.createMessage((await this.encrypt([body]))[0])]))[0].entity\n }\n\n /**\n * Finds messages with pagination.\n * @param user the current user (unused, for compatibility).\n * @param startKey optional start key for pagination.\n * @param startDocumentId optional start document id for pagination.\n * @param limit optional maximum number of results to return.\n * @return a paginated list of messages.\n */\n async findMessagesWithUser(\n user: models.User | undefined,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): Promise<PaginatedListMessage> {\n return await this.decryptPage(await super.findMessages(startKey, startDocumentId, limit))\n }\n\n /**\n * Finds messages by sender address with pagination.\n * @param user the current user (unused, for compatibility).\n * @param fromAddress the sender address to filter by.\n * @param startKey optional start key for pagination.\n * @param startDocumentId optional start document id for pagination.\n * @param limit optional maximum number of results to return.\n * @param hcpId optional healthcare party id to filter by.\n * @return a paginated list of messages.\n */\n async findMessagesByFromAddressWithUser(\n user: models.User | undefined,\n fromAddress?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n hcpId?: string\n ): Promise<PaginatedListMessage> {\n return await this.decryptPage(await super.findMessagesByFromAddress(fromAddress, startKey, startDocumentId, limit, hcpId))\n }\n\n /**\n * @deprecated\n */\n async findMessagesByHCPartyPatientForeignKeysUsingPostWithUser(user: models.User | undefined, body?: Array<string>): Promise<Array<Message>> {\n return (await this.decrypt(await super.findMessagesByHCPartyPatientForeignKeysUsingPost(body))).map((x) => x.entity)\n }\n\n /**\n * @deprecated\n */\n async findMessagesByHCPartyPatientForeignKeysWithUser(user: models.User | undefined, secretFKeys: string): Promise<Array<Message>> {\n return (await this.decrypt(await super.findMessagesByHCPartyPatientForeignKeys(secretFKeys))).map((x) => x.entity)\n }\n\n /**\n * Finds messages by recipient address with pagination.\n * @param user the current user (unused, for compatibility).\n * @param toAddress the recipient address to filter by.\n * @param startKey optional start key for pagination.\n * @param startDocumentId optional start document id for pagination.\n * @param limit optional maximum number of results to return.\n * @param reverse optional flag to reverse the sort order.\n * @param hcpId optional healthcare party id to filter by.\n * @return a paginated list of messages.\n */\n async findMessagesByToAddressWithUser(\n user: models.User | undefined,\n toAddress?: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n reverse?: boolean,\n hcpId?: string\n ): Promise<PaginatedListMessage> {\n return await this.decryptPage(await super.findMessagesByToAddress(toAddress, startKey, startDocumentId, limit, reverse, hcpId))\n }\n\n /**\n * Finds messages by transport GUID with pagination.\n * @param user the current user (unused, for compatibility).\n * @param transportGuid the transport GUID to filter by.\n * @param received optional flag to filter by received status.\n * @param startKey optional start key for pagination.\n * @param startDocumentId optional start document id for pagination.\n * @param limit optional maximum number of results to return.\n * @param hcpId optional healthcare party id to filter by.\n * @return a paginated list of messages.\n */\n async findMessagesByTransportGuidWithUser(\n user: models.User | undefined,\n transportGuid?: string,\n received?: boolean,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n hcpId?: string\n ): Promise<PaginatedListMessage> {\n return await this.decryptPage(await super.findMessagesByTransportGuid(transportGuid, received, startKey, startDocumentId, limit, hcpId))\n }\n\n /**\n * Finds messages by transport GUID and sent date range with pagination.\n * @param user the current user (unused, for compatibility).\n * @param transportGuid the transport GUID to filter by.\n * @param from optional start timestamp for the date range.\n * @param to optional end timestamp for the date range.\n * @param startKey optional start key for pagination.\n * @param startDocumentId optional start document id for pagination.\n * @param limit optional maximum number of results to return.\n * @param hcpId optional healthcare party id to filter by.\n * @return a paginated list of messages.\n */\n async findMessagesByTransportGuidSentDateWithUser(\n user: models.User | undefined,\n transportGuid?: string,\n from?: number,\n to?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n hcpId?: string\n ): Promise<PaginatedListMessage> {\n return await this.decryptPage(await super.findMessagesByTransportGuidSentDate(transportGuid, from, to, startKey, startDocumentId, limit, hcpId))\n }\n\n /**\n * Retrieves the children messages of a message.\n * @param user the current user (unused, for compatibility).\n * @param messageId the id of the parent message.\n * @return the children messages.\n */\n async getChildrenMessagesWithUser(user: models.User | undefined, messageId: string): Promise<Array<Message>> {\n return (await this.decrypt(await super.getChildrenMessages(messageId))).map((x) => x.entity)\n }\n\n /**\n * Retrieves the children messages of a list of parent messages.\n * @param user the current user (unused, for compatibility).\n * @param body the list of parent message ids.\n * @return the children messages.\n */\n async getChildrenMessagesOfListWithUser(user: models.User | undefined, body?: ListOfIds): Promise<Array<Message>> {\n return (await this.decrypt(await super.getChildrenMessagesOfList(body))).map((x) => x.entity)\n }\n\n /**\n * Retrieves a message by its id.\n * @param user the current user (unused, for compatibility).\n * @param messageId the id of the message.\n * @return the message.\n */\n async getMessageWithUser(user: models.User | undefined, messageId: string): Promise<Message> {\n return (await this.decrypt([await super.getMessage(messageId)]))[0].entity\n }\n\n /**\n * Retrieves multiple messages by their ids.\n * @param user the current user (unused, for compatibility).\n * @param messageIds the list of message ids.\n * @return the messages.\n */\n async getMessagesWithUser(user: models.User | undefined, messageIds: ListOfIds): Promise<Message[]> {\n return (await this.decrypt(await super.getMessages(messageIds))).map((x) => x.entity)\n }\n\n /**\n * Lists messages by invoice ids.\n * @param user the current user (unused, for compatibility).\n * @param body the list of invoice ids.\n * @return the messages associated with the invoices.\n */\n async listMessagesByInvoiceIdsWithUser(user: models.User | undefined, body?: ListOfIds): Promise<Array<Message>> {\n return (await this.decrypt(await super.listMessagesByInvoiceIds(body))).map((x) => x.entity)\n }\n\n /**\n * Lists messages by transport GUIDs.\n * @param user the current user (unused, for compatibility).\n * @param hcpId the healthcare party id.\n * @param body the list of transport GUIDs.\n * @return the messages associated with the transport GUIDs.\n */\n async listMessagesByTransportGuidsWithUser(user: models.User | undefined, hcpId: string, body?: ListOfIds): Promise<Array<Message>> {\n return (await this.decrypt(await super.listMessagesByTransportGuids(hcpId, body))).map((x) => x.entity)\n }\n\n /**\n * Modifies a message.\n * @param user the current user (unused, for compatibility).\n * @param body the message to modify.\n * @return the modified message.\n */\n async modifyMessageWithUser(user: models.User | undefined, body: Message): Promise<Message> {\n return (await this.decrypt([await super.modifyMessage((await this.encrypt([body]))[0])]))[0].entity\n }\n\n /**\n * Sets the status bits of multiple messages.\n * @param user the current user (unused, for compatibility).\n * @param status the status bits to set.\n * @param body the list of message ids.\n * @return the updated messages.\n */\n async setMessagesStatusBitsWithUser(user: models.User | undefined, status: number, body?: ListOfIds): Promise<Array<Message>> {\n return (await this.decrypt(await super.setMessagesStatusBits(status, body))).map((x) => x.entity)\n }\n\n /**\n * Filters messages using a filter chain with pagination.\n * @param user the current user (unused, for compatibility).\n * @param body the filter chain to apply.\n * @param startDocumentId optional start document id for pagination.\n * @param limit optional maximum number of results to return.\n * @return a paginated list of filtered messages.\n */\n async filterMessagesByWithUser(\n user: models.User | undefined,\n body: FilterChainMessage,\n startDocumentId?: string,\n limit?: number\n ): Promise<PaginatedListMessage> {\n return await this.decryptPage(await super.filterMessagesBy(body, startDocumentId, limit))\n }\n\n /**\n * Sets the read status of multiple messages.\n * @param user the current user (unused, for compatibility).\n * @param body the read status update information.\n * @return the updated messages.\n */\n async setMessagesReadStatusWithUser(user: models.User | undefined, body?: MessagesReadStatusUpdate): Promise<Array<Message>> {\n return (await this.decrypt(await super.setMessagesReadStatus(body))).map((x) => x.entity)\n }\n\n createMessage(body?: Message): never {\n throw new Error('Use withUser method')\n }\n\n findMessages(startKey?: string, startDocumentId?: string, limit?: number): never {\n throw new Error('Use withUser method')\n }\n\n findMessagesByFromAddress(fromAddress?: string, startKey?: string, startDocumentId?: string, limit?: number, hcpId?: string): never {\n throw new Error('Use withUser method')\n }\n\n findMessagesByHCPartyPatientForeignKeysUsingPost(body?: Array<string>): never {\n throw new Error('Use withUser method')\n }\n\n findMessagesByHCPartyPatientForeignKeys(secretFKeys: string): never {\n throw new Error('Use withUser method')\n }\n\n findMessagesByToAddress(toAddress?: string, startKey?: string, startDocumentId?: string, limit?: number, reverse?: boolean, hcpId?: string): never {\n throw new Error('Use withUser method')\n }\n\n findMessagesByTransportGuid(\n transportGuid?: string,\n received?: boolean,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n hcpId?: string\n ): never {\n throw new Error('Use withUser method')\n }\n\n findMessagesByTransportGuidSentDate(\n transportGuid?: string,\n from?: number,\n to?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n hcpId?: string\n ): never {\n throw new Error('Use withUser method')\n }\n\n getChildrenMessages(messageId: string): never {\n throw new Error('Use withUser method')\n }\n\n getChildrenMessagesOfList(body?: ListOfIds): never {\n throw new Error('Use withUser method')\n }\n\n getMessage(messageId: string): never {\n throw new Error('Use withUser method')\n }\n\n getMessages(messageIds: ListOfIds): never {\n throw new Error('Use withUser method')\n }\n\n listMessagesByInvoiceIds(body?: ListOfIds): never {\n throw new Error('Use withUser method')\n }\n\n listMessagesByTransportGuids(hcpId: string, body?: ListOfIds): never {\n throw new Error('Use withUser method')\n }\n\n modifyMessage(body?: Message): never {\n throw new Error('Use withUser method')\n }\n\n setMessagesStatusBits(status: number, body?: ListOfIds): never {\n throw new Error('Use withUser method')\n }\n\n filterMessagesBy(body: FilterChainMessage, startDocumentId?: string, limit?: number): never {\n throw new Error('Use withUser method')\n }\n\n setMessagesReadStatus(body?: MessagesReadStatusUpdate): never {\n throw new Error('Use withUser method')\n }\n}\n"]}
@@ -65,6 +65,11 @@ export declare class IccPatientXApi extends IccPatientApi implements EncryptedEn
65
65
  ignoreAutoDelegations?: boolean;
66
66
  alternateRootDelegation?: string;
67
67
  }): Promise<models.Patient>;
68
+ /**
69
+ * Ensures patient names are consistent by synchronizing names property with firstName/lastName/maidenName/alias fields.
70
+ * @param patient the patient to process
71
+ * @return the patient with completed names
72
+ */
68
73
  completeNames(patient: models.Patient): models.Patient;
69
74
  /**
70
75
  * @deprecated replace with {@link initConfidentialSecretId}
@@ -79,55 +84,238 @@ export declare class IccPatientXApi extends IccPatientApi implements EncryptedEn
79
84
  */
80
85
  initConfidentialSecretId(patient: models.Patient, user: models.User): Promise<models.Patient>;
81
86
  createPatient(body?: models.Patient): never;
87
+ /**
88
+ * Creates a patient in the database with encryption.
89
+ * @param user the current user
90
+ * @param body the patient data to create
91
+ * @return the created patient
92
+ */
82
93
  createPatientWithUser(user: models.User, body?: models.Patient): Promise<models.Patient | any>;
83
94
  filterBy(startKey?: string, startDocumentId?: string, limit?: number, skip?: number, sort?: string, desc?: boolean, body?: models.FilterChainPatient): never;
95
+ /**
96
+ * Filters patients using a filter chain and returns decrypted results.
97
+ * @param user the current user
98
+ * @param filterChain the filter chain to apply
99
+ * @param startKey optional start key for pagination
100
+ * @param startDocumentId optional start document id for pagination
101
+ * @param limit optional maximum number of results
102
+ * @param skip optional number of results to skip
103
+ * @param sort optional sort field
104
+ * @param desc optional sort direction
105
+ * @return paginated list of decrypted patients
106
+ */
84
107
  filterByWithUser(user: models.User, filterChain: models.FilterChainPatient, startKey?: string, startDocumentId?: string, limit?: number, skip?: number, sort?: string, desc?: boolean): Promise<models.PaginatedListPatient | any>;
85
108
  findByAccessLogUserAfterDate(userId: string, accessType?: string, startDate?: number, startKey?: string, startDocumentId?: string, limit?: number): never;
109
+ /**
110
+ * Finds patients by access log user after a specific date and returns decrypted results.
111
+ * @param user the current user
112
+ * @param userId the user id to search for in access logs
113
+ * @param accessType optional type of access
114
+ * @param startDate optional start date timestamp
115
+ * @param startKey optional start key for pagination
116
+ * @param startDocumentId optional start document id for pagination
117
+ * @param limit optional maximum number of results
118
+ * @return paginated list of decrypted patients
119
+ */
86
120
  findByAccessLogUserAfterDateWithUser(user: models.User, userId: string, accessType?: string, startDate?: number, startKey?: string, startDocumentId?: string, limit?: number): Promise<models.PaginatedListPatient | any>;
87
121
  findByAccessLogUserAfterDate_1(externalId: string): never;
122
+ /**
123
+ * Finds a patient by external id and returns the decrypted result.
124
+ * @param user the current user
125
+ * @param externalId the external id to search for
126
+ * @return the decrypted patient
127
+ */
88
128
  findByExternalIdWithUser(user: models.User, externalId: string): Promise<models.Patient | any>;
89
129
  findByNameBirthSsinAuto(healthcarePartyId?: string, filterValue?: string, startKey?: string, startDocumentId?: string, limit?: number, sortDirection?: string): never;
130
+ /**
131
+ * Finds patients by name, birth date, or SSIN with automatic search and returns decrypted results.
132
+ * @param user the current user
133
+ * @param healthcarePartyId optional healthcare party id
134
+ * @param filterValue optional search value
135
+ * @param startKey optional start key for pagination
136
+ * @param startDocumentId optional start document id for pagination
137
+ * @param limit optional maximum number of results
138
+ * @param sortDirection optional sort direction
139
+ * @return paginated list of decrypted patients
140
+ */
90
141
  findByNameBirthSsinAutoWithUser(user: models.User, healthcarePartyId?: string, filterValue?: string, startKey?: string, startDocumentId?: string, limit?: number, sortDirection?: string): Promise<models.PaginatedListPatient | any>;
91
142
  fuzzySearch(firstName?: string, lastName?: string, dateOfBirth?: number): never;
143
+ /**
144
+ * Performs a fuzzy search for patients and returns decrypted results.
145
+ * @param user the current user
146
+ * @param firstName optional first name to search for
147
+ * @param lastName optional last name to search for
148
+ * @param dateOfBirth optional date of birth timestamp
149
+ * @return array of decrypted patients
150
+ */
92
151
  fuzzySearchWithUser(user: models.User, firstName?: string, lastName?: string, dateOfBirth?: number): Promise<Array<models.Patient> | any>;
93
152
  getPatient(patientId: string): never;
153
+ /**
154
+ * Gets a patient by id without decryption.
155
+ * @param patientId the patient id
156
+ * @return the encrypted patient
157
+ */
94
158
  getPatientRaw(patientId: string): Promise<models.Patient | any>;
159
+ /**
160
+ * Gets a patient by id with decryption.
161
+ * @param user the current user
162
+ * @param patientId the patient id
163
+ * @return the decrypted patient
164
+ */
95
165
  getPatientWithUser(user: models.User, patientId: string): Promise<models.Patient | any>;
166
+ /**
167
+ * Gets a patient by id and indicates whether it was successfully decrypted.
168
+ * @param user the current user
169
+ * @param patientId the patient id
170
+ * @return object containing the patient and a flag indicating if it was decrypted
171
+ */
96
172
  getPotentiallyEncryptedPatientWithUser(user: models.User, patientId: string): Promise<{
97
173
  patient: models.Patient;
98
174
  decrypted: boolean;
99
175
  }>;
100
176
  getPatients(body?: models.ListOfIds): never;
177
+ /**
178
+ * Gets multiple patients by their ids with decryption.
179
+ * @param user the current user
180
+ * @param body list of patient ids
181
+ * @return array of decrypted patients
182
+ */
101
183
  getPatientsWithUser(user: models.User, body?: models.ListOfIds): Promise<Array<models.Patient> | any>;
102
184
  listDeletedPatients(startDate?: number, endDate?: number, desc?: boolean, startKey?: string, startDocumentId?: string, limit?: number): never;
185
+ /**
186
+ * Lists deleted patients with decryption.
187
+ * @param user the current user
188
+ * @param startDate optional start date timestamp
189
+ * @param endDate optional end date timestamp
190
+ * @param desc optional sort direction
191
+ * @param startKey optional start key for pagination
192
+ * @param startDocumentId optional start document id for pagination
193
+ * @param limit optional maximum number of results
194
+ * @return paginated list of decrypted deleted patients
195
+ */
103
196
  listDeletedPatientsWithUser(user: models.User, startDate?: number, endDate?: number, desc?: boolean, startKey?: string, startDocumentId?: string, limit?: number): Promise<models.PaginatedListPatient | any>;
104
197
  listDeletedPatients_2(firstName?: string, lastName?: string): never;
198
+ /**
199
+ * Lists deleted patients by name with decryption.
200
+ * @param user the current user
201
+ * @param firstName optional first name to filter by
202
+ * @param lastName optional last name to filter by
203
+ * @return array of decrypted deleted patients
204
+ */
105
205
  listDeletedPatientsByNameWithUser(user: models.User, firstName?: string, lastName?: string): Promise<Array<models.Patient> | any>;
106
206
  listOfMergesAfter(date: number): never;
207
+ /**
208
+ * Lists merged patients after a specific date with decryption.
209
+ * @param user the current user
210
+ * @param date timestamp to start from
211
+ * @return array of decrypted merged patients
212
+ */
107
213
  listOfMergesAfterWithUser(user: models.User, date: number): Promise<Array<models.Patient> | any>;
108
214
  listOfPatientsModifiedAfter(date: number, startKey?: number, startDocumentId?: string, limit?: number): never;
215
+ /**
216
+ * Lists patients modified after a specific date with decryption.
217
+ * @param user the current user
218
+ * @param date timestamp to start from
219
+ * @param startKey optional start key for pagination
220
+ * @param startDocumentId optional start document id for pagination
221
+ * @param limit optional maximum number of results
222
+ * @return paginated list of decrypted modified patients
223
+ */
109
224
  listOfPatientsModifiedAfterWithUser(user: models.User, date: number, startKey?: number, startDocumentId?: string, limit?: number): Promise<models.PaginatedListPatient | any>;
110
225
  listPatients(hcPartyId?: string, sortField?: string, startKey?: string, startDocumentId?: string, limit?: number, sortDirection?: string): never;
226
+ /**
227
+ * Lists patients with decryption.
228
+ * @param user the current user
229
+ * @param hcPartyId optional healthcare party id
230
+ * @param sortField optional sort field
231
+ * @param startKey optional start key for pagination
232
+ * @param startDocumentId optional start document id for pagination
233
+ * @param limit optional maximum number of results
234
+ * @param sortDirection optional sort direction
235
+ * @return paginated list of decrypted patients
236
+ */
111
237
  listPatientsWithUser(user: models.User, hcPartyId?: string, sortField?: string, startKey?: string, startDocumentId?: string, limit?: number, sortDirection?: string): Promise<models.PaginatedListPatient | any>;
112
238
  listPatientsByHcParty(hcPartyId: string, sortField?: string, startKey?: string, startDocumentId?: string, limit?: number, sortDirection?: string): never;
239
+ /**
240
+ * Lists patients by healthcare party with decryption.
241
+ * @param user the current user
242
+ * @param hcPartyId the healthcare party id
243
+ * @param sortField optional sort field
244
+ * @param startKey optional start key for pagination
245
+ * @param startDocumentId optional start document id for pagination
246
+ * @param limit optional maximum number of results
247
+ * @param sortDirection optional sort direction
248
+ * @return paginated list of decrypted patients
249
+ */
113
250
  listPatientsByHcPartyWithUser(user: models.User, hcPartyId: string, sortField?: string, startKey?: string, startDocumentId?: string, limit?: number, sortDirection?: string): Promise<models.PaginatedListPatient | any>;
114
251
  listPatientsOfHcParty(hcPartyId: string, sortField?: string, startKey?: string, startDocumentId?: string, limit?: number, sortDirection?: string): never;
252
+ /**
253
+ * Lists patients of a healthcare party with decryption.
254
+ * @param user the current user
255
+ * @param hcPartyId the healthcare party id
256
+ * @param sortField optional sort field
257
+ * @param startKey optional start key for pagination
258
+ * @param startDocumentId optional start document id for pagination
259
+ * @param limit optional maximum number of results
260
+ * @param sortDirection optional sort direction
261
+ * @return paginated list of decrypted patients
262
+ */
115
263
  listPatientsOfHcPartyWithUser(user: models.User, hcPartyId: string, sortField?: string, startKey?: string, startDocumentId?: string, limit?: number, sortDirection?: string): Promise<models.PaginatedListPatient | any>;
116
264
  mergeInto(toId: string, fromIds: string): never;
265
+ /**
266
+ * Merges patients and returns the decrypted result.
267
+ * @param user the current user
268
+ * @param toId the target patient id
269
+ * @param fromIds the source patient ids to merge from
270
+ * @return the decrypted merged patient
271
+ */
117
272
  mergeIntoWithUser(user: models.User, toId: string, fromIds: string): Promise<models.Patient | any>;
118
273
  modifyPatient(body?: models.Patient): never;
119
274
  /**
120
275
  * @internal this method is for internal use only and may be changed without notice.
121
276
  */
122
277
  modifyPatientRaw(body?: models.Patient): Promise<models.Patient | any>;
278
+ /**
279
+ * Updates a patient with encryption.
280
+ * @param user the current user
281
+ * @param body the patient data to update
282
+ * @return the updated decrypted patient
283
+ */
123
284
  modifyPatientWithUser(user: models.User, body?: models.Patient): Promise<models.Patient | null>;
124
285
  private modifyPatientAs;
125
286
  modifyPatientReferral(patientId: string, referralId: string, start?: number, end?: number): never;
287
+ /**
288
+ * Updates a patient referral and returns the decrypted result.
289
+ * @param user the current user
290
+ * @param patientId the patient id
291
+ * @param referralId the referral id
292
+ * @param start optional start timestamp
293
+ * @param end optional end timestamp
294
+ * @return the updated decrypted patient
295
+ */
126
296
  modifyPatientReferralWithUser(user: models.User, patientId: string, referralId: string, start?: number, end?: number): Promise<models.Patient | any>;
297
+ /**
298
+ * Encrypts patients using the current user's encryption keys.
299
+ * @param user the current user
300
+ * @param pats the patients to encrypt
301
+ * @return the encrypted patients
302
+ */
127
303
  encrypt(user: models.User, pats: Array<models.Patient>): Promise<Array<models.Patient>>;
128
304
  private encryptAs;
305
+ /**
306
+ * Decrypts patients using the current user's encryption keys. If a patient can't be decrypted, returns it with encrypted data.
307
+ * @param user the current user
308
+ * @param patients the patients to decrypt
309
+ * @param fillDelegations optional flag to fill delegations (defaults to true)
310
+ * @return the decrypted patients
311
+ */
129
312
  decrypt(user: models.User, patients: Array<models.Patient>, fillDelegations?: boolean): Promise<Array<models.Patient>>;
130
313
  private decryptAs;
314
+ /**
315
+ * Attempts to decrypt patients. If decryption fails, returns the original encrypted patients.
316
+ * @param patients the patients to decrypt
317
+ * @return array of objects containing the patient entity and a flag indicating if it was decrypted
318
+ */
131
319
  tryDecryptOrReturnOriginal(patients: Array<models.Patient>): Promise<{
132
320
  entity: models.Patient;
133
321
  decrypted: boolean;
@@ -146,6 +334,16 @@ export declare class IccPatientXApi extends IccPatientApi implements EncryptedEn
146
334
  };
147
335
  };
148
336
  } | null>;
337
+ /**
338
+ * Shares a patient and all related data with specified delegates.
339
+ * @param user the current user
340
+ * @param patId the patient id
341
+ * @param ownerId the owner healthcare party id
342
+ * @param delegateIds the delegate ids to share with
343
+ * @param delegationTags tags specifying what data to share (e.g., medicalInformation, financialInformation, all)
344
+ * @param usingPost optional flag to use POST method instead of GET (defaults to false)
345
+ * @return object containing the updated patient and sharing statuses for each entity type
346
+ */
149
347
  shareAllDataOfPatient(user: models.User, patId: string, ownerId: string, delegateIds: Array<string>, delegationTags: {
150
348
  [key: string]: Array<string>;
151
349
  }, usingPost?: boolean): Promise<{
@@ -157,6 +355,13 @@ export declare class IccPatientXApi extends IccPatientApi implements EncryptedEn
157
355
  };
158
356
  };
159
357
  } | null>;
358
+ /**
359
+ * Exports a patient and all related medical data.
360
+ * @param user the current user
361
+ * @param patId the patient id
362
+ * @param ownerId the owner healthcare party id
363
+ * @return object containing the patient and all related entities (contacts, forms, health elements, invoices, classifications, calendar items, documents)
364
+ */
160
365
  export(user: models.User, patId: string, ownerId: string): Promise<{
161
366
  id: string;
162
367
  patient: Patient | null;
@@ -168,8 +373,25 @@ export declare class IccPatientXApi extends IccPatientApi implements EncryptedEn
168
373
  calItems: models.CalendarItem[];
169
374
  documents: models.Document[];
170
375
  }>;
376
+ /**
377
+ * Validates a Belgian INAMI number using modulo 97 check.
378
+ * @param inami the INAMI number to validate
379
+ * @return true if the INAMI number is valid, false otherwise
380
+ */
171
381
  checkInami(inami: string): boolean;
382
+ /**
383
+ * Validates a Belgian social security identification number (SSIN/NISS) including support for bis and ter numbers.
384
+ * @param ssin the SSIN to validate
385
+ * @return true if the SSIN is valid, false otherwise
386
+ */
172
387
  isValidSsin(ssin: string): boolean;
388
+ /**
389
+ * Extracts the patient id from a child document, following merge chains if necessary.
390
+ * @param childDocument the child document (invoice, calendar item, contact, or access log)
391
+ * @param hcpId the healthcare party id
392
+ * @param childDocumentType the type of the child document
393
+ * @return the patient id after following any merge chains
394
+ */
173
395
  getPatientIdOfChildDocumentForHcpAndHcpParents(childDocument: models.Invoice | models.CalendarItem | models.Contact | models.AccessLog, hcpId: string, childDocumentType: EntityWithDelegationTypeName): Promise<string>;
174
396
  /**
175
397
  * @return if the logged data owner has write access to the content of the given patient
@@ -255,12 +477,22 @@ export declare class IccPatientXApi extends IccPatientApi implements EncryptedEn
255
477
  * patient is the 'owning entity', or in the {@link shareWith} method in order to share it with other data owners.
256
478
  */
257
479
  decryptNonConfidentialSecretIdsOf(patient: models.Patient): Promise<string[]>;
480
+ /**
481
+ * Gets all data owners with access to the patient and their permission levels.
482
+ * @param entity the patient
483
+ * @return object containing permissions by data owner id and a flag indicating if there are unknown anonymous data owners
484
+ */
258
485
  getDataOwnersWithAccessTo(entity: models.Patient): Promise<{
259
486
  permissionsByDataOwnerId: {
260
487
  [p: string]: AccessLevelEnum;
261
488
  };
262
489
  hasUnknownAnonymousDataOwners: boolean;
263
490
  }>;
491
+ /**
492
+ * Gets all encryption keys of the patient that the current user can decrypt.
493
+ * @param entity the patient
494
+ * @return array of encryption keys
495
+ */
264
496
  getEncryptionKeysOf(entity: models.Patient): Promise<string[]>;
265
497
  /**
266
498
  * Merge two patients into one. This method performs the following operations:
@@ -300,7 +532,20 @@ export declare class IccPatientXApi extends IccPatientApi implements EncryptedEn
300
532
  * @return the updated `into` patient.
301
533
  */
302
534
  mergePatients(from: Patient, mergedInto: Patient): Promise<Patient>;
535
+ /**
536
+ * Subscribes to patient events (create, update, delete) and automatically decrypts them.
537
+ * @param eventTypes the types of events to subscribe to
538
+ * @param filter optional filter to apply to events
539
+ * @param eventFired callback function to handle each event
540
+ * @param options optional subscription options
541
+ * @return connection object to manage the subscription
542
+ */
303
543
  subscribeToPatientEvents(eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[], filter: AbstractFilter<Patient> | undefined, eventFired: (patient: Patient) => Promise<void>, options?: SubscriptionOptions): Promise<Connection>;
544
+ /**
545
+ * Creates or updates de-anonymization metadata for patient delegations.
546
+ * @param entity the patient
547
+ * @param delegates array of delegate ids to create metadata for
548
+ */
304
549
  createDelegationDeAnonymizationMetadata(entity: Patient, delegates: string[]): Promise<void>;
305
550
  /**
306
551
  * Initializes the exchange data towards a newly invited patient. This allows the doctor to share data with the