@icure/api 7.0.0-beta.3 → 7.0.0
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.js +2 -1
- package/icc-api/api/IccAccesslogApi.js.map +1 -1
- package/icc-api/api/IccAgendaApi.js +2 -1
- package/icc-api/api/IccAgendaApi.js.map +1 -1
- package/icc-api/api/IccAnonymousAccessApi.js +2 -1
- package/icc-api/api/IccAnonymousAccessApi.js.map +1 -1
- package/icc-api/api/IccApplicationsettingsApi.js +2 -1
- package/icc-api/api/IccApplicationsettingsApi.js.map +1 -1
- package/icc-api/api/IccArticleApi.js +2 -1
- package/icc-api/api/IccArticleApi.js.map +1 -1
- package/icc-api/api/IccAuthApi.d.ts +23 -0
- package/icc-api/api/IccAuthApi.js +59 -2
- package/icc-api/api/IccAuthApi.js.map +1 -1
- package/icc-api/api/IccBeefactApi.js +2 -1
- package/icc-api/api/IccBeefactApi.js.map +1 -1
- package/icc-api/api/IccBekmehrApi.js +2 -1
- package/icc-api/api/IccBekmehrApi.js.map +1 -1
- package/icc-api/api/IccBeresultexportApi.js +2 -1
- package/icc-api/api/IccBeresultexportApi.js.map +1 -1
- package/icc-api/api/IccBeresultimportApi.js +2 -1
- package/icc-api/api/IccBeresultimportApi.js.map +1 -1
- package/icc-api/api/IccBesamv2Api.d.ts +6 -0
- package/icc-api/api/IccBesamv2Api.js +15 -1
- package/icc-api/api/IccBesamv2Api.js.map +1 -1
- package/icc-api/api/IccCalendarItemApi.js +2 -1
- package/icc-api/api/IccCalendarItemApi.js.map +1 -1
- package/icc-api/api/IccCalendarItemTypeApi.js +2 -1
- package/icc-api/api/IccCalendarItemTypeApi.js.map +1 -1
- package/icc-api/api/IccClassificationApi.js +2 -1
- package/icc-api/api/IccClassificationApi.js.map +1 -1
- package/icc-api/api/IccClassificationTemplateApi.js +2 -1
- package/icc-api/api/IccClassificationTemplateApi.js.map +1 -1
- package/icc-api/api/IccCodeApi.js +2 -1
- package/icc-api/api/IccCodeApi.js.map +1 -1
- package/icc-api/api/IccContactApi.d.ts +6 -0
- package/icc-api/api/IccContactApi.js +26 -1
- package/icc-api/api/IccContactApi.js.map +1 -1
- package/icc-api/api/IccDataownerApi.js +2 -1
- package/icc-api/api/IccDataownerApi.js.map +1 -1
- package/icc-api/api/IccDeviceApi.js +2 -1
- package/icc-api/api/IccDeviceApi.js.map +1 -1
- package/icc-api/api/IccDoctemplateApi.js +2 -1
- package/icc-api/api/IccDoctemplateApi.js.map +1 -1
- package/icc-api/api/IccDocumentApi.d.ts +6 -4
- package/icc-api/api/IccDocumentApi.js +10 -6
- package/icc-api/api/IccDocumentApi.js.map +1 -1
- package/icc-api/api/IccDocumentTemplateApi.js +2 -1
- package/icc-api/api/IccDocumentTemplateApi.js.map +1 -1
- package/icc-api/api/IccEntityrefApi.js +2 -1
- package/icc-api/api/IccEntityrefApi.js.map +1 -1
- package/icc-api/api/IccEntitytemplateApi.js +2 -1
- package/icc-api/api/IccEntitytemplateApi.js.map +1 -1
- package/icc-api/api/IccFormApi.js +2 -1
- package/icc-api/api/IccFormApi.js.map +1 -1
- package/icc-api/api/IccFrontendmigrationApi.js +2 -1
- package/icc-api/api/IccFrontendmigrationApi.js.map +1 -1
- package/icc-api/api/IccGroupApi.d.ts +6 -0
- package/icc-api/api/IccGroupApi.js +15 -1
- package/icc-api/api/IccGroupApi.js.map +1 -1
- package/icc-api/api/IccHcpartyApi.js +2 -1
- package/icc-api/api/IccHcpartyApi.js.map +1 -1
- package/icc-api/api/IccHelementApi.js +2 -1
- package/icc-api/api/IccHelementApi.js.map +1 -1
- package/icc-api/api/IccIcureApi.js +2 -1
- package/icc-api/api/IccIcureApi.js.map +1 -1
- package/icc-api/api/IccInsuranceApi.js +2 -1
- package/icc-api/api/IccInsuranceApi.js.map +1 -1
- package/icc-api/api/IccInvoiceApi.js +2 -1
- package/icc-api/api/IccInvoiceApi.js.map +1 -1
- package/icc-api/api/IccKeywordApi.js +2 -1
- package/icc-api/api/IccKeywordApi.js.map +1 -1
- package/icc-api/api/IccMaintenanceTaskApi.js +2 -1
- package/icc-api/api/IccMaintenanceTaskApi.js.map +1 -1
- package/icc-api/api/IccMedexApi.js +2 -1
- package/icc-api/api/IccMedexApi.js.map +1 -1
- package/icc-api/api/IccMedicallocationApi.js +2 -1
- package/icc-api/api/IccMedicallocationApi.js.map +1 -1
- package/icc-api/api/IccMessageApi.js +2 -1
- package/icc-api/api/IccMessageApi.js.map +1 -1
- package/icc-api/api/IccPatientApi.js +2 -1
- package/icc-api/api/IccPatientApi.js.map +1 -1
- package/icc-api/api/IccPermissionApi.js +2 -1
- package/icc-api/api/IccPermissionApi.js.map +1 -1
- package/icc-api/api/IccPlaceApi.js +2 -1
- package/icc-api/api/IccPlaceApi.js.map +1 -1
- package/icc-api/api/IccPubsubApi.js +2 -1
- package/icc-api/api/IccPubsubApi.js.map +1 -1
- package/icc-api/api/IccReceiptApi.js +2 -1
- package/icc-api/api/IccReceiptApi.js.map +1 -1
- package/icc-api/api/IccReplicationApi.js +2 -1
- package/icc-api/api/IccReplicationApi.js.map +1 -1
- package/icc-api/api/IccRestApiPath.d.ts +1 -0
- package/icc-api/api/IccRestApiPath.js +10 -0
- package/icc-api/api/IccRestApiPath.js.map +1 -0
- package/icc-api/api/IccTarificationApi.js +2 -1
- package/icc-api/api/IccTarificationApi.js.map +1 -1
- package/icc-api/api/IccTimeTableApi.js +2 -1
- package/icc-api/api/IccTimeTableApi.js.map +1 -1
- package/icc-api/api/IccTmpApi.js +2 -1
- package/icc-api/api/IccTmpApi.js.map +1 -1
- package/icc-api/api/IccUserApi.js +2 -1
- package/icc-api/api/IccUserApi.js.map +1 -1
- package/icc-api/index.d.ts +0 -1
- package/icc-api/index.js +0 -1
- package/icc-api/index.js.map +1 -1
- package/icc-api/model/Address.d.ts +6 -0
- package/icc-api/model/Address.js.map +1 -1
- package/icc-api/model/Annotation.d.ts +18 -0
- package/icc-api/model/Annotation.js.map +1 -1
- package/icc-api/model/AuthenticationToken.d.ts +1 -0
- package/icc-api/model/AuthenticationToken.js.map +1 -1
- package/icc-api/model/Content.js +1 -1
- package/icc-api/model/Content.js.map +1 -1
- package/icc-api/model/CryptoActorStub.d.ts +5 -0
- package/icc-api/model/CryptoActorStub.js +1 -0
- package/icc-api/model/CryptoActorStub.js.map +1 -1
- package/icc-api/model/Delegation.d.ts +3 -0
- package/icc-api/model/Delegation.js.map +1 -1
- package/icc-api/model/FlatRateTarification.d.ts +4 -1
- package/icc-api/model/FlatRateTarification.js +3 -0
- package/icc-api/model/FlatRateTarification.js.map +1 -1
- package/icc-api/model/HealthElement.d.ts +6 -0
- package/icc-api/model/HealthElement.js.map +1 -1
- package/icc-api/model/HealthcareParty.js +1 -1
- package/icc-api/model/HealthcareParty.js.map +1 -1
- package/icc-api/model/ISO639_1.d.ts +8 -0
- package/icc-api/model/ISO639_1.js +3 -0
- package/icc-api/model/ISO639_1.js.map +1 -0
- package/icc-api/model/Patient.d.ts +7 -0
- package/icc-api/model/Patient.js +1 -1
- package/icc-api/model/Patient.js.map +1 -1
- package/icc-api/model/UserGroup.d.ts +1 -0
- package/icc-api/model/UserGroup.js.map +1 -1
- package/icc-api/model/models.d.ts +1 -0
- package/icc-api/model/models.js.map +1 -1
- package/icc-x-api/auth/AuthenticationProvider.d.ts +67 -6
- package/icc-x-api/auth/AuthenticationProvider.js +100 -7
- package/icc-x-api/auth/AuthenticationProvider.js.map +1 -1
- package/icc-x-api/auth/EnsembleAuthService.d.ts +7 -2
- package/icc-x-api/auth/EnsembleAuthService.js +9 -0
- package/icc-x-api/auth/EnsembleAuthService.js.map +1 -1
- package/icc-x-api/auth/JwtAuthService.d.ts +10 -5
- package/icc-x-api/auth/JwtAuthService.js +22 -26
- package/icc-x-api/auth/JwtAuthService.js.map +1 -1
- package/icc-x-api/auth/JwtBridgedAuthService.d.ts +27 -0
- package/icc-x-api/auth/JwtBridgedAuthService.js +131 -0
- package/icc-x-api/auth/JwtBridgedAuthService.js.map +1 -0
- package/icc-x-api/crypto/EntitiesEncryption.d.ts +5 -4
- package/icc-x-api/crypto/EntitiesEncryption.js +20 -16
- package/icc-x-api/crypto/EntitiesEncryption.js.map +1 -1
- package/icc-x-api/filters/ServiceByHcPartyTagCodeDateFilter.d.ts +1 -0
- package/icc-x-api/filters/ServiceByHcPartyTagCodeDateFilter.js.map +1 -1
- package/icc-x-api/filters/filters.d.ts +4 -0
- package/icc-x-api/filters/filters.js +4 -0
- package/icc-x-api/filters/filters.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.d.ts +2 -2
- package/icc-x-api/icc-accesslog-x-api.js +17 -24
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +1 -1
- package/icc-x-api/icc-calendar-item-x-api.js +18 -22
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.js +13 -19
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +17 -1
- package/icc-x-api/icc-contact-x-api.js +81 -99
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-data-owner-x-api.d.ts +1 -1
- package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
- package/icc-x-api/icc-doctemplate-x-api.js +2 -13
- package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +12 -4
- package/icc-x-api/icc-document-x-api.js +29 -25
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.js +13 -17
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +1 -1
- package/icc-x-api/icc-helement-x-api.js +15 -20
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-icure-maintenance-x-api.js +4 -4
- package/icc-x-api/icc-icure-maintenance-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.js +13 -19
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.d.ts +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.js +13 -14
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.js +13 -18
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +5 -2
- package/icc-x-api/icc-patient-x-api.js +17 -24
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.js +11 -16
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-time-table-x-api.js +11 -16
- package/icc-x-api/icc-time-table-x-api.js.map +1 -1
- package/icc-x-api/index.d.ts +284 -35
- package/icc-x-api/index.js +303 -79
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/maintenance/KeyPairUpdateRequest.d.ts +12 -9
- package/icc-x-api/maintenance/KeyPairUpdateRequest.js +11 -17
- package/icc-x-api/maintenance/KeyPairUpdateRequest.js.map +1 -1
- package/icc-x-api/utils/crypto-utils.d.ts +140 -11
- package/icc-x-api/utils/crypto-utils.js +285 -36
- package/icc-x-api/utils/crypto-utils.js.map +1 -1
- package/package.json +1 -1
- package/icc-api/api/IccBemikronoApi.d.ts +0 -81
- package/icc-api/api/IccBemikronoApi.js +0 -162
- package/icc-api/api/IccBemikronoApi.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-receipt-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-receipt-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA0C;AAE1C,4BAA2B;AAC3B,kDAAiD;AAEjD,0EAAgG;AAIhG,MAAa,cAAe,SAAQ,uBAAa;IAG/C,YACE,IAAY,EACZ,OAAkC,EAC1B,MAAqB,EAC7B,YAA8B,EAC9B,yBAAiD,IAAI,iDAAwB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AC,aAAa,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,uCAAuC,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAA;QAC/H,CAAC;KAAA;IAEK,yBAAyB,CAAC,MAAsB;;YAIpD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAA;QACrE,CAAC;KAAA;IAEK,mBAAmB,CAAC,MAAsB;;YAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;QAC5D,CAAC;KAAA;CACF;AA3LD,wCA2LC","sourcesContent":["import { IccReceiptApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport * as _ from 'lodash'\nimport * as models from '../icc-api/model/models'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\n\nexport class IccReceiptXApi extends IccReceiptApi implements EncryptedEntityXApi<models.Receipt> {\n dataOwnerApi: IccDataOwnerXApi\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\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 ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.dataOwnerApi = dataOwnerApi\n }\n\n /**\n * Creates a new instance of receipt with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param r initialised data for the receipt. 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. Currently only WRITE access is supported, but in future also read\n * access will be possible.\n * @return a new instance of receipt.\n */\n async newInstance(\n user: models.User,\n r: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: 'WRITE' }\n } = {}\n ): Promise<models.Receipt> {\n const receipt = new models.Receipt(\n _.extend(\n {\n id: this.crypto.randomUuid(),\n _type: 'org.taktik.icure.entities.Receipt',\n created: new Date().getTime(),\n modified: new Date().getTime(),\n responsible: this.dataOwnerApi.getDataOwnerIdOf(user),\n author: user.id,\n codes: [],\n tags: [],\n },\n r || {}\n )\n )\n\n const extraDelegations = [\n ...Object.keys(options.additionalDelegates ?? {}),\n ...(user.autoDelegations?.all ?? []),\n ...(user.autoDelegations?.medicalInformation ?? []),\n ]\n return new models.Receipt(\n await this.crypto.entities\n .entityWithInitialisedEncryptedMetadata(receipt, undefined, undefined, true, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n logReceipt(user: models.User, docId: string, refs: Array<string>, blobType: string, blob: ArrayBuffer) {\n return this.newInstance(user, { documentId: docId, references: refs })\n .then((rcpt) => this.createReceipt(rcpt))\n .then((rcpt) => (blob.byteLength != 0 ? this.setReceiptAttachment(rcpt.id!, blobType, '', <any>blob) : Promise.resolve(rcpt)))\n }\n\n /**\n * Adds an attachment to a receipt, encrypting it on client side using the encryption keys of the provided receipt.\n * @param receipt a receipt.\n * @param blobType the type of the attachment.\n * @param attachment a attachment for the receipt.\n * @return the updated receipt.\n */\n async encryptAndSetReceiptAttachment(receipt: models.Receipt, blobType: string, attachment: ArrayBuffer | Uint8Array): Promise<models.Receipt> {\n const encryptedData = await this.crypto.entities.encryptDataOf(receipt, attachment)\n return await this.setReceiptAttachment(receipt.id!, blobType, undefined, encryptedData)\n }\n\n /**\n * Adds an unencrypted attachment to a receipt.\n * @param receipt a receipt.\n * @param blobType the type of the attachment.\n * @param attachment a attachment for the receipt.\n * @return the updated receipt.\n */\n async setClearReceiptAttachment(receipt: models.Receipt, blobType: string, attachment: ArrayBuffer | Uint8Array): Promise<models.Receipt> {\n return await this.setReceiptAttachment(receipt.id!, blobType, undefined, attachment)\n }\n\n /**\n * Gets the attachment of a receipt and tries to decrypt it using the encryption keys of the receipt, throwing an error if the operation fails.\n * @param receipt a receipt.\n * @param attachmentId id of the attachment of this receipt to retrieve.\n * @param validator optionally a validator function which checks if the decryption was successful. In cases where the receipt has many encryption\n * keys and it is unclear which one should be used this function can help to detect bad decryptions.\n * @return the decrypted attachment, if it could be decrypted, else the encrypted attachment.\n */\n async getAndDecryptReceiptAttachment(\n receipt: models.Receipt,\n attachmentId: string,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<ArrayBuffer> {\n const { data, wasDecrypted } = await this.crypto.entities.tryDecryptDataOf(\n receipt,\n await this.getReceiptAttachment(receipt.id!, attachmentId, ''),\n (x) => validator(x)\n )\n if (!wasDecrypted) throw new Error(`No valid key found to decrypt data of receipt ${receipt.id}.`)\n return data\n }\n\n /**\n * Gets the attachment of a receipt and tries to decrypt it using the encryption keys of the receipt.\n * @param receipt a receipt.\n * @param attachmentId id of the attachment of this receipt to retrieve.\n * @param validator optionally a validator function which checks if the decryption was successful. In cases where the receipt has many encryption\n * keys and it is unclear which one should be used this function can help to detect bad decryptions.\n * @return an object containing:\n * - data: the decrypted attachment, if it could be decrypted, else the encrypted attachment.\n * - wasDecrypted: if the data was successfully decrypted or not\n */\n async getAndTryDecryptReceiptAttachment(\n receipt: models.Receipt,\n attachmentId: string,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<{ data: ArrayBuffer; wasDecrypted: boolean }> {\n return await this.crypto.entities.tryDecryptDataOf(receipt, await this.getReceiptAttachment(receipt.id!, attachmentId, ''), (x) => validator(x))\n }\n\n /**\n * Share an existing receipt with other data owners, allowing them to access the non-encrypted data of the receipt and optionally also\n * the encrypted content.\n * @param delegateId the id of the data owner which will be granted access to the receipt.\n * @param receipt the receipt to share.\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 * receipt does not have encrypted content.\n * @return a promise which will contain the updated receipt.\n */\n async shareWith(\n delegateId: string,\n receipt: models.Receipt,\n options: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Receipt> {\n return this.shareWithMany(receipt, { [delegateId]: options })\n }\n\n /**\n * Share an existing receipt with other data owners, allowing them to access the non-encrypted data of the receipt and optionally also\n * the encrypted content.\n * @param receipt the receipt to share.\n * @param delegates sharing options for each delegate which will gain access to the entity:\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 * receipt does not have encrypted content.\n * @return a promise which will contain the updated receipt.\n */\n async shareWithMany(\n receipt: models.Receipt,\n delegates: {\n [delegateId: string]: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Receipt> {\n return await this.modifyReceipt(await this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(receipt, true, delegates))\n }\n\n async getDataOwnersWithAccessTo(entity: models.Receipt): Promise<{\n permissionsByDataOwnerId: { [dataOwnerId: string]: 'WRITE' }\n hasUnknownAnonymousDataOwners: boolean\n }> {\n return await this.crypto.entities.getDataOwnersWithAccessTo(entity)\n }\n\n async getEncryptionKeysOf(entity: models.Receipt): Promise<string[]> {\n return await this.crypto.entities.encryptionKeysOf(entity)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sourcesContent":["import { IccReceiptApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport * as _ from 'lodash'\nimport * as models from '../icc-api/model/models'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\n\nexport class IccReceiptXApi extends IccReceiptApi implements EncryptedEntityXApi<models.Receipt> {\n dataOwnerApi: IccDataOwnerXApi\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\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 ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.dataOwnerApi = dataOwnerApi\n }\n\n /**\n * Creates a new instance of receipt with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param r initialised data for the receipt. 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. Currently only WRITE access is supported, but in future also read\n * access will be possible.\n * @return a new instance of receipt.\n */\n async newInstance(\n user: models.User,\n r: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: 'WRITE' }\n } = {}\n ): Promise<models.Receipt> {\n const receipt = new models.Receipt({\n ...(r ?? {}),\n _type: 'org.taktik.icure.entities.Receipt',\n id: r?.id ?? this.crypto.randomUuid(),\n created: r?.created ?? new Date().getTime(),\n modified: r?.modified ?? new Date().getTime(),\n responsible: r?.responsible ?? this.dataOwnerApi.getDataOwnerIdOf(user),\n author: r?.author ?? user.id,\n codes: r?.codes ?? [],\n tags: r?.tags ?? [],\n })\n\n const extraDelegations = [\n ...Object.keys(options.additionalDelegates ?? {}),\n ...(user.autoDelegations?.all ?? []),\n ...(user.autoDelegations?.medicalInformation ?? []),\n ]\n return new models.Receipt(\n await this.crypto.entities\n .entityWithInitialisedEncryptedMetadata(receipt, undefined, undefined, true, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n logReceipt(user: models.User, docId: string, refs: Array<string>, blobType: string, blob: ArrayBuffer) {\n return this.newInstance(user, { documentId: docId, references: refs })\n .then((rcpt) => this.createReceipt(rcpt))\n .then((rcpt) => (blob.byteLength != 0 ? this.setReceiptAttachment(rcpt.id!, blobType, '', <any>blob) : Promise.resolve(rcpt)))\n }\n\n /**\n * Adds an attachment to a receipt, encrypting it on client side using the encryption keys of the provided receipt.\n * @param receipt a receipt.\n * @param blobType the type of the attachment.\n * @param attachment a attachment for the receipt.\n * @return the updated receipt.\n */\n async encryptAndSetReceiptAttachment(receipt: models.Receipt, blobType: string, attachment: ArrayBuffer | Uint8Array): Promise<models.Receipt> {\n const encryptedData = await this.crypto.entities.encryptDataOf(receipt, attachment)\n return await this.setReceiptAttachment(receipt.id!, blobType, undefined, encryptedData)\n }\n\n /**\n * Adds an unencrypted attachment to a receipt.\n * @param receipt a receipt.\n * @param blobType the type of the attachment.\n * @param attachment a attachment for the receipt.\n * @return the updated receipt.\n */\n async setClearReceiptAttachment(receipt: models.Receipt, blobType: string, attachment: ArrayBuffer | Uint8Array): Promise<models.Receipt> {\n return await this.setReceiptAttachment(receipt.id!, blobType, undefined, attachment)\n }\n\n /**\n * Gets the attachment of a receipt and tries to decrypt it using the encryption keys of the receipt, throwing an error if the operation fails.\n * @param receipt a receipt.\n * @param attachmentId id of the attachment of this receipt to retrieve.\n * @param validator optionally a validator function which checks if the decryption was successful. In cases where the receipt has many encryption\n * keys and it is unclear which one should be used this function can help to detect bad decryptions.\n * @return the decrypted attachment, if it could be decrypted, else the encrypted attachment.\n */\n async getAndDecryptReceiptAttachment(\n receipt: models.Receipt,\n attachmentId: string,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<ArrayBuffer> {\n const { data, wasDecrypted } = await this.crypto.entities.tryDecryptDataOf(\n receipt,\n await this.getReceiptAttachment(receipt.id!, attachmentId, ''),\n (x) => validator(x)\n )\n if (!wasDecrypted) throw new Error(`No valid key found to decrypt data of receipt ${receipt.id}.`)\n return data\n }\n\n /**\n * Gets the attachment of a receipt and tries to decrypt it using the encryption keys of the receipt.\n * @param receipt a receipt.\n * @param attachmentId id of the attachment of this receipt to retrieve.\n * @param validator optionally a validator function which checks if the decryption was successful. In cases where the receipt has many encryption\n * keys and it is unclear which one should be used this function can help to detect bad decryptions.\n * @return an object containing:\n * - data: the decrypted attachment, if it could be decrypted, else the encrypted attachment.\n * - wasDecrypted: if the data was successfully decrypted or not\n */\n async getAndTryDecryptReceiptAttachment(\n receipt: models.Receipt,\n attachmentId: string,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<{ data: ArrayBuffer; wasDecrypted: boolean }> {\n return await this.crypto.entities.tryDecryptDataOf(receipt, await this.getReceiptAttachment(receipt.id!, attachmentId, ''), (x) => validator(x))\n }\n\n /**\n * Share an existing receipt with other data owners, allowing them to access the non-encrypted data of the receipt and optionally also\n * the encrypted content.\n * @param delegateId the id of the data owner which will be granted access to the receipt.\n * @param receipt the receipt to share.\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 * receipt does not have encrypted content.\n * @return a promise which will contain the updated receipt.\n */\n async shareWith(\n delegateId: string,\n receipt: models.Receipt,\n options: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Receipt> {\n return this.shareWithMany(receipt, { [delegateId]: options })\n }\n\n /**\n * Share an existing receipt with other data owners, allowing them to access the non-encrypted data of the receipt and optionally also\n * the encrypted content.\n * @param receipt the receipt to share.\n * @param delegates sharing options for each delegate which will gain access to the entity:\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 * receipt does not have encrypted content.\n * @return a promise which will contain the updated receipt.\n */\n async shareWithMany(\n receipt: models.Receipt,\n delegates: {\n [delegateId: string]: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Receipt> {\n const extended = await this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(receipt, true, delegates)\n if (!!extended) {\n return await this.modifyReceipt(extended)\n } else return receipt\n }\n\n async getDataOwnersWithAccessTo(entity: models.Receipt): Promise<{\n permissionsByDataOwnerId: { [dataOwnerId: string]: 'WRITE' }\n hasUnknownAnonymousDataOwners: boolean\n }> {\n return await this.crypto.entities.getDataOwnersWithAccessTo(entity)\n }\n\n async getEncryptionKeysOf(entity: models.Receipt): Promise<string[]> {\n return await this.crypto.entities.encryptionKeysOf(entity)\n }\n}\n"]}
|
|
@@ -11,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.IccTimeTableXApi = void 0;
|
|
13
13
|
const i18n = require("./rsrc/contact.i18n");
|
|
14
|
-
const _ = require("lodash");
|
|
15
14
|
const icc_api_1 = require("../icc-api");
|
|
16
15
|
const models = require("../icc-api/model/models");
|
|
17
16
|
const AuthenticationProvider_1 = require("./auth/AuthenticationProvider");
|
|
@@ -39,22 +38,13 @@ class IccTimeTableXApi extends icc_api_1.IccTimeTableApi {
|
|
|
39
38
|
* @return a new instance of timetable.
|
|
40
39
|
*/
|
|
41
40
|
newInstance(user, tt, options = {}) {
|
|
42
|
-
var _a, _b, _c, _d, _e;
|
|
41
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
43
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const timeTable =
|
|
45
|
-
id: this.crypto.primitives.randomUuid(),
|
|
46
|
-
_type: 'org.taktik.icure.entities.TimeTable',
|
|
47
|
-
created: new Date().getTime(),
|
|
48
|
-
modified: new Date().getTime(),
|
|
49
|
-
responsible: this.dataOwnerApi.getDataOwnerIdOf(user),
|
|
50
|
-
author: user.id,
|
|
51
|
-
codes: [],
|
|
52
|
-
tags: [],
|
|
53
|
-
}, tt || {});
|
|
43
|
+
const timeTable = Object.assign(Object.assign({}, (tt !== null && tt !== void 0 ? tt : {})), { _type: 'org.taktik.icure.entities.TimeTable', id: (_a = tt === null || tt === void 0 ? void 0 : tt.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = tt === null || tt === void 0 ? void 0 : tt.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = tt === null || tt === void 0 ? void 0 : tt.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), responsible: (_d = tt === null || tt === void 0 ? void 0 : tt.responsible) !== null && _d !== void 0 ? _d : this.dataOwnerApi.getDataOwnerIdOf(user), author: (_e = tt === null || tt === void 0 ? void 0 : tt.author) !== null && _e !== void 0 ? _e : user.id, codes: (_f = tt === null || tt === void 0 ? void 0 : tt.codes) !== null && _f !== void 0 ? _f : [], tags: (_g = tt === null || tt === void 0 ? void 0 : tt.tags) !== null && _g !== void 0 ? _g : [] });
|
|
54
44
|
const extraDelegations = [
|
|
55
|
-
...Object.keys((
|
|
56
|
-
...((
|
|
57
|
-
...((
|
|
45
|
+
...Object.keys((_h = options.additionalDelegates) !== null && _h !== void 0 ? _h : {}),
|
|
46
|
+
...((_k = (_j = user.autoDelegations) === null || _j === void 0 ? void 0 : _j.all) !== null && _k !== void 0 ? _k : []),
|
|
47
|
+
...((_m = (_l = user.autoDelegations) === null || _l === void 0 ? void 0 : _l.administrativeData) !== null && _m !== void 0 ? _m : []),
|
|
58
48
|
];
|
|
59
49
|
return new models.TimeTable(yield this.crypto.entities
|
|
60
50
|
.entityWithInitialisedEncryptedMetadata(timeTable, undefined, undefined, true, extraDelegations)
|
|
@@ -91,7 +81,12 @@ class IccTimeTableXApi extends icc_api_1.IccTimeTableApi {
|
|
|
91
81
|
*/
|
|
92
82
|
shareWithMany(timeTable, delegates) {
|
|
93
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
|
|
84
|
+
const extended = yield this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(timeTable, true, delegates);
|
|
85
|
+
if (!!extended) {
|
|
86
|
+
return yield this.modifyTimeTable(extended);
|
|
87
|
+
}
|
|
88
|
+
else
|
|
89
|
+
return timeTable;
|
|
95
90
|
});
|
|
96
91
|
}
|
|
97
92
|
getDataOwnersWithAccessTo(entity) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-time-table-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-time-table-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA2C;
|
|
1
|
+
{"version":3,"file":"icc-time-table-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-time-table-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA2C;AAG3C,wCAA4C;AAK5C,kDAAiD;AACjD,0EAAgG;AAIhG,MAAa,gBAAiB,SAAQ,yBAAe;IAKnD,YACE,IAAY,EACZ,OAAkC,EAClC,MAAqB,EACrB,YAA8B,EAC9B,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,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B,CAAC,MAAwB;;YAChD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;QAC5D,CAAC;KAAA;CACF;AAzHD,4CAyHC","sourcesContent":["import * as i18n from './rsrc/contact.i18n'\n\nimport * as _ from 'lodash'\nimport { IccTimeTableApi } from '../icc-api'\nimport { User } from '../icc-api/model/User'\nimport { TimeTable } from '../icc-api/model/TimeTable'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport * as models from '../icc-api/model/models'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\n\nexport class IccTimeTableXApi extends IccTimeTableApi implements EncryptedEntityXApi<TimeTable> {\n i18n: any = i18n\n crypto: IccCryptoXApi\n dataOwnerApi: IccDataOwnerXApi\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\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 ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.crypto = crypto\n this.dataOwnerApi = dataOwnerApi\n }\n\n /**\n * Creates a new instance of timetable with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param tt initialised data for the timetable. 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. Currently only WRITE access is supported, but in future also read\n * access will be possible.\n * @return a new instance of timetable.\n */\n async newInstance(\n user: User,\n tt: TimeTable,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: 'WRITE' }\n } = {}\n ) {\n const timeTable = {\n ...(tt ?? {}),\n _type: 'org.taktik.icure.entities.TimeTable',\n id: tt?.id ?? this.crypto.primitives.randomUuid(),\n created: tt?.created ?? new Date().getTime(),\n modified: tt?.modified ?? new Date().getTime(),\n responsible: tt?.responsible ?? this.dataOwnerApi.getDataOwnerIdOf(user),\n author: tt?.author ?? user.id,\n codes: tt?.codes ?? [],\n tags: tt?.tags ?? [],\n }\n\n const extraDelegations = [\n ...Object.keys(options.additionalDelegates ?? {}),\n ...(user.autoDelegations?.all ?? []),\n ...(user.autoDelegations?.administrativeData ?? []),\n ]\n return new models.TimeTable(\n await this.crypto.entities\n .entityWithInitialisedEncryptedMetadata(timeTable, undefined, undefined, true, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n /**\n * Share an existing time table with other data owners, allowing them to access the non-encrypted data of the time table 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 time table.\n * @param timeTable the time table to share.\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 * time table does not have encrypted content.\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 shareWith(\n delegateId: string,\n timeTable: models.TimeTable,\n options: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.TimeTable> {\n return this.shareWithMany(timeTable, { [delegateId]: options })\n }\n\n /**\n * Share an existing time table with other data owners, allowing them to access the non-encrypted data of the time table and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param timeTable the time table to share.\n * @param delegates sharing options for each delegate.\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 * time table does not have encrypted content.\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 shareWithMany(\n timeTable: models.TimeTable,\n delegates: {\n [delegateId: string]: {\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.TimeTable> {\n const extended = await this.crypto.entities.entityWithAutoExtendedEncryptedMetadata(timeTable, true, delegates)\n if (!!extended) {\n return await this.modifyTimeTable(extended)\n } else return timeTable\n }\n\n async getDataOwnersWithAccessTo(\n entity: models.TimeTable\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: 'WRITE' }; hasUnknownAnonymousDataOwners: boolean }> {\n return await this.crypto.entities.getDataOwnersWithAccessTo(entity)\n }\n\n async getEncryptionKeysOf(entity: models.TimeTable): Promise<string[]> {\n return await this.crypto.entities.encryptionKeysOf(entity)\n }\n}\n"]}
|
package/icc-x-api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IccAgendaApi, IccAuthApi, IccCalendarItemTypeApi, IccEntityrefApi, IccGroupApi, IccInsuranceApi, IccMedicallocationApi, IccPermissionApi } from '../icc-api';
|
|
1
|
+
import { IccAgendaApi, IccAnonymousAccessApi, IccApplicationsettingsApi, IccArticleApi, IccAuthApi, IccBeefactApi, IccBeresultexportApi, IccBeresultimportApi, IccBesamv2Api, IccCalendarItemTypeApi, IccClassificationTemplateApi, IccEntityrefApi, IccEntitytemplateApi, IccFrontendmigrationApi, IccGroupApi, IccIcureApi, IccInsuranceApi, IccKeywordApi, IccMedexApi, IccMedicallocationApi, IccPermissionApi, IccPlaceApi, IccPubsubApi, IccReplicationApi, IccTarificationApi, IccTmpApi } from '../icc-api';
|
|
2
2
|
import { IccUserXApi } from './icc-user-x-api';
|
|
3
3
|
import { IccCryptoXApi } from './icc-crypto-x-api';
|
|
4
4
|
import { IccContactXApi } from './icc-contact-x-api';
|
|
@@ -14,7 +14,7 @@ import { IccMessageXApi } from './icc-message-x-api';
|
|
|
14
14
|
import { IccReceiptXApi } from './icc-receipt-x-api';
|
|
15
15
|
import { IccAccesslogXApi } from './icc-accesslog-x-api';
|
|
16
16
|
import { IccTimeTableXApi } from './icc-time-table-x-api';
|
|
17
|
-
import { IccDeviceApi } from '../icc-api
|
|
17
|
+
import { IccDeviceApi } from '../icc-api';
|
|
18
18
|
import { IccCodeXApi } from './icc-code-x-api';
|
|
19
19
|
import { IccMaintenanceTaskXApi } from './icc-maintenance-task-x-api';
|
|
20
20
|
import { IccDataOwnerXApi } from './icc-data-owner-x-api';
|
|
@@ -24,6 +24,9 @@ import { AuthenticationProvider } from './auth/AuthenticationProvider';
|
|
|
24
24
|
import { StorageEntryKeysFactory } from './storage/StorageEntryKeysFactory';
|
|
25
25
|
import { CryptoStrategies } from './crypto/CryptoStrategies';
|
|
26
26
|
import { IccIcureMaintenanceXApi } from './icc-icure-maintenance-x-api';
|
|
27
|
+
import { IccBekmehrXApi } from './icc-bekmehr-x-api';
|
|
28
|
+
import { IccDoctemplateXApi } from './icc-doctemplate-x-api';
|
|
29
|
+
import { UserGroup } from '../icc-api/model/UserGroup';
|
|
27
30
|
export * from './icc-accesslog-x-api';
|
|
28
31
|
export * from './icc-bekmehr-x-api';
|
|
29
32
|
export * from './icc-calendar-item-x-api';
|
|
@@ -47,51 +50,296 @@ export { KeyStorageFacade } from './storage/KeyStorageFacade';
|
|
|
47
50
|
export { LocalStorageImpl } from './storage/LocalStorageImpl';
|
|
48
51
|
export { StorageFacade } from './storage/StorageFacade';
|
|
49
52
|
export { KeyStorageImpl } from './storage/KeyStorageImpl';
|
|
53
|
+
export { CryptoStrategies } from './crypto/CryptoStrategies';
|
|
50
54
|
export interface Apis {
|
|
51
|
-
authApi: IccAuthApi;
|
|
52
|
-
codeApi: IccCodeXApi;
|
|
53
|
-
calendarItemTypeApi: IccCalendarItemTypeApi;
|
|
54
|
-
medicalLocationApi: IccMedicallocationApi;
|
|
55
|
-
entityReferenceApi: IccEntityrefApi;
|
|
56
|
-
userApi: IccUserXApi;
|
|
57
|
-
permissionApi: IccPermissionApi;
|
|
58
|
-
healthcarePartyApi: IccHcpartyXApi;
|
|
59
|
-
deviceApi: IccDeviceApi;
|
|
60
|
-
cryptoApi: IccCryptoXApi;
|
|
61
|
-
accessLogApi: IccAccesslogXApi;
|
|
62
|
-
agendaApi: IccAgendaApi;
|
|
63
|
-
contactApi: IccContactXApi;
|
|
64
|
-
formApi: IccFormXApi;
|
|
65
|
-
groupApi: IccGroupApi;
|
|
66
|
-
invoiceApi: IccInvoiceXApi;
|
|
67
|
-
insuranceApi: IccInsuranceApi;
|
|
68
|
-
documentApi: IccDocumentXApi;
|
|
69
|
-
healthcareElementApi: IccHelementXApi;
|
|
70
|
-
classificationApi: IccClassificationXApi;
|
|
71
|
-
calendarItemApi: IccCalendarItemXApi;
|
|
72
|
-
receiptApi: IccReceiptXApi;
|
|
73
|
-
timetableApi: IccTimeTableXApi;
|
|
74
|
-
patientApi: IccPatientXApi;
|
|
75
|
-
messageApi: IccMessageXApi;
|
|
76
|
-
maintenanceTaskApi: IccMaintenanceTaskXApi;
|
|
77
|
-
dataOwnerApi: IccDataOwnerXApi;
|
|
78
|
-
icureMaintenanceTaskApi: IccIcureMaintenanceXApi;
|
|
55
|
+
readonly authApi: IccAuthApi;
|
|
56
|
+
readonly codeApi: IccCodeXApi;
|
|
57
|
+
readonly calendarItemTypeApi: IccCalendarItemTypeApi;
|
|
58
|
+
readonly medicalLocationApi: IccMedicallocationApi;
|
|
59
|
+
readonly entityReferenceApi: IccEntityrefApi;
|
|
60
|
+
readonly userApi: IccUserXApi;
|
|
61
|
+
readonly permissionApi: IccPermissionApi;
|
|
62
|
+
readonly healthcarePartyApi: IccHcpartyXApi;
|
|
63
|
+
readonly deviceApi: IccDeviceApi;
|
|
64
|
+
readonly cryptoApi: IccCryptoXApi;
|
|
65
|
+
readonly accessLogApi: IccAccesslogXApi;
|
|
66
|
+
readonly agendaApi: IccAgendaApi;
|
|
67
|
+
readonly contactApi: IccContactXApi;
|
|
68
|
+
readonly formApi: IccFormXApi;
|
|
69
|
+
readonly groupApi: IccGroupApi;
|
|
70
|
+
readonly invoiceApi: IccInvoiceXApi;
|
|
71
|
+
readonly insuranceApi: IccInsuranceApi;
|
|
72
|
+
readonly documentApi: IccDocumentXApi;
|
|
73
|
+
readonly healthcareElementApi: IccHelementXApi;
|
|
74
|
+
readonly classificationApi: IccClassificationXApi;
|
|
75
|
+
readonly calendarItemApi: IccCalendarItemXApi;
|
|
76
|
+
readonly receiptApi: IccReceiptXApi;
|
|
77
|
+
readonly timetableApi: IccTimeTableXApi;
|
|
78
|
+
readonly patientApi: IccPatientXApi;
|
|
79
|
+
readonly messageApi: IccMessageXApi;
|
|
80
|
+
readonly maintenanceTaskApi: IccMaintenanceTaskXApi;
|
|
81
|
+
readonly dataOwnerApi: IccDataOwnerXApi;
|
|
82
|
+
readonly icureMaintenanceTaskApi: IccIcureMaintenanceXApi;
|
|
83
|
+
readonly anonymousAccessApi: IccAnonymousAccessApi;
|
|
84
|
+
readonly applicationSettingsApi: IccApplicationsettingsApi;
|
|
85
|
+
readonly articleApi: IccArticleApi;
|
|
86
|
+
readonly bekmehrApi: IccBekmehrXApi;
|
|
87
|
+
readonly beefactApi: IccBeefactApi;
|
|
88
|
+
readonly beresultexportApi: IccBeresultexportApi;
|
|
89
|
+
readonly beresultimportApi: IccBeresultimportApi;
|
|
90
|
+
readonly besamv2Api: IccBesamv2Api;
|
|
91
|
+
readonly classificationTemplateApi: IccClassificationTemplateApi;
|
|
92
|
+
readonly doctemplateApi: IccDoctemplateXApi;
|
|
93
|
+
readonly entitytemplateApi: IccEntitytemplateApi;
|
|
94
|
+
readonly frontendmigrationApi: IccFrontendmigrationApi;
|
|
95
|
+
readonly icureApi: IccIcureApi;
|
|
96
|
+
readonly keywordApi: IccKeywordApi;
|
|
97
|
+
readonly medexApi: IccMedexApi;
|
|
98
|
+
readonly placeApi: IccPlaceApi;
|
|
99
|
+
readonly pubsubApi: IccPubsubApi;
|
|
100
|
+
readonly replicationApi: IccReplicationApi;
|
|
101
|
+
readonly tarificationApi: IccTarificationApi;
|
|
102
|
+
readonly tmpApi: IccTmpApi;
|
|
79
103
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Allows to customise the behaviour of the iCure API by providing various optional parameters.
|
|
106
|
+
*/
|
|
107
|
+
export interface IcureApiOptions {
|
|
108
|
+
/**
|
|
109
|
+
* Specifies how iCure can store string values (e.g. json). In production this should be persistent storage.
|
|
110
|
+
* @default the browser's localStorage.
|
|
111
|
+
*/
|
|
83
112
|
readonly storage?: StorageFacade<string>;
|
|
113
|
+
/**
|
|
114
|
+
* Specifies how iCure can store cryptographic keys. Preferably this should be some ad-hoc storage key storage.
|
|
115
|
+
* @default stores the json of the jwk representation of the key in {@link storage}.
|
|
116
|
+
*/
|
|
84
117
|
readonly keyStorage?: KeyStorageFacade;
|
|
118
|
+
/**
|
|
119
|
+
* Specifies where iCure should store his data within the {@link storage} and {@link keyStorage}.
|
|
120
|
+
* @default {@link DefaultStorageEntryKeysFactory}
|
|
121
|
+
*/
|
|
122
|
+
readonly entryKeysFactory?: StorageEntryKeysFactory;
|
|
123
|
+
/**
|
|
124
|
+
* Specifies if iCure should create maintenance tasks for requesting access back when a new key is generated at initialisation time.
|
|
125
|
+
* @default true
|
|
126
|
+
*/
|
|
127
|
+
readonly createMaintenanceTasksOnNewKey?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Additional headers to use on each request made by the iCure api.
|
|
130
|
+
* @default no additional headers
|
|
131
|
+
*/
|
|
85
132
|
readonly headers?: {
|
|
86
133
|
[headerName: string]: string;
|
|
87
134
|
};
|
|
88
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Specifies which fields should be encrypted for each kind of encryptable entity. You should make sure that every application in your environment
|
|
137
|
+
* specifies the same values for this configuration.
|
|
138
|
+
* @default see documentation for {@link EncryptedFieldsConfig}
|
|
139
|
+
*/
|
|
140
|
+
readonly encryptedFieldsConfig?: EncryptedFieldsConfig;
|
|
141
|
+
/**
|
|
142
|
+
* Each user may exist in multiple groups, but an instance of {@link IcureApi} is specialised for a single group. This function allows you to decide
|
|
143
|
+
* the group to use for a given user. This functions will be called only if a user exists in at least 2 groups, takes in input the information on
|
|
144
|
+
* the groups the user can access (in no specific order) and must return the id of one of these groups.
|
|
145
|
+
* @default takes the first group provided. The group chosen by this method may vary between different instantiations of the {@link IcureApi} even
|
|
146
|
+
* if for the same user and if the groups available for the user do not change.
|
|
147
|
+
*/
|
|
148
|
+
readonly groupSelector?: (availableGroupsInfo: UserGroup[]) => Promise<string>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Specifies which fields should be encrypted for each kind of encryptable entity.
|
|
152
|
+
*
|
|
153
|
+
* Note that any value you specify here overrides the default values. For example if you specify `['medicalLocationId']` for `healthElement` the
|
|
154
|
+
* fields `['descr', 'note']` which are usually encrypted by default will no longer be encrypted. If you want to add fields to the default values
|
|
155
|
+
* you can use {@link EncryptedFieldsConfig.Defaults}, for example `[...EncryptedFieldsConfig.Defaults.healthElement, 'medicalLocationId'].
|
|
156
|
+
*
|
|
157
|
+
* # Encrypted fields syntax
|
|
158
|
+
*
|
|
159
|
+
* ## Grammar
|
|
160
|
+
*
|
|
161
|
+
* The grammar for each encrypted field is the following:
|
|
162
|
+
* ```
|
|
163
|
+
* fieldName :=
|
|
164
|
+
* regex([a-zA-Z_][a-zA-Z0-9_]+)
|
|
165
|
+
* encryptedField :=
|
|
166
|
+
* fieldName
|
|
167
|
+
* | fieldName + ("." | ".*." | "[].") + encryptedField
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* This grammar allows you to specify the fields to encrypt for the object and recursively for nested objects.
|
|
171
|
+
* - A string containing only a single `fieldName` will encrypt the field with the given name.
|
|
172
|
+
* - A string starting with `fieldName.` allows to specify the encrypted fields of a nested object. The encrypted values of the
|
|
173
|
+
* fields in the nested object will be saved in the nested object.
|
|
174
|
+
* - A string starting with `fieldName.*.` treats `fieldName` as a map/dictionary data structure and allows to specify the encrypted fields of the
|
|
175
|
+
* values of the map. Note that the values of the map must be objects as well. The encrypted content of each map value is stored in that value.
|
|
176
|
+
* - A string starting with `fieldName[].` treats `fieldName` as an array and allows to specify the encrypted fields of the values of the array.
|
|
177
|
+
* Note that the values of the array must be objects as well. The encrypted content of each array element is stored in that element.
|
|
178
|
+
*
|
|
179
|
+
* ## Example
|
|
180
|
+
*
|
|
181
|
+
* Consider the following object and encryption keys:
|
|
182
|
+
* ```javascript
|
|
183
|
+
* const obj = {
|
|
184
|
+
* a: { x: 0, y: 1 },
|
|
185
|
+
* b: "hello",
|
|
186
|
+
* c: [ { public: "a", secret: "b" }, { public: "c", secret: "d" } ],
|
|
187
|
+
* d: "ok",
|
|
188
|
+
* e: {
|
|
189
|
+
* info: "something",
|
|
190
|
+
* private: "secret",
|
|
191
|
+
* dataMap: {
|
|
192
|
+
* "en": {
|
|
193
|
+
* a: 1,
|
|
194
|
+
* b: 2
|
|
195
|
+
* },
|
|
196
|
+
* "fr": {
|
|
197
|
+
* a: 3,
|
|
198
|
+
* b: 4
|
|
199
|
+
* }
|
|
200
|
+
* }
|
|
201
|
+
* }
|
|
202
|
+
* }
|
|
203
|
+
* const encryptedFields = [
|
|
204
|
+
* "a",
|
|
205
|
+
* "c[].secret",
|
|
206
|
+
* "d",
|
|
207
|
+
* "e.private",
|
|
208
|
+
* "e.datamap.*.a"
|
|
209
|
+
* ]
|
|
210
|
+
* ```
|
|
211
|
+
* If you use them with the crypt method you will get the following result:
|
|
212
|
+
* ```json
|
|
213
|
+
* {
|
|
214
|
+
* b: "hello",
|
|
215
|
+
* c: [
|
|
216
|
+
* { public: "a", encryptedSelf: "...encrypted data of c[0]" },
|
|
217
|
+
* { public: "c", encryptedSelf: "...encrypted data of c[1]" }
|
|
218
|
+
* ],
|
|
219
|
+
* e: {
|
|
220
|
+
* info: "something",
|
|
221
|
+
* dataMap: {
|
|
222
|
+
* "en": { b: 2, encryptedSelf: "...encrypted data of e.dataMap['en']" },
|
|
223
|
+
* "fr": { b: 4, encryptedSelf: "...encrypted data of e.dataMap['fr']" }
|
|
224
|
+
* },
|
|
225
|
+
* encryptedSelf: "...encrypted data of e"
|
|
226
|
+
* },
|
|
227
|
+
* encryptedSelf: "...encrypted data of obj"
|
|
228
|
+
* }
|
|
229
|
+
* ```
|
|
230
|
+
*
|
|
231
|
+
* ## Shortened representation
|
|
232
|
+
*
|
|
233
|
+
* You can also group encrypted fields having the same prefix by concatenating to the prefix the JSON representation of an array of all the postfixes.
|
|
234
|
+
* For example the following encrypted fields:
|
|
235
|
+
* ```javascript
|
|
236
|
+
* const encryptedFields = ["a.b.c.d.e.f1", "a.b.c.d.e.f2", "a.b.c.d.e.f3", "a.b.c.d.e.f4"]
|
|
237
|
+
* ```
|
|
238
|
+
* can be shortened to
|
|
239
|
+
* ```javascript
|
|
240
|
+
* const encryptedFields = ['a.b.c.d.e.["f1","f2","f3","f4"]'] // Note the use of single quotes to avoid escaping the double quotes
|
|
241
|
+
* ```
|
|
242
|
+
* If you use the shortened representation you may need to escape nested json representations. In that case the use of `JSON.stringify` is
|
|
243
|
+
* recommended.
|
|
244
|
+
*/
|
|
245
|
+
export interface EncryptedFieldsConfig {
|
|
246
|
+
/**
|
|
247
|
+
* Fields to encrypt for entities of type {@link AccessLog}
|
|
248
|
+
* @default ['detail', 'objectId']
|
|
249
|
+
*/
|
|
250
|
+
readonly accessLog?: string[];
|
|
251
|
+
/**
|
|
252
|
+
* Fields to encrypt for entities of type {@link CalendarItem}
|
|
253
|
+
* @default ['details', 'title', 'patientId']
|
|
254
|
+
*/
|
|
255
|
+
readonly calendarItem?: string[];
|
|
256
|
+
/**
|
|
257
|
+
* Fields to encrypt for entities of type {@link Contact}, excluding `services`. You can specify which fields of `services` should be encrypted
|
|
258
|
+
* using {@link service}.
|
|
259
|
+
* @default ['descr'] // encryption of `services` is managed through {@link service}
|
|
260
|
+
*/
|
|
261
|
+
readonly contact?: string[];
|
|
262
|
+
/**
|
|
263
|
+
* Fields to encrypt for entities of type {@link Service}. Note that encryption of the `content` field and recursively contained `Services` through
|
|
264
|
+
* `content.compoundValue` is automatically managed by the sdk, and you are not allowed to modify it.
|
|
265
|
+
*
|
|
266
|
+
* Note: any non-empty values for this field will break bi-directional data compatibility between v7 and previous: Contacts created with
|
|
267
|
+
* v7 will not be read properly by previous versions. If you want
|
|
268
|
+
* @default ['notes[].markdown'] // encryption of `content` is managed in a special way
|
|
269
|
+
*/
|
|
270
|
+
readonly service?: string[];
|
|
271
|
+
/**
|
|
272
|
+
* Fields to encrypt for entities of type {@link HealthElement}
|
|
273
|
+
* @default ['descr', 'note', 'notes[].markdown']
|
|
274
|
+
*/
|
|
275
|
+
readonly healthElement?: string[];
|
|
276
|
+
/**
|
|
277
|
+
* Fields to encrypt for entities of type {@link MaintenanceTask}
|
|
278
|
+
* @default ['properties']
|
|
279
|
+
*/
|
|
280
|
+
readonly maintenanceTask?: string[];
|
|
281
|
+
/**
|
|
282
|
+
* Fields to encrypt for entities of type {@link Patient}
|
|
283
|
+
* @default ['note', 'notes[].markdown']
|
|
284
|
+
*/
|
|
285
|
+
readonly patient?: string[];
|
|
286
|
+
}
|
|
287
|
+
export declare namespace EncryptedFieldsConfig {
|
|
288
|
+
const Defaults: {
|
|
289
|
+
accessLog: string[];
|
|
290
|
+
calendarItem: string[];
|
|
291
|
+
contact: string[];
|
|
292
|
+
service: string[];
|
|
293
|
+
healthElement: string[];
|
|
294
|
+
maintenanceTask: string[];
|
|
295
|
+
patient: string[];
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Details for the authentication of a user
|
|
300
|
+
*/
|
|
89
301
|
export type AuthenticationDetails = {
|
|
90
302
|
username: string;
|
|
91
303
|
password: string;
|
|
92
304
|
forceBasic?: boolean;
|
|
305
|
+
icureTokens?: {
|
|
306
|
+
token: string;
|
|
307
|
+
refreshToken: string;
|
|
308
|
+
};
|
|
309
|
+
thirdPartyTokens?: {
|
|
310
|
+
[thirdParty: string]: string;
|
|
311
|
+
};
|
|
93
312
|
};
|
|
94
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Main entry point for the iCure API. Provides entity-specific sub-apis and some general methods which are not related to a specific entity.
|
|
315
|
+
*/
|
|
316
|
+
export interface IcureApi extends Apis {
|
|
317
|
+
/**
|
|
318
|
+
* Get the information on groups that the current user can access and the current group that this api instance is working on.
|
|
319
|
+
* Note that the values you will get for `availableGroups` may differ from the values you would get if you call {@link IccUserApi.getMatchingUsers}
|
|
320
|
+
* on {@link Apis.userApi}, since the latter is specialised on the specific instance of the user in `currentGroup`.
|
|
321
|
+
*/
|
|
322
|
+
getGroupsInfo(): Promise<{
|
|
323
|
+
currentGroup: UserGroup;
|
|
324
|
+
availableGroups: UserGroup[];
|
|
325
|
+
}>;
|
|
326
|
+
/**
|
|
327
|
+
* Switches the api to allow the user to work on a different group.
|
|
328
|
+
* @param newGroupId the id of the group to switch to.
|
|
329
|
+
* @return a new api for the specified group.
|
|
330
|
+
*/
|
|
331
|
+
switchGroup(newGroupId: string): Promise<IcureApi>;
|
|
332
|
+
}
|
|
333
|
+
export declare namespace IcureApi {
|
|
334
|
+
/**
|
|
335
|
+
* Initialises a new instance of the iCure API.
|
|
336
|
+
*/
|
|
337
|
+
function initialise(host: string, authenticationOptions: AuthenticationDetails | AuthenticationProvider, cryptoStrategies: CryptoStrategies, crypto?: Crypto, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, options?: IcureApiOptions): Promise<IcureApi>;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* @experimental This function still needs development and will be changed
|
|
341
|
+
* Build apis which do not need crypto and can be used by non-data-owner users
|
|
342
|
+
*/
|
|
95
343
|
export declare const BasicApis: (host: string, username: string, password: string, crypto?: Crypto, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, forceBasic?: boolean) => Promise<{
|
|
96
344
|
authApi: IccAuthApi;
|
|
97
345
|
codeApi: IccCodeXApi;
|
|
@@ -101,4 +349,5 @@ export declare const BasicApis: (host: string, username: string, password: strin
|
|
|
101
349
|
entityReferenceApi: IccEntityrefApi;
|
|
102
350
|
agendaApi: IccAgendaApi;
|
|
103
351
|
groupApi: IccGroupApi;
|
|
352
|
+
healthcarePartyApi: IccHcpartyXApi;
|
|
104
353
|
}>;
|