@icure/api 8.9.0 → 8.9.1

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.
@@ -244,7 +244,7 @@ class IccReceiptApi {
244
244
  '?ts=' +
245
245
  new Date().getTime();
246
246
  let headers = yield this.headers;
247
- return XHR_1.XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
247
+ return XHR_1.XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, "application/octet-stream", this.authenticationProvider.getAuthService())
248
248
  .then((doc) => doc.body)
249
249
  .catch((err) => this.handleError(err));
250
250
  });
@@ -1 +1 @@
1
- {"version":3,"file":"IccReceiptApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccReceiptApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,+BAA2B;AAC3B,0DAAsD;AACtD,8CAA0C;AAC1C,wFAA8G;AAC9G,qDAAiD;AAEjD,mFAA+E;AAI/E,gFAA4E;AAC5E,oFAAgF;AAChF,sDAAkD;AAElD,MAAa,aAAa;IAMxB,IAAI,OAAO;QACT,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACvC,CAAC;IAED,YACE,IAAY,EACZ,OAAY,EACZ,sBAA+C,EAC/C,SAAyE;QAEzE,IAAI,CAAC,IAAI,GAAG,IAAA,+BAAc,EAAC,IAAI,CAAC,CAAA;QAChC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,SAAG,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC9E,IAAI,CAAC,sBAAsB,GAAG,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,iDAAwB,EAAE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A;YAChC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,cAAc,CAAC,CAAC,MAAM,CAAC,IAAI,SAAG,CAAC,MAAM,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC,CAAA;YACvH,OAAO,SAAG,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,CAAC;iBAC9H,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAE,GAAG,CAAC,IAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,yBAAW,CAAC,EAAE,CAAC,CAAC,CAAC;iBACzE,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;QAC1C,CAAC;KAAA;CACF;AApWD,sCAoWC","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\nimport { XHR } from './XHR'\nimport { DocIdentifier } from '../model/DocIdentifier'\nimport { Receipt } from '../model/Receipt'\nimport { AuthenticationProvider, NoAuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider'\nimport { iccRestApiPath } from './IccRestApiPath'\nimport { EntityShareOrMetadataUpdateRequest } from '../model/requests/EntityShareOrMetadataUpdateRequest'\nimport { EntityBulkShareResult } from '../model/requests/EntityBulkShareResult'\nimport { ListOfIds } from '../model/ListOfIds'\nimport { BulkShareOrUpdateMetadataParams } from '../model/requests/BulkShareOrUpdateMetadataParams'\nimport { ConflictResolutionRequest } from '../model/ConflictResolutionRequest'\nimport { ConflictResolutionResult } from '../model/ConflictResolutionResult'\nimport { ConflictResolutionStrategy } from '../model/ConflictResolutionStrategy'\nimport { MergeResult } from '../model/MergeResult'\n\nexport class IccReceiptApi {\n host: string\n _headers: Array<XHR.Header>\n authenticationProvider: AuthenticationProvider\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n\n get headers(): Promise<Array<XHR.Header>> {\n return Promise.resolve(this._headers)\n }\n\n constructor(\n host: string,\n headers: any,\n authenticationProvider?: AuthenticationProvider,\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n ) {\n this.host = iccRestApiPath(host)\n this._headers = Object.keys(headers).map((k) => new XHR.Header(k, headers[k]))\n this.authenticationProvider = !!authenticationProvider ? authenticationProvider : new NoAuthenticationProvider()\n this.fetchImpl = fetchImpl\n }\n\n setHeaders(h: Array<XHR.Header>) {\n this._headers = h\n }\n\n handleError(e: XHR.XHRError): never {\n throw e\n }\n\n /**\n *\n * @summary Creates a receipt\n * @param body\n */\n async createReceipt(body?: Receipt): Promise<Receipt> {\n const _url = this.host + `/receipt` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Receipt(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a batch of receipts.\n *\n * @param receiptIds a ListOfIds containing the ids of the receipts to delete.\n * @return a Promise that will resolve in an array of DocIdentifiers of the successfully deleted receipts.\n */\n async deleteReceipts(receiptIds: ListOfIds): Promise<Array<DocIdentifier>> {\n const headers = (await this.headers).filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand(\n 'POST',\n this.host + `/receipt/delete/batch` + '?ts=' + new Date().getTime(),\n headers,\n receiptIds,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => (doc.body as Array<JSON>).map((it) => new DocIdentifier(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a single receipt by id.\n *\n * @param receiptId the id of the receipt to delete.\n * @return a Promise that will resolve in the DocIdentifier of the deleted receipt.\n */\n async deleteReceipt(receiptId: string): Promise<DocIdentifier> {\n return XHR.sendCommand(\n 'DELETE',\n this.host + `/receipt/${encodeURIComponent(receiptId)}` + '?ts=' + new Date().getTime(),\n await this.headers,\n null,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => new DocIdentifier(doc.body))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Gets a receipt\n * @param receiptId\n */\n async getReceipt(receiptId: string): Promise<Receipt> {\n let _body = null\n\n const _url = this.host + `/receipt/${encodeURIComponent(String(receiptId))}` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Receipt(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Get an attachment\n * @param receiptId\n * @param attachmentId\n * @param enckeys\n */\n async getReceiptAttachment(receiptId: string, attachmentId: string, enckeys?: null): Promise<ArrayBuffer> {\n if (enckeys) {\n throw new Error('Server-side encryption is not supported anymore.')\n }\n let _body = null\n\n const _url =\n this.host +\n `/receipt/${encodeURIComponent(String(receiptId))}/attachment/${encodeURIComponent(String(attachmentId))}` +\n '?ts=' +\n new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => doc.body)\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Gets a receipt\n * @param ref\n */\n async listByReference(ref: string): Promise<Array<Receipt>> {\n let _body = null\n\n const _url = this.host + `/receipt/byRef/${encodeURIComponent(String(ref))}` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new Receipt(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Updates a receipt\n * @param body\n */\n async modifyReceipt(body?: Receipt): Promise<Receipt> {\n let _body = null\n _body = body\n\n const _url = this.host + `/receipt` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Receipt(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @deprecated use setReceiptAttachmentForBlobType instead\n */\n async setReceiptAttachment(receiptId: string, receiptRev: string, blobType: string, enckeys?: null, body?: ArrayBuffer): Promise<Receipt> {\n if (enckeys) {\n throw new Error('Server-side encryption is not supported anymore.')\n }\n if (!body) {\n throw new Error('Attachment content is requred')\n }\n return this.setReceiptAttachmentForBlobType(receiptId, receiptRev, blobType, body)\n }\n\n /**\n * @summary Creates a receipt's attachment\n * @param receiptId id of a receipt\n * @param receiptRev rev of the receipt\n * @param blobType receipt blob type\n * @param body content of the attachment, already encrypted\n */\n async setReceiptAttachmentForBlobType(receiptId: string, receiptRev: string, blobType: string, body: ArrayBuffer): Promise<Receipt> {\n if (!receiptRev) throw new Error('Receipt rev is required')\n\n let _body = body\n\n const _url =\n this.host +\n `/receipt/${encodeURIComponent(String(receiptId))}/attachment/${encodeURIComponent(String(blobType))}` +\n '?ts=' +\n new Date().getTime() +\n '&rev=' +\n receiptRev\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/octet-stream'))\n return XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Receipt(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Creates a receipt's data attachment with compression metadata\n * @param receiptId id of a receipt\n * @param blobType receipt blob type\n * @param rev revision of the receipt\n * @param body content of the attachment\n * @param compressionAlgorithm the compression algorithm used on the client side, if any\n * @param triedCompressionAlgorithmsVersion a version string for the compression algorithms tried\n * @param realDataSize the real size of the data after decryption and decompression\n */\n async setReceiptDataAttachment(\n receiptId: string,\n blobType: string,\n rev: string,\n body: ArrayBuffer,\n compressionAlgorithm?: string,\n triedCompressionAlgorithmsVersion?: string,\n realDataSize?: number\n ): Promise<Receipt> {\n if (!rev) throw new Error('Receipt rev is required')\n\n const _url =\n this.host +\n `/receipt/${encodeURIComponent(String(receiptId))}/dataattachment/${encodeURIComponent(String(blobType))}` +\n '?ts=' +\n new Date().getTime() +\n '&rev=' +\n encodeURIComponent(String(rev)) +\n (compressionAlgorithm ? '&compressionAlgorithm=' + encodeURIComponent(String(compressionAlgorithm)) : '') +\n (triedCompressionAlgorithmsVersion\n ? '&triedCompressionAlgorithmsVersion=' + encodeURIComponent(String(triedCompressionAlgorithmsVersion))\n : '') +\n (realDataSize != null ? '&realDataSize=' + encodeURIComponent(String(realDataSize)) : '')\n let headers = await this.headers\n headers = headers\n .filter((h) => h.header !== 'Content-Type' && h.header !== 'Content-Length')\n .concat(new XHR.Header('Content-Type', 'application/octet-stream'))\n .concat(new XHR.Header('Content-Length', String(body.byteLength)))\n return XHR.sendCommand('PUT', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Receipt(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Get a receipt's attachment by blob type\n * @param receiptId id of the receipt\n * @param blobType the blob type of the attachment to retrieve\n */\n async getReceiptAttachmentByBlobType(receiptId: string, blobType: string): Promise<ArrayBuffer> {\n const _url =\n this.host +\n `/receipt/${encodeURIComponent(String(receiptId))}/attachment/ofType/${encodeURIComponent(String(blobType))}` +\n '?ts=' +\n new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => doc.body)\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @internal this method is for internal use only and may be changed without notice\n */\n async bulkShareReceipt(request: BulkShareOrUpdateMetadataParams): Promise<EntityBulkShareResult<Receipt>[]> {\n const _url = this.host + '/receipt/bulkSharedMetadataUpdate' + '?ts=' + new Date().getTime()\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('PUT', _url, headers, request, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((x) => new EntityBulkShareResult<Receipt>(x, Receipt)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Retrieves the ids of all the receipts that currently have conflicting revisions and therefore need to\n * be resolved.\n * @summary List the ids of the receipts that have conflicts.\n * @return the ids of the receipts with unresolved conflicts.\n */\n async getConflictingEntitiesIds(): Promise<Array<string>> {\n const _url = this.host + `/receipt/conflicts` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => doc.body as Array<string>)\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Retrieves all the conflicting revisions of the receipt with the given id (the current revision is not\n * included). The returned entities are still encrypted.\n * @summary Get the conflicting revisions of a receipt.\n * @param entityId the id of the receipt to retrieve the conflicts for.\n * @return the conflicting revisions of the receipt.\n */\n async getConflictsForEntity(entityId: string): Promise<Array<Receipt>> {\n const _url = this.host + `/receipt/conflicts/of?entityId=${encodeURIComponent(String(entityId))}` + '&ts=' + new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new Receipt(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Resolves a conflict by declaring which revision of the receipt should be kept as winner and which\n * conflicting revisions should be purged. The provided document must already be encrypted.\n * @summary Declare the winning revision of a conflicting receipt.\n * @param body the {@link ConflictResolutionRequest} carrying the winning revision and the conflicts to purge.\n * @return the {@link ConflictResolutionResult} with the saved winner and the conflicts that are still unresolved.\n */\n async declareConflictWinner(body: ConflictResolutionRequest<Receipt>): Promise<ConflictResolutionResult<Receipt>> {\n const _url = this.host + `/receipt/conflicts/winner` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new ConflictResolutionResult<Receipt>(doc.body, (x) => new Receipt(x)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Automatically resolves the conflicting revisions of the receipts with the given ids, according to the provided\n * {@link ConflictResolutionStrategy}.\n * @summary Automatically solve the conflicts of the receipts with the given ids.\n * @param entityIds the ids of the receipts to solve the conflicts for.\n * @param strategy the {@link ConflictResolutionStrategy} to use to resolve the conflicts. Defaults to `FullMergeability`.\n * @return the {@link MergeResult} of the conflict resolution for each requested entity.\n */\n async autoSolveConflicts(\n entityIds: Array<string>,\n strategy: ConflictResolutionStrategy = ConflictResolutionStrategy.FullMergeability\n ): Promise<Array<MergeResult>> {\n const _url = this.host + `/receipt/conflicts/solve?strategy=${encodeURIComponent(String(strategy))}` + '&ts=' + new Date().getTime()\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, entityIds, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new MergeResult(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Like {@link autoSolveConflicts} but targets the entities of the group with the given id.\n * @summary Automatically solve the conflicts of the receipts with the given ids, in the given group.\n * @param groupId the id of the group to look into.\n * @param entityIds the ids of the receipts to solve the conflicts for.\n * @param strategy the {@link ConflictResolutionStrategy} to use to resolve the conflicts. Defaults to `FullMergeability`.\n * @return the {@link MergeResult} of the conflict resolution for each requested entity.\n */\n async autoSolveConflictsInGroup(\n groupId: string,\n entityIds: Array<string>,\n strategy: ConflictResolutionStrategy = ConflictResolutionStrategy.FullMergeability\n ): Promise<Array<MergeResult>> {\n const _url =\n this.host +\n `/receipt/inGroup/${encodeURIComponent(String(groupId))}/conflicts/solve?strategy=${encodeURIComponent(String(strategy))}` +\n '&ts=' +\n new Date().getTime()\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, entityIds, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new MergeResult(it)))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
1
+ {"version":3,"file":"IccReceiptApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccReceiptApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,+BAA2B;AAC3B,0DAAsD;AACtD,8CAA0C;AAC1C,wFAA8G;AAC9G,qDAAiD;AAEjD,mFAA+E;AAI/E,gFAA4E;AAC5E,oFAAgF;AAChF,sDAAkD;AAElD,MAAa,aAAa;IAMxB,IAAI,OAAO;QACT,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACvC,CAAC;IAED,YACE,IAAY,EACZ,OAAY,EACZ,sBAA+C,EAC/C,SAAyE;QAEzE,IAAI,CAAC,IAAI,GAAG,IAAA,+BAAc,EAAC,IAAI,CAAC,CAAA;QAChC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG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C,IAAI;gBACT,oBAAoB,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,6BAA6B,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE;gBAC1H,MAAM;gBACN,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;YACtB,IAAI,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAA;YAChC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,cAAc,CAAC,CAAC,MAAM,CAAC,IAAI,SAAG,CAAC,MAAM,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC,CAAA;YACvH,OAAO,SAAG,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,CAAC;iBAC9H,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAE,GAAG,CAAC,IAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,yBAAW,CAAC,EAAE,CAAC,CAAC,CAAC;iBACzE,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;QAC1C,CAAC;KAAA;CACF;AApWD,sCAoWC","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\nimport { XHR } from './XHR'\nimport { DocIdentifier } from '../model/DocIdentifier'\nimport { Receipt } from '../model/Receipt'\nimport { AuthenticationProvider, NoAuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider'\nimport { iccRestApiPath } from './IccRestApiPath'\nimport { EntityShareOrMetadataUpdateRequest } from '../model/requests/EntityShareOrMetadataUpdateRequest'\nimport { EntityBulkShareResult } from '../model/requests/EntityBulkShareResult'\nimport { ListOfIds } from '../model/ListOfIds'\nimport { BulkShareOrUpdateMetadataParams } from '../model/requests/BulkShareOrUpdateMetadataParams'\nimport { ConflictResolutionRequest } from '../model/ConflictResolutionRequest'\nimport { ConflictResolutionResult } from '../model/ConflictResolutionResult'\nimport { ConflictResolutionStrategy } from '../model/ConflictResolutionStrategy'\nimport { MergeResult } from '../model/MergeResult'\n\nexport class IccReceiptApi {\n host: string\n _headers: Array<XHR.Header>\n authenticationProvider: AuthenticationProvider\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n\n get headers(): Promise<Array<XHR.Header>> {\n return Promise.resolve(this._headers)\n }\n\n constructor(\n host: string,\n headers: any,\n authenticationProvider?: AuthenticationProvider,\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n ) {\n this.host = iccRestApiPath(host)\n this._headers = Object.keys(headers).map((k) => new XHR.Header(k, headers[k]))\n this.authenticationProvider = !!authenticationProvider ? authenticationProvider : new NoAuthenticationProvider()\n this.fetchImpl = fetchImpl\n }\n\n setHeaders(h: Array<XHR.Header>) {\n this._headers = h\n }\n\n handleError(e: XHR.XHRError): never {\n throw e\n }\n\n /**\n *\n * @summary Creates a receipt\n * @param body\n */\n async createReceipt(body?: Receipt): Promise<Receipt> {\n const _url = this.host + `/receipt` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Receipt(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a batch of receipts.\n *\n * @param receiptIds a ListOfIds containing the ids of the receipts to delete.\n * @return a Promise that will resolve in an array of DocIdentifiers of the successfully deleted receipts.\n */\n async deleteReceipts(receiptIds: ListOfIds): Promise<Array<DocIdentifier>> {\n const headers = (await this.headers).filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand(\n 'POST',\n this.host + `/receipt/delete/batch` + '?ts=' + new Date().getTime(),\n headers,\n receiptIds,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => (doc.body as Array<JSON>).map((it) => new DocIdentifier(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a single receipt by id.\n *\n * @param receiptId the id of the receipt to delete.\n * @return a Promise that will resolve in the DocIdentifier of the deleted receipt.\n */\n async deleteReceipt(receiptId: string): Promise<DocIdentifier> {\n return XHR.sendCommand(\n 'DELETE',\n this.host + `/receipt/${encodeURIComponent(receiptId)}` + '?ts=' + new Date().getTime(),\n await this.headers,\n null,\n this.fetchImpl,\n undefined,\n this.authenticationProvider.getAuthService()\n )\n .then((doc) => new DocIdentifier(doc.body))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Gets a receipt\n * @param receiptId\n */\n async getReceipt(receiptId: string): Promise<Receipt> {\n let _body = null\n\n const _url = this.host + `/receipt/${encodeURIComponent(String(receiptId))}` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Receipt(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Get an attachment\n * @param receiptId\n * @param attachmentId\n * @param enckeys\n */\n async getReceiptAttachment(receiptId: string, attachmentId: string, enckeys?: null): Promise<ArrayBuffer> {\n if (enckeys) {\n throw new Error('Server-side encryption is not supported anymore.')\n }\n let _body = null\n\n const _url =\n this.host +\n `/receipt/${encodeURIComponent(String(receiptId))}/attachment/${encodeURIComponent(String(attachmentId))}` +\n '?ts=' +\n new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => doc.body)\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Gets a receipt\n * @param ref\n */\n async listByReference(ref: string): Promise<Array<Receipt>> {\n let _body = null\n\n const _url = this.host + `/receipt/byRef/${encodeURIComponent(String(ref))}` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new Receipt(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Updates a receipt\n * @param body\n */\n async modifyReceipt(body?: Receipt): Promise<Receipt> {\n let _body = null\n _body = body\n\n const _url = this.host + `/receipt` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Receipt(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @deprecated use setReceiptAttachmentForBlobType instead\n */\n async setReceiptAttachment(receiptId: string, receiptRev: string, blobType: string, enckeys?: null, body?: ArrayBuffer): Promise<Receipt> {\n if (enckeys) {\n throw new Error('Server-side encryption is not supported anymore.')\n }\n if (!body) {\n throw new Error('Attachment content is requred')\n }\n return this.setReceiptAttachmentForBlobType(receiptId, receiptRev, blobType, body)\n }\n\n /**\n * @summary Creates a receipt's attachment\n * @param receiptId id of a receipt\n * @param receiptRev rev of the receipt\n * @param blobType receipt blob type\n * @param body content of the attachment, already encrypted\n */\n async setReceiptAttachmentForBlobType(receiptId: string, receiptRev: string, blobType: string, body: ArrayBuffer): Promise<Receipt> {\n if (!receiptRev) throw new Error('Receipt rev is required')\n\n let _body = body\n\n const _url =\n this.host +\n `/receipt/${encodeURIComponent(String(receiptId))}/attachment/${encodeURIComponent(String(blobType))}` +\n '?ts=' +\n new Date().getTime() +\n '&rev=' +\n receiptRev\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/octet-stream'))\n return XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Receipt(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Creates a receipt's data attachment with compression metadata\n * @param receiptId id of a receipt\n * @param blobType receipt blob type\n * @param rev revision of the receipt\n * @param body content of the attachment\n * @param compressionAlgorithm the compression algorithm used on the client side, if any\n * @param triedCompressionAlgorithmsVersion a version string for the compression algorithms tried\n * @param realDataSize the real size of the data after decryption and decompression\n */\n async setReceiptDataAttachment(\n receiptId: string,\n blobType: string,\n rev: string,\n body: ArrayBuffer,\n compressionAlgorithm?: string,\n triedCompressionAlgorithmsVersion?: string,\n realDataSize?: number\n ): Promise<Receipt> {\n if (!rev) throw new Error('Receipt rev is required')\n\n const _url =\n this.host +\n `/receipt/${encodeURIComponent(String(receiptId))}/dataattachment/${encodeURIComponent(String(blobType))}` +\n '?ts=' +\n new Date().getTime() +\n '&rev=' +\n encodeURIComponent(String(rev)) +\n (compressionAlgorithm ? '&compressionAlgorithm=' + encodeURIComponent(String(compressionAlgorithm)) : '') +\n (triedCompressionAlgorithmsVersion\n ? '&triedCompressionAlgorithmsVersion=' + encodeURIComponent(String(triedCompressionAlgorithmsVersion))\n : '') +\n (realDataSize != null ? '&realDataSize=' + encodeURIComponent(String(realDataSize)) : '')\n let headers = await this.headers\n headers = headers\n .filter((h) => h.header !== 'Content-Type' && h.header !== 'Content-Length')\n .concat(new XHR.Header('Content-Type', 'application/octet-stream'))\n .concat(new XHR.Header('Content-Length', String(body.byteLength)))\n return XHR.sendCommand('PUT', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Receipt(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Get a receipt's attachment by blob type\n * @param receiptId id of the receipt\n * @param blobType the blob type of the attachment to retrieve\n */\n async getReceiptAttachmentByBlobType(receiptId: string, blobType: string): Promise<ArrayBuffer> {\n const _url =\n this.host +\n `/receipt/${encodeURIComponent(String(receiptId))}/attachment/ofType/${encodeURIComponent(String(blobType))}` +\n '?ts=' +\n new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, \"application/octet-stream\", this.authenticationProvider.getAuthService())\n .then((doc) => doc.body)\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @internal this method is for internal use only and may be changed without notice\n */\n async bulkShareReceipt(request: BulkShareOrUpdateMetadataParams): Promise<EntityBulkShareResult<Receipt>[]> {\n const _url = this.host + '/receipt/bulkSharedMetadataUpdate' + '?ts=' + new Date().getTime()\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('PUT', _url, headers, request, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((x) => new EntityBulkShareResult<Receipt>(x, Receipt)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Retrieves the ids of all the receipts that currently have conflicting revisions and therefore need to\n * be resolved.\n * @summary List the ids of the receipts that have conflicts.\n * @return the ids of the receipts with unresolved conflicts.\n */\n async getConflictingEntitiesIds(): Promise<Array<string>> {\n const _url = this.host + `/receipt/conflicts` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => doc.body as Array<string>)\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Retrieves all the conflicting revisions of the receipt with the given id (the current revision is not\n * included). The returned entities are still encrypted.\n * @summary Get the conflicting revisions of a receipt.\n * @param entityId the id of the receipt to retrieve the conflicts for.\n * @return the conflicting revisions of the receipt.\n */\n async getConflictsForEntity(entityId: string): Promise<Array<Receipt>> {\n const _url = this.host + `/receipt/conflicts/of?entityId=${encodeURIComponent(String(entityId))}` + '&ts=' + new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new Receipt(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Resolves a conflict by declaring which revision of the receipt should be kept as winner and which\n * conflicting revisions should be purged. The provided document must already be encrypted.\n * @summary Declare the winning revision of a conflicting receipt.\n * @param body the {@link ConflictResolutionRequest} carrying the winning revision and the conflicts to purge.\n * @return the {@link ConflictResolutionResult} with the saved winner and the conflicts that are still unresolved.\n */\n async declareConflictWinner(body: ConflictResolutionRequest<Receipt>): Promise<ConflictResolutionResult<Receipt>> {\n const _url = this.host + `/receipt/conflicts/winner` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new ConflictResolutionResult<Receipt>(doc.body, (x) => new Receipt(x)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Automatically resolves the conflicting revisions of the receipts with the given ids, according to the provided\n * {@link ConflictResolutionStrategy}.\n * @summary Automatically solve the conflicts of the receipts with the given ids.\n * @param entityIds the ids of the receipts to solve the conflicts for.\n * @param strategy the {@link ConflictResolutionStrategy} to use to resolve the conflicts. Defaults to `FullMergeability`.\n * @return the {@link MergeResult} of the conflict resolution for each requested entity.\n */\n async autoSolveConflicts(\n entityIds: Array<string>,\n strategy: ConflictResolutionStrategy = ConflictResolutionStrategy.FullMergeability\n ): Promise<Array<MergeResult>> {\n const _url = this.host + `/receipt/conflicts/solve?strategy=${encodeURIComponent(String(strategy))}` + '&ts=' + new Date().getTime()\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, entityIds, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new MergeResult(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Like {@link autoSolveConflicts} but targets the entities of the group with the given id.\n * @summary Automatically solve the conflicts of the receipts with the given ids, in the given group.\n * @param groupId the id of the group to look into.\n * @param entityIds the ids of the receipts to solve the conflicts for.\n * @param strategy the {@link ConflictResolutionStrategy} to use to resolve the conflicts. Defaults to `FullMergeability`.\n * @return the {@link MergeResult} of the conflict resolution for each requested entity.\n */\n async autoSolveConflictsInGroup(\n groupId: string,\n entityIds: Array<string>,\n strategy: ConflictResolutionStrategy = ConflictResolutionStrategy.FullMergeability\n ): Promise<Array<MergeResult>> {\n const _url =\n this.host +\n `/receipt/inGroup/${encodeURIComponent(String(groupId))}/conflicts/solve?strategy=${encodeURIComponent(String(strategy))}` +\n '&ts=' +\n new Date().getTime()\n let headers = await this.headers\n headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/json'))\n return XHR.sendCommand('POST', _url, headers, entityIds, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => new MergeResult(it)))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
@@ -601,10 +601,11 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
601
601
  var _a;
602
602
  if (!document.rev)
603
603
  throw new Error('Cannot set attachment on document without rev');
604
- const realDataSize = (0, binary_utils_1.ua2ab)(attachment).byteLength;
604
+ const raw = (0, binary_utils_1.ua2ab)(attachment);
605
+ const realDataSize = raw.byteLength;
605
606
  const { data: dataToEncrypt, algorithm: compressionAlgorithm } = deflate
606
607
  ? yield (0, compression_utils_1.compressData)(attachment, utis)
607
- : { data: (0, binary_utils_1.ua2ab)(attachment), algorithm: undefined };
608
+ : { data: raw, algorithm: undefined };
608
609
  const { encryptedData, updatedEntity } = yield this.crypto.xapi.encryptDataOf(document, utils_1.EntityWithDelegationTypeName.Document, dataToEncrypt, (d) => this.modifyDocumentWithUser(undefined, d));
609
610
  return (yield this.decrypt([
610
611
  yield _super.setMainDocumentAttachment.call(this, document.id, (_a = updatedEntity === null || updatedEntity === void 0 ? void 0 : updatedEntity.rev) !== null && _a !== void 0 ? _a : document.rev, encryptedData, utis, true, compressionAlgorithm, (0, compression_utils_1.getCompressionVersion)(), realDataSize),
@@ -626,10 +627,11 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
626
627
  return __awaiter(this, arguments, void 0, function* (document, attachment, utis, deflate = false) {
627
628
  if (!document.rev)
628
629
  throw new Error('Cannot set attachment on document without rev');
629
- const realDataSize = (0, binary_utils_1.ua2ab)(attachment).byteLength;
630
+ const raw = (0, binary_utils_1.ua2ab)(attachment);
631
+ const realDataSize = raw.byteLength;
630
632
  const { data: dataToUpload, algorithm: compressionAlgorithm } = deflate
631
633
  ? yield (0, compression_utils_1.compressData)(attachment, utis)
632
- : { data: (0, binary_utils_1.ua2ab)(attachment), algorithm: undefined };
634
+ : { data: raw, algorithm: undefined };
633
635
  return (yield this.decrypt([
634
636
  yield _super.setMainDocumentAttachment.call(this, document.id, document.rev, dataToUpload, utis, false, compressionAlgorithm, (0, compression_utils_1.getCompressionVersion)(), realDataSize),
635
637
  ]))[0].entity;
@@ -652,10 +654,11 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
652
654
  var _a;
653
655
  if (!document.rev)
654
656
  throw new Error('Cannot set attachment on document without rev');
655
- const realDataSize = (0, binary_utils_1.ua2ab)(attachment).byteLength;
657
+ const raw = (0, binary_utils_1.ua2ab)(attachment);
658
+ const realDataSize = raw.byteLength;
656
659
  const { data: dataToEncrypt, algorithm: compressionAlgorithm } = deflate
657
660
  ? yield (0, compression_utils_1.compressData)(attachment, utis)
658
- : { data: (0, binary_utils_1.ua2ab)(attachment), algorithm: undefined };
661
+ : { data: raw, algorithm: undefined };
659
662
  const { encryptedData, updatedEntity } = yield this.crypto.xapi.encryptDataOf(document, utils_1.EntityWithDelegationTypeName.Document, dataToEncrypt, (d) => this.modifyDocumentWithUser(undefined, d));
660
663
  return (yield this.decrypt([
661
664
  yield _super.setSecondaryAttachment.call(this, document.id, secondaryAttachmentKey, (_a = updatedEntity === null || updatedEntity === void 0 ? void 0 : updatedEntity.rev) !== null && _a !== void 0 ? _a : document.rev, encryptedData, utis, true, compressionAlgorithm, (0, compression_utils_1.getCompressionVersion)(), realDataSize),
@@ -677,10 +680,11 @@ class IccDocumentXApi extends icc_api_1.IccDocumentApi {
677
680
  setSecondaryAttachment: { get: () => super.setSecondaryAttachment }
678
681
  });
679
682
  return __awaiter(this, arguments, void 0, function* (document, secondaryAttachmentKey, attachment, utis, deflate = false) {
680
- const realDataSize = (0, binary_utils_1.ua2ab)(attachment).byteLength;
683
+ const raw = (0, binary_utils_1.ua2ab)(attachment);
684
+ const realDataSize = raw.byteLength;
681
685
  const { data: dataToUpload, algorithm: compressionAlgorithm } = deflate
682
686
  ? yield (0, compression_utils_1.compressData)(attachment, utis)
683
- : { data: (0, binary_utils_1.ua2ab)(attachment), algorithm: undefined };
687
+ : { data: raw, algorithm: undefined };
684
688
  return (yield this.decrypt([
685
689
  yield _super.setSecondaryAttachment.call(this, document.id, secondaryAttachmentKey, document.rev, dataToUpload, utis, false, compressionAlgorithm, (0, compression_utils_1.getCompressionVersion)(), realDataSize),
686
690
  ]))[0].entity;
@@ -1 +1 @@
1
- {"version":3,"file":"icc-document-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-document-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAuD;AAGvD,4CAAwC;AACxC,kDAAiD;AAEjD,uDAAqD;AAErD,0EAAgG;AAChG,wEAAoE;AAKpE,mCAAqG;AACrG,IAAO,eAAe,GAAG,mCAAgB,CAA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iB,EAAE,OAAe,EAAE,QAAgB;QACvF,OAAO,KAAK;aACT,4BAA4B,CAAC,OAAO,EAAE,QAAQ,CAAC;aAC/C,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;aAC9B,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IACnD,CAAC;IAED;;;;;;OAMG;IACG,oCAAoC,CACxC,IAAiB,EACjB,OAAe,EACf,OAA0D;;;;;YAE1D,MAAM,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,IAAA,4BAAS,EAAC,OAAO,CAAC,QAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YACzE,MAAM,MAAM,GAAG,MAAM,OAAM,4BAA4B,YAAC,OAAO,kCAAO,OAAO,KAAE,QAAQ,EAAE,SAAS,IAAG,CAAA;YACrG,IAAI,MAAM,CAAC,QAAQ;gBAAE,MAAM,CAAC,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;YACxF,OAAO,MAAM,CAAA;QACf,CAAC;KAAA;CACF;AA9+CD,0CA8+CC","sourcesContent":["import { IccAuthApi, IccDocumentApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport { XHR } from '../icc-api/api/XHR'\nimport * as models from '../icc-api/model/models'\n\nimport { ua2ab, ua2utf8 } from './utils/binary-utils'\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 { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { EncryptedFieldsManifest, EntityWithDelegationTypeName, parseEncryptedFields } from './utils'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\nimport { ListOfIds, PaginatedListDocument, PaginatedListMessage } from '../icc-api/model/models'\nimport { compressData, decompressData, getCompressionVersion } from './utils/compression-utils'\nimport { cloneDeep } from './utils/collection-utils'\n\n// noinspection JSUnusedGlobalSymbols\nexport class IccDocumentXApi extends IccDocumentApi implements EncryptedEntityXApi<models.Document> {\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n\n /** maps invalid UTI values to corresponding MIME type for backward-compatibility (pre-v1.0.117) */\n compatUtiRevDefs: { [key: string]: string } = {\n 'com.adobe.encapsulatedPostscript': 'image/eps',\n 'com.adobe.illustrator.aiImage': 'application/illustrator',\n 'com.adobe.indesignImage': 'image/indesign',\n 'com.adobe.photoshopImage': 'image/psd',\n 'com.adobe.postscriptPfaFont': 'application/x-font-type1',\n 'com.adobe.postscriptPfbFont': 'application/x-font-type1',\n 'com.allume.stuffitArchive': 'application/stuffit',\n 'com.apple.binhexArchive': 'application/binhex',\n 'com.apple.diskImageUdif': 'application/x-apple-diskimage',\n 'com.apple.macbinaryArchive': 'application/macbinary',\n 'com.apple.quartzComposerComposition': 'application/x-quartzcomposer',\n 'com.apple.quicktimeImage': 'image/x-quicktime',\n 'com.apple.quicktimeMovie': 'video/quicktime',\n 'com.js.efxFax': 'image/efax',\n 'com.macromedia.shockwaveFlash': 'application/x-shockwave-flash',\n 'com.microsoft.advancedStreamRedirector': 'video/x-ms-asx',\n 'com.microsoft.advancedSystemsFormat': 'video/x-ms-asf',\n 'com.microsoft.waveformAudio': 'audio/wave',\n 'com.microsoft.windowsDynamicLinkLibrary': 'application/x-msdownload',\n 'com.microsoft.windowsExecutable': 'application/exe',\n 'com.microsoft.windowsMediaWax': 'audio/x-ms-wax',\n 'com.microsoft.windowsMediaWm': 'video/x-ms-wm',\n 'com.microsoft.windowsMediaWma': 'audio/x-ms-wma',\n 'com.microsoft.windowsMediaWmd': 'video/x-ms-wmd',\n 'com.microsoft.windowsMediaWmp': 'video/x-ms-wmp',\n 'com.microsoft.windowsMediaWmv': 'video/x-ms-wmv',\n 'com.microsoft.windowsMediaWmx': 'video/x-ms-wmx',\n 'com.microsoft.windowsMediaWmz': 'video/x-ms-wmz',\n 'com.microsoft.windowsMediaWvx': 'video/x-ms-wvx',\n 'com.netscape.javascriptSource': 'text/javascript',\n 'com.pkware.zipArchive': 'application/zip',\n 'com.rarlab.rarArchive': 'application/rar',\n 'com.redhat.redhatPackage': 'application/x-redhat-package',\n 'com.sgi.sgiImage': 'image/sgi',\n 'com.sun.javaAppDescriptor': 'text/vnd.sun.j2me.app-descriptor',\n 'com.sun.javaArchive': 'application/java-archive',\n 'com.sun.javaClass': 'application/java',\n 'com.sun.javaSource': 'text/x-java-source',\n 'com.sun.javaWebStart': 'application/jnlp',\n 'com.truevision.tgaImage': 'image/tga',\n 'org.bzip.bzip2Archive': 'application/x-bzip2',\n 'org.debian.debianPackage': 'application/x-debian-package',\n 'org.gnu.gnuTarArchive': 'application/x-gtar',\n 'org.gnu.gnuZipArchive': 'application/gzip',\n 'org.oasis.opendocument.textMaster': 'application/vnd.oasis.opendocument.text-master',\n 'org.oasis.opendocument.textWeb': 'application/vnd.oasis.opendocument.text-web',\n 'org.xiph.oggTheora': 'video/ogg',\n 'org.xiph.oggVorbis': 'audio/ogg',\n 'public.aifcAudio': 'audio/aiff',\n 'public.aiffAudio': 'audio/aiff',\n 'public.assemblySource': 'text/x-asm',\n 'public.cHeader': 'text/x-c-header',\n 'public.cpioArchive': 'application/x-cpio',\n 'public.cPlusPlusHeader': 'text/x-c++-hdr',\n 'public.cPlusPlusSource': 'application/x-cplusplus',\n 'public.cshScript': 'application/x-csh',\n 'public.cSource': 'text/x-c-code',\n 'public.isoImage': 'application/x-iso-image',\n 'public.mpeg4Audio': 'audio/mp4',\n 'public.objectiveCPlusPlusSource': 'text/x-objcppsrc',\n 'public.objectiveCSource': 'text/x-objcsrc',\n 'public.opentypeFont': 'font/opentype',\n 'public.perlScript': 'text/x-perl',\n 'public.phpScript': 'text/php',\n 'public.plainText': 'text/plain',\n 'public.pythonScript': 'text/x-python-script',\n 'public.shellScript': 'application/x-sh',\n 'public.tarArchive': 'application/tar',\n 'public.truetypeTtfFont': 'application/x-font-ttf',\n 'public.ulawAudio': 'audio/au',\n 'public.xbitmapImage': 'image/xbm',\n 'unofficial.atomFeed': 'application/atom+xml',\n 'unofficial.m3u8Playlist': 'application/x-mpegURL',\n 'unofficial.plsPlaylist': 'audio/scpls',\n 'unofficial.rdfFeed': 'application/rdf+xml',\n 'unofficial.rssFeed': 'application/rss+xml',\n }\n\n utiRevDefs: { [key: string]: string } = {\n ...this.compatUtiRevDefs,\n 'com.adobe.encapsulated-postscript': 'image/eps',\n 'com.adobe.illustrator.ai-image': 'application/illustrator',\n 'com.adobe.indesign-image': 'image/indesign',\n 'com.adobe.pdf': 'application/pdf',\n 'com.adobe.photoshop-image': 'image/psd',\n 'com.adobe.postscript': 'application/postscript',\n 'com.adobe.postscript-pfa-font': 'application/x-font-type1',\n 'com.adobe.postscript-pfb-font': 'application/x-font-type1',\n 'com.allume.stuffit-archive': 'application/stuffit',\n 'com.apple.applescript.script': 'application/x-applescript',\n 'com.apple.applescript.text': 'application/x-applescript',\n 'com.apple.binhex-archive': 'application/binhex',\n 'com.apple.disk-image-udif': 'application/x-apple-diskimage',\n 'com.apple.ical.ics': 'text/calendar',\n 'com.apple.ical.vcs': 'text/x-vcalendar',\n 'com.apple.macbinary-archive': 'application/macbinary',\n 'com.apple.pict': 'image/pict',\n 'com.apple.quartz-composer-composition': 'application/x-quartzcomposer',\n 'com.apple.quicktime-image': 'image/x-quicktime',\n 'com.apple.quicktime-movie': 'video/quicktime',\n 'com.bittorrent.torrent': 'application/x-bittorrent',\n 'com.compuserve.gif': 'image/gif',\n 'com.js.efx-fax': 'image/efax',\n 'com.kodak.flashpix.image': 'image/vndfpx',\n 'com.lizardtech.djvu': 'image/vnd.djvu',\n 'com.macromedia.shockwave-flash': 'application/x-shockwave-flash',\n 'com.microsoft.advanced-stream-redirector': 'video/x-ms-asx',\n 'com.microsoft.advanced-systems-format': 'video/x-ms-asf',\n 'com.microsoft.bmp': 'image/bmp',\n 'com.microsoft.excel.xls': 'application/excel',\n 'com.microsoft.ico': 'image/x-icon',\n 'com.microsoft.powerpoint.ppt': 'application/powerpoint',\n 'com.microsoft.waveform-audio': 'audio/wave',\n 'com.microsoft.windows-dynamic-link-library': 'application/x-msdownload',\n 'com.microsoft.windows-executable': 'application/exe',\n 'com.microsoft.windows-media-wax': 'audio/x-ms-wax',\n 'com.microsoft.windows-media-wm': 'video/x-ms-wm',\n 'com.microsoft.windows-media-wma': 'audio/x-ms-wma',\n 'com.microsoft.windows-media-wmd': 'video/x-ms-wmd',\n 'com.microsoft.windows-media-wmp': 'video/x-ms-wmp',\n 'com.microsoft.windows-media-wmv': 'video/x-ms-wmv',\n 'com.microsoft.windows-media-wmx': 'video/x-ms-wmx',\n 'com.microsoft.windows-media-wmz': 'video/x-ms-wmz',\n 'com.microsoft.windows-media-wvx': 'video/x-ms-wvx',\n 'com.microsoft.word.doc': 'application/msword',\n 'com.netscape.javascript-source': 'text/javascript',\n 'com.pkware.zip-archive': 'application/zip',\n 'com.rarlab.rar-archive': 'application/rar',\n 'com.real.realaudio': 'audio/vnd.rn-realaudio',\n 'com.real.realmedia': 'application/vnd.rn-realmedia',\n 'com.real.smil': 'application/smil',\n 'com.redhat.redhat-package': 'application/x-redhat-package',\n 'com.sgi.sgi-image': 'image/sgi',\n 'com.soundblaster.soundfont': 'application/x-soundfont',\n 'com.sun.java-app-descriptor': 'text/vnd.sun.j2me.app-descriptor',\n 'com.sun.java-archive': 'application/java-archive',\n 'com.sun.java-class': 'application/java',\n 'com.sun.java-source': 'text/x-java-source',\n 'com.sun.java-web-start': 'application/jnlp',\n 'com.truevision.tga-image': 'image/tga',\n 'org.bzip.bzip2-archive': 'application/x-bzip2',\n 'org.debian.debian-package': 'application/x-debian-package',\n 'org.gnu.gnu-tar-archive': 'application/x-gtar',\n 'org.gnu.gnu-zip-archive': 'application/gzip',\n 'org.neooffice.calc': 'application/vnd.sun.xml.calc',\n 'org.neooffice.draw': 'application/vnd.sun.xml.draw',\n 'org.neooffice.global': 'application/vnd.sun.xml.writer.global',\n 'org.neooffice.impress': 'application/vnd.sun.xml.impress',\n 'org.neooffice.math': 'application/vnd.sun.xml.math',\n 'org.neooffice.writer': 'application/vnd.sun.xml.writer',\n 'org.oasis.opendocument.chart': 'application/vnd.oasis.opendocument.chart',\n 'org.oasis.opendocument.database': 'application/vnd.oasis.opendocument.database',\n 'org.oasis.opendocument.formula': 'application/vnd.oasis.opendocument.formula',\n 'org.oasis.opendocument.graphics': 'application/vnd.oasis.opendocument.graphics',\n 'org.oasis.opendocument.image': 'application/vnd.oasis.opendocument.image',\n 'org.oasis.opendocument.presentation': 'application/vnd.oasis.opendocument.presentation',\n 'org.oasis.opendocument.spreadsheet': 'application/vnd.oasis.opendocument.spreadsheet',\n 'org.oasis.opendocument.text': 'application/vnd.oasis.opendocument.text',\n 'org.oasis.opendocument.text-master': 'application/vnd.oasis.opendocument.text-master',\n 'org.oasis.opendocument.text-web': 'application/vnd.oasis.opendocument.text-web',\n 'org.tug.tex': 'text/tex',\n 'org.xiph.flac': 'audio/flac',\n 'org.xiph.ogg-theora': 'video/ogg',\n 'org.xiph.ogg-vorbis': 'audio/ogg',\n 'public.3gpp': 'video/3gpp',\n 'public.3gpp2': 'video/3gpp2',\n 'public.aifc-audio': 'audio/aiff',\n 'public.aiff-audio': 'audio/aiff',\n 'public.assembly-source': 'text/x-asm',\n 'public.avi': 'video/avi',\n 'public.c-header': 'text/x-c-header',\n 'public.cpio-archive': 'application/x-cpio',\n 'public.c-plus-plus-header': 'text/x-c++-hdr',\n 'public.c-plus-plus-source': 'application/x-cplusplus',\n 'public.csh-script': 'application/x-csh',\n 'public.c-source': 'text/x-c-code',\n 'public.css': 'text/css',\n 'public.dv': 'video/x-dv',\n 'public.flv': 'video/x-flv',\n 'public.html': 'text/html',\n 'public.iso-image': 'application/x-iso-image',\n 'public.jpeg': 'image/jpeg',\n 'public.jpeg2000': 'image/jp2',\n 'public.midi': 'audio/midi',\n 'public.mka': 'audio/x-matroska',\n 'public.mkv': 'video/x-matroska',\n 'public.mp3': 'audio/mp3',\n 'public.mpeg': 'video/mpeg',\n 'public.mpeg4': 'video/mp4',\n 'public.mpeg4-audio': 'audio/mp4',\n 'public.mpegts': 'video/MP2T',\n 'public.objective-c-plus-plus-source': 'text/x-objcppsrc',\n 'public.objective-c-source': 'text/x-objcsrc',\n 'public.opentype-font': 'font/opentype',\n 'public.perl-script': 'text/x-perl',\n 'public.php-script': 'text/php',\n 'public.plain-text': 'text/plain',\n 'public.png': 'image/png',\n 'public.python-script': 'text/x-python-script',\n 'public.rtf': 'text/rtf',\n 'public.shell-script': 'application/x-sh',\n 'public.tar-archive': 'application/tar',\n 'public.tiff': 'image/tiff',\n 'public.truetype-ttf-font': 'application/x-font-ttf',\n 'public.ulaw-audio': 'audio/au',\n 'public.vcard': 'text/vcard',\n 'public.webm': 'video/webm',\n 'public.xbitmap-image': 'image/xbm',\n 'public.xml': 'text/xml',\n 'unofficial.atom-feed': 'application/atom+xml',\n 'unofficial.m3u8-playlist': 'application/x-mpegURL',\n 'unofficial.opml': 'text/x-opml',\n 'unofficial.pls-playlist': 'audio/scpls',\n 'unofficial.rdf-feed': 'application/rdf+xml',\n 'unofficial.rss-feed': 'application/rss+xml',\n }\n\n utiExts: { [key: string]: string } = {\n jpg: 'public.jpeg',\n jpeg: 'public.jpeg',\n png: 'public.png',\n rtf: 'public.rtf',\n mpeg: 'public.mpeg',\n mpg: 'public.mpeg',\n html: 'public.html',\n htm: 'public.html',\n pdf: 'com.adobe.pdf',\n xls: 'com.microsoft.excel.xls',\n xlsx: 'com.microsoft.excel.xls',\n doc: 'com.microsoft.word.doc',\n docx: 'com.microsoft.word.doc',\n }\n\n utiDefs: { [key: string]: string } = {\n 'application/atom+xml': 'unofficial.atom-feed',\n 'application/bat': 'com.microsoft.windows-executable',\n 'application/binhex': 'com.apple.binhex-archive',\n 'application/binhex4': 'com.apple.binhex-archive',\n 'application/ecmascript': 'com.netscape.javascript-source',\n 'application/eps': 'com.adobe.encapsulated-postscript',\n 'application/excel': 'com.microsoft.excel.xls',\n 'application/exe': 'com.microsoft.windows-executable',\n 'application/gnutar': 'public.tar-archive',\n 'application/gzip': 'org.gnu.gnu-zip-archive',\n 'application/illustrator': 'com.adobe.illustrator.ai-image',\n 'application/indesign': 'com.adobe.indesign-image',\n 'application/java-archive': 'com.sun.java-archive',\n 'application/java-byte-code': 'com.sun.java-class',\n 'application/java': 'com.sun.java-class',\n 'application/javascript': 'com.netscape.javascript-source',\n 'application/jnlp': 'com.sun.java-web-start',\n 'application/latex': 'org.tug.tex',\n 'application/mac-binary': 'com.apple.macbinary-archive',\n 'application/mac-binhex': 'com.apple.binhex-archive',\n 'application/mac-binhex40': 'com.apple.binhex-archive',\n 'application/macbinary': 'com.apple.macbinary-archive',\n 'application/mspowerpoint': 'com.microsoft.powerpoint.ppt',\n 'application/msword': 'com.microsoft.word.doc',\n 'application/octet-stream': 'com.microsoft.windows-executable',\n 'application/pdf': 'com.adobe.pdf',\n 'application/photoshop': 'com.adobe.photoshop-image',\n 'application/php': 'public.php-script',\n 'application/plain': 'public.plain-text',\n 'application/postscript': 'com.adobe.postscript',\n 'application/powerpoint': 'com.microsoft.powerpoint.ppt',\n 'application/rar': 'com.rarlab.rar-archive',\n 'application/rdf+xml': 'unofficial.rdf-feed',\n 'application/rss+xml': 'unofficial.rss-feed',\n 'application/rtf': 'public.rtf',\n 'application/smil': 'com.real.smil',\n 'application/stuffit': 'com.allume.stuffit-archive',\n 'application/tar': 'public.tar-archive',\n 'application/tga': 'com.truevision.tga-image',\n 'application/vnd.fpx': 'com.kodak.flashpix.image',\n 'application/vnd.ms-excel': 'com.microsoft.excel.xls',\n 'application/vnd.ms-powerpoint': 'com.microsoft.powerpoint.ppt',\n 'application/vnd.oasis.opendocument.chart': 'org.oasis.opendocument.chart',\n 'application/vnd.oasis.opendocument.database': 'org.oasis.opendocument.database',\n 'application/vnd.oasis.opendocument.formula': 'org.oasis.opendocument.formula',\n 'application/vnd.oasis.opendocument.graphics-template': 'org.oasis.opendocument.graphics',\n 'application/vnd.oasis.opendocument.graphics': 'org.oasis.opendocument.graphics',\n 'application/vnd.oasis.opendocument.image': 'org.oasis.opendocument.image',\n 'application/vnd.oasis.opendocument.presentation-template': 'org.oasis.opendocument.presentation',\n 'application/vnd.oasis.opendocument.presentation': 'org.oasis.opendocument.presentation',\n 'application/vnd.oasis.opendocument.spreadsheet-template': 'org.oasis.opendocument.spreadsheet',\n 'application/vnd.oasis.opendocument.spreadsheet': 'org.oasis.opendocument.spreadsheet',\n 'application/vnd.oasis.opendocument.text-master': 'org.oasis.opendocument.text-master',\n 'application/vnd.oasis.opendocument.text-template': 'org.oasis.opendocument.text',\n 'application/vnd.oasis.opendocument.text-web': 'org.oasis.opendocument.text-web',\n 'application/vnd.oasis.opendocument.text': 'org.oasis.opendocument.text',\n 'application/vnd.rn-realmedia': 'com.real.realmedia',\n 'application/vnd.sun.xml.calc.template': 'org.neooffice.calc',\n 'application/vnd.sun.xml.calc': 'org.neooffice.calc',\n 'application/vnd.sun.xml.draw.template': 'org.neooffice.draw',\n 'application/vnd.sun.xml.draw': 'org.neooffice.draw',\n 'application/vnd.sun.xml.impress.template': 'org.neooffice.impress',\n 'application/vnd.sun.xml.impress': 'org.neooffice.impress',\n 'application/vnd.sun.xml.math': 'org.neooffice.math',\n 'application/vnd.sun.xml.writer.global': 'org.neooffice.global',\n 'application/vnd.sun.xml.writer.template': 'org.neooffice.writer',\n 'application/vnd.sun.xml.writer': 'org.neooffice.writer',\n 'application/vndms-excel': 'com.microsoft.excel.xls',\n 'application/vndms-powerpoint': 'com.microsoft.powerpoint.ppt',\n 'application/vndrn-realmedia': 'com.real.realmedia',\n 'application/x-apple-diskimage': 'com.apple.disk-image-udif',\n 'application/x-applescript': 'com.apple.applescript.script',\n 'application/x-bat': 'com.microsoft.windows-executable',\n 'application/x-binary': 'com.apple.macbinary-archive',\n 'application/x-binhex40': 'com.apple.binhex-archive',\n 'application/x-bittorrent': 'com.bittorrent.torrent',\n 'application/x-bzip2': 'org.bzip.bzip2-archive',\n 'application/x-cpio': 'public.cpio-archive',\n 'application/x-cplusplus': 'public.c-plus-plus-source',\n 'application/x-csh': 'public.csh-script',\n 'application/x-deb': 'org.debian.debian-package',\n 'application/x-debian-package': 'org.debian.debian-package',\n 'application/x-eps': 'com.adobe.encapsulated-postscript',\n 'application/x-excel': 'com.microsoft.excel.xls',\n 'application/x-exe': 'com.microsoft.windows-executable',\n 'application/x-flac': 'org.xiph.flac',\n 'application/x-font-ttf': 'public.truetype-ttf-font',\n 'application/x-font-type1': 'com.adobe.postscript-pfa-font',\n 'application/x-gtar': 'org.gnu.gnu-tar-archive',\n 'application/x-gzip': 'org.gnu.gnu-zip-archive',\n 'application/x-iso-image': 'public.iso-image',\n 'application/x-java-class': 'com.sun.java-class',\n 'application/x-java': 'com.sun.java-web-start',\n 'application/x-javascript': 'com.netscape.javascript-source',\n 'application/x-latex': 'org.tug.tex',\n 'application/x-mac-binhex40': 'com.apple.binhex-archive',\n 'application/x-macbinary': 'com.apple.macbinary-archive',\n 'application/x-midi': 'public.midi',\n 'application/x-mpegURL': 'unofficial.m3u8-playlist',\n 'application/x-ms-wmd': 'com.microsoft.windows-media-wmd',\n 'application/x-ms-wmz': 'com.microsoft.windows-media-wmz',\n 'application/x-msdos-program': 'com.microsoft.windows-executable',\n 'application/x-msdownload': 'com.microsoft.windows-executable',\n 'application/x-msexcel': 'com.microsoft.excel.xls',\n 'application/x-mspowerpoint': 'com.microsoft.powerpoint.ppt',\n 'application/x-pdf': 'com.adobe.pdf',\n 'application/x-perl': 'public.perl-script',\n 'application/x-php': 'public.php-script',\n 'application/x-quartzcomposer': 'com.apple.quartz-composer-composition',\n 'application/x-rar-compressed': 'com.rarlab.rar-archive',\n 'application/x-redhat-package': 'com.redhat.redhat-package',\n 'application/x-rpm': 'com.redhat.redhat-package',\n 'application/x-rtf': 'public.rtf',\n 'application/x-sh': 'public.shell-script',\n 'application/x-shellscript': 'public.shell-script',\n 'application/x-shockwave-flash': 'com.macromedia.shockwave-flash',\n 'application/x-sit': 'com.allume.stuffit-archive',\n 'application/x-smil': 'com.real.smil',\n 'application/x-soundfont': 'com.soundblaster.soundfont',\n 'application/x-stuffit': 'com.allume.stuffit-archive',\n 'application/x-tar': 'public.tar-archive',\n 'application/x-tex': 'org.tug.tex',\n 'application/x-texinfo': 'org.tug.tex',\n 'application/x-troff-msvideo': 'public.avi',\n 'application/x-zip-compressed': 'com.pkware.zip-archive',\n 'application/xhtml+xml': 'public.html',\n 'application/xml': 'public.xml',\n 'application/zip': 'com.pkware.zip-archive',\n 'audio/3gpp': 'public.3gpp',\n 'audio/3gpp2': 'public.3gpp2',\n 'audio/aiff': 'public.aiff-audio',\n 'audio/au': 'public.ulaw-audio',\n 'audio/basic': 'public.ulaw-audio',\n 'audio/flac': 'org.xiph.flac',\n 'audio/mid': 'public.midi',\n 'audio/midi': 'public.midi',\n 'audio/mp3': 'public.mp3',\n 'audio/mp4': 'public.mpeg4-audio',\n 'audio/mp4a-latm': 'public.mpeg4-audio',\n 'audio/mpeg': 'public.mp3',\n 'audio/mpeg3': 'public.mp3',\n 'audio/mpegurl': 'unofficial.m3u-playlist',\n 'audio/mpg': 'public.mp3',\n 'audio/ogg': 'org.xiph.ogg-vorbis',\n 'audio/scpls': 'unofficial.pls-playlist',\n 'audio/snd': 'public.ulaw-audio',\n 'audio/vnd.rn-realaudio': 'com.real.realaudio',\n 'audio/wav': 'com.microsoft.waveform-audio',\n 'audio/wave': 'com.microsoft.waveform-audio',\n 'audio/webm': 'public.webm',\n 'audio/x-adpcm': 'public.ulaw-audio',\n 'audio/x-aiff': 'public.aiff-audio',\n 'audio/x-au': 'public.ulaw-audio',\n 'audio/x-flac': 'org.xiph.flac',\n 'audio/x-matroska': 'public.mka',\n 'audio/x-mid': 'public.midi',\n 'audio/x-midi': 'public.midi',\n 'audio/x-mp3': 'public.mp3',\n 'audio/x-mpeg-3': 'public.mp3',\n 'audio/x-mpeg': 'public.mp3',\n 'audio/x-mpeg3': 'public.mp3',\n 'audio/x-mpegurl': 'unofficial.m3u-playlist',\n 'audio/x-mpg': 'public.mp3',\n 'audio/x-ms-wax': 'com.microsoft.windows-media-wax',\n 'audio/x-ms-wma': 'com.microsoft.windows-media-wma',\n 'audio/x-ogg': 'org.xiph.ogg-vorbis',\n 'audio/x-pn-realaudio-plugin': 'com.real.realaudio',\n 'audio/x-pn-realaudio': 'com.real.realaudio',\n 'audio/x-pn-wav': 'com.microsoft.waveform-audio',\n 'audio/x-realaudio': 'com.real.realmedia',\n 'audio/x-scpls': 'unofficial.pls-playlist',\n 'audio/x-wav': 'com.microsoft.waveform-audio',\n 'font/opentype': 'public.opentype-font',\n 'image/bmp': 'com.microsoft.bmp',\n 'image/efax': 'com.js.efx-fax',\n 'image/eps': 'com.adobe.encapsulated-postscript',\n 'image/fpx': 'com.kodak.flashpix.image',\n 'image/gif': 'com.compuserve.gif',\n 'image/indd': 'com.adobe.indesign-image',\n 'image/indesign': 'com.adobe.indesign-image',\n 'image/jp2': 'public.jpeg2000',\n 'image/jpeg': 'public.jpeg',\n 'image/ms-bmp': 'com.microsoft.bmp',\n 'image/photoshop': 'com.adobe.photoshop-image',\n 'image/pict': 'com.apple.pict',\n 'image/pipeg': 'public.jpeg',\n 'image/pjpeg': 'public.jpeg',\n 'image/png': 'public.png',\n 'image/psd': 'com.adobe.photoshop-image',\n 'image/sgi': 'com.sgi.sgi-image',\n 'image/targa': 'com.truevision.tga-image',\n 'image/tga': 'com.truevision.tga-image',\n 'image/tiff': 'public.tiff',\n 'image/vnd.djvu': 'com.lizardtech.djvu',\n 'image/vndfpx': 'com.kodak.flashpix.image',\n 'image/vndnet-fpx': 'com.kodak.flashpix.image',\n 'image/webp': 'public.webp',\n 'image/x-bitmap': 'com.microsoft.bmp',\n 'image/x-bmp': 'com.microsoft.bmp',\n 'image/x-djvu': 'com.lizardtech.djvu',\n 'image/x-eps': 'com.adobe.encapsulated-postscript',\n 'image/x-icon': 'com.microsoft.ico',\n 'image/x-indesign': 'com.adobe.indesign-image',\n 'image/x-macpict': 'com.apple.pict',\n 'image/x-ms-bmp': 'com.microsoft.bmp',\n 'image/x-photoshop': 'com.adobe.photoshop-image',\n 'image/x-pict': 'com.apple.pict',\n 'image/x-quicktime': 'com.apple.quicktime-image',\n 'image/x-tiff': 'public.tiff',\n 'image/x-windows-bmp': 'com.microsoft.bmp',\n 'image/x-xbitmap': 'com.microsoft.bmp',\n 'image/x-xbm': 'public.xbitmap-image',\n 'image/xbm': 'public.xbitmap-image',\n 'multipart/x-gzip': 'org.gnu.gnu-zip-archive',\n 'multipart/x-zip': 'com.pkware.zip-archive',\n 'music/crescendo': 'public.midi',\n 'text/calendar': 'com.apple.ical.ics',\n 'text/css': 'public.css',\n 'text/directory': 'public.vcard',\n 'text/ecmascript': 'com.netscape.javascript-source',\n 'text/html': 'public.html',\n 'text/javascript': 'com.netscape.javascript-source',\n 'text/php': 'public.php-script',\n 'text/plain': 'public.plain-text',\n 'text/richtext': 'public.rtf',\n 'text/rtf': 'public.rtf',\n 'text/ruby-script': 'public.ruby-script',\n 'text/tex': 'org.tug.tex',\n 'text/vcard': 'public.vcard',\n 'text/vnd.sun.j2me.app-descriptor': 'com.sun.java-app-descriptor',\n 'text/x-asm': 'public.assembly-source',\n 'text/x-c-code': 'public.c-source',\n 'text/x-c-header': 'public.c-header',\n 'text/x-c': 'public.c-source',\n 'text/x-c++-code': 'public.c-plus-plus-source',\n 'text/x-c++-hdr': 'public.c-plus-plus-header',\n 'text/x-c++-src': 'public.c-plus-plus-source',\n 'text/x-c++src': 'public.c-plus-plus-source',\n 'text/x-h': 'public.c-header',\n 'text/x-java-source': 'com.sun.java-source',\n 'text/x-latex': 'org.tug.tex',\n 'text/x-objcppsrc': 'public.objective-c-plus-plus-source',\n 'text/x-objcsrc': 'public.objective-c-source',\n 'text/x-opml': 'unofficial.opml',\n 'text/x-perl-script': 'public.perl-script',\n 'text/x-perl': 'public.perl-script',\n 'text/x-php-script': 'public.php-script',\n 'text/x-python-script': 'public.python-script',\n 'text/x-python': 'public.python-script',\n 'text/x-scriptcsh': 'public.csh-script',\n 'text/x-scriptperl-module': 'public.perl-script',\n 'text/x-scriptperl': 'public.perl-script',\n 'text/x-scriptphyton': 'public.python-script',\n 'text/x-scriptsh': 'public.shell-script',\n 'text/x-server-parsed-html': 'public.html',\n 'text/x-tex': 'org.tug.tex',\n 'text/x-vcalendar': 'com.apple.ical.vcs',\n 'text/x-vcard': 'public.vcard',\n 'text/xhtml': 'public.html',\n 'text/xml': 'public.xml',\n 'video/3gpp': 'public.3gpp',\n 'video/3gpp2': 'public.3gpp2',\n 'video/avi': 'public.avi',\n 'video/MP2T': 'public.mpegts',\n 'video/mp4': 'public.mpeg4',\n 'video/mp4v': 'public.mpeg4',\n 'video/mpeg': 'public.mpeg',\n 'video/mpg': 'public.mpeg',\n 'video/msvideo': 'public.avi',\n 'video/ogg': 'org.xiph.ogg-theora',\n 'video/quicktime': 'com.apple.quicktime-movie',\n 'video/webm': 'public.webm',\n 'video/x-dv': 'public.dv',\n 'video/x-flv': 'public.flv',\n 'video/x-m4v': 'public.mpeg4',\n 'video/x-matroska': 'public.mkv',\n 'video/x-mpeg': 'public.mpeg',\n 'video/x-mpg': 'public.mpeg',\n 'video/x-ms-asf-plugin': 'com.microsoft.advanced-systems-format',\n 'video/x-ms-asf': 'com.microsoft.advanced-systems-format',\n 'video/x-ms-asx': 'com.microsoft.advanced-stream-redirector',\n 'video/x-ms-wm': 'com.microsoft.windows-media-wm',\n 'video/x-ms-wmd': 'com.microsoft.windows-media-wmd',\n 'video/x-ms-wmp': 'com.microsoft.windows-media-wmp',\n 'video/x-ms-wmv': 'com.microsoft.windows-media-wmv',\n 'video/x-ms-wmx': 'com.microsoft.windows-media-wmx',\n 'video/x-ms-wmz': 'com.microsoft.windows-media-wmz',\n 'video/x-ms-wvx': 'com.microsoft.windows-media-wvx',\n 'video/x-msvideo': 'public.avi',\n 'video/x-ogg': 'org.xiph.ogg-theora',\n 'x-msdos-program': 'com.microsoft.windows-executable',\n 'x-music/x-midi': 'public.midi',\n }\n dataOwnerApi: IccDataOwnerXApi\n authenticationProvider: AuthenticationProvider\n private readonly encryptedFields: EncryptedFieldsManifest\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private crypto: IccCryptoXApi,\n private authApi: IccAuthApi,\n dataOwnerApi: IccDataOwnerXApi,\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.fetchImpl = fetchImpl\n this.authenticationProvider = authenticationProvider\n this.dataOwnerApi = dataOwnerApi\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'Document.')\n }\n\n override get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.Document))\n }\n\n /**\n * Creates a new instance of document with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param message the message this document refers to.\n * @param c initialised data for the document. 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 * - sfkOption: specifies which sfk of the owning entity to use.\n * - ignoreAutoDelegations: if true the data won't be shared with the autodelegations of the user, but only with additional delegates\n * - alternateRootDelegation: by default a new entity is created with a root delegation from self to self. In keyless mode this is not possible,\n * and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.\n * @return a new instance of document.\n */\n async newInstance(\n user: models.User,\n message?: models.Message,\n c: any = {},\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n ignoreAutoDelegations?: boolean\n alternateRootDelegation?: string\n } = {}\n ) {\n const document = {\n ...(c ?? {}),\n _type: 'org.taktik.icure.entities.Document',\n id: c?.id ?? this.crypto.primitives.randomUuid(),\n created: c?.created ?? new Date().getTime(),\n modified: c?.modified ?? new Date().getTime(),\n responsible: c?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: c?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: c?.codes ?? [],\n tags: c?.tags ?? [],\n }\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 = message\n ? await this.crypto.xapi.resolveSecretIdUseOptions(\n { entity: message, type: EntityWithDelegationTypeName.Message },\n options.sfkOption ?? SecretIdUseOption.UseAnySharedWithParent\n )\n : []\n const extraDelegations = {\n ...(options.ignoreAutoDelegations == true\n ? {}\n : Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.medicalInformation ?? [])].map((d) => [d, AccessLevelEnum.WRITE])\n )),\n ...(options?.additionalDelegates ?? {}),\n }\n return new models.Document(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(\n document,\n EntityWithDelegationTypeName.Document,\n message?.id,\n sfk,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n .then((x) => x.updatedEntity)\n )\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * Same as {@link findByMessage} but it will only return the ids of the documents. It can also filter the documents where Document.created is between\n * startDate and endDate in ascending or descending order by that field. (default: ascending).\n */\n async findIdsByMessage(hcpartyId: string, message: models.Message, startDate?: number, endDate?: number, descending?: boolean): Promise<string[]> {\n const extractedKeys = await this.crypto.xapi.secretIdsOf({ entity: message, type: EntityWithDelegationTypeName.Message }, hcpartyId)\n const topmostParentId = (await this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0]\n return this.findDocumentIdsByDataOwnerSecretForeignKey(topmostParentId, [...new Set(extractedKeys)], startDate, endDate, descending)\n }\n\n /**\n * Decrypts an array of documents.\n * @param documents the documents to decrypt.\n * @return an array of objects containing the document and a flag indicating if it was successfully decrypted.\n */\n async decrypt(documents: Array<models.Document>): Promise<{ entity: models.Document; decrypted: boolean }[]> {\n return await this.crypto.xapi.tryDecryptEntities(documents, EntityWithDelegationTypeName.Document, (x) => new models.Document(x))\n }\n\n /**\n * Encrypts an array of documents.\n * @param documents the documents to encrypt.\n * @return the encrypted documents.\n */\n encrypt(documents: Array<models.Document>): Promise<Array<models.Document>> {\n return this.crypto.xapi.tryEncryptEntities(\n documents,\n EntityWithDelegationTypeName.Document,\n this.encryptedFields,\n true,\n false,\n (x) => new models.Document(x)\n )\n }\n\n //prettier-ignore\n getAttachmentAs(documentId: string, attachmentId: string, returnType: \"application/octet-stream\", enckeys?: string, fileName?: string): Promise<ArrayBuffer>\n //prettier-ignore\n getAttachmentAs(documentId: string, attachmentId: string, returnType: \"text/plain\", enckeys?: string, fileName?: string): Promise<string>\n //prettier-ignore\n getAttachmentAs(documentId: string, attachmentId: string, returnType: \"application/json\", enckeys?: string, fileName?: string): Promise<any>\n /**\n * @deprecated use getMainAttachmentAs instead\n */\n async getAttachmentAs(\n documentId: string,\n attachmentId: string,\n returnType: 'application/octet-stream' | 'text/plain' | 'application/json',\n enckeys?: string,\n fileName?: string\n ): Promise<any> {\n if (!!enckeys || !!fileName) {\n console.warn('Using getAttachmentAs method with a value for enckeys or fileName does nothing anymore.')\n }\n return this.getMainAttachmentAs(documentId, returnType)\n }\n\n //prettier-ignore\n getMainAttachmentAs(documentId: string, returnType: \"application/octet-stream\"): Promise<ArrayBuffer>\n //prettier-ignore\n getMainAttachmentAs(documentId: string, returnType: \"text/plain\"): Promise<string>\n //prettier-ignore\n getMainAttachmentAs(documentId: string, returnType: \"application/json\", tryHardToParseJson?: boolean): Promise<any>\n //prettier-ignore\n getMainAttachmentAs(documentId: string, returnType: 'application/octet-stream' | 'text/plain' | 'application/json', tryHardToParseJson?: boolean): Promise<any>\n /**\n * Gets the main attachment of a document without decrypting it.\n * @param documentId the id of the document.\n * @param returnType the desired return type for the attachment data.\n * @param tryHardToParseJson if true, will attempt to parse JSON even if the content type is not application/json.\n * @return the attachment data in the requested format.\n */\n async getMainAttachmentAs(\n documentId: string,\n returnType: 'application/octet-stream' | 'text/plain' | 'application/json',\n tryHardToParseJson: boolean = false\n ): Promise<any> {\n const url = this.host + `/document/${documentId}/attachment` + '?ts=' + new Date().getTime()\n return XHR.sendCommand(\n 'GET',\n url,\n await this.headers,\n null,\n this.fetchImpl,\n returnType,\n this.authenticationProvider.getAuthService(),\n undefined,\n returnType == 'application/json' && tryHardToParseJson\n )\n .then((doc) => doc.body)\n .catch((err) => this.handleError(err))\n }\n\n //prettier-ignore\n getAndTryDecryptMainAttachmentAs(document: models.Document, returnType: \"application/octet-stream\"): Promise<ArrayBuffer | undefined>\n //prettier-ignore\n getAndTryDecryptMainAttachmentAs(document: models.Document, returnType: \"text/plain\"): Promise<string | undefined>\n //prettier-ignore\n getAndTryDecryptMainAttachmentAs(document: models.Document, returnType: \"application/json\"): Promise<any | undefined>\n //prettier-ignore\n getAndTryDecryptMainAttachmentAs(document: models.Document, returnType: 'application/octet-stream' | 'text/plain' | 'application/json'): Promise<any | undefined>\n /**\n * Gets and decrypts the main attachment of a document, parsing it to the requested format.\n * @param document the document containing the attachment.\n * @param returnType the desired return type for the attachment data.\n * @return the decrypted and parsed attachment data, or undefined if decryption failed or parsing was unsuccessful.\n */\n async getAndTryDecryptMainAttachmentAs(\n document: models.Document,\n returnType: 'application/octet-stream' | 'text/plain' | 'application/json'\n ): Promise<any | undefined> {\n const key = (await this.crypto.xapi.encryptionKeysOf({ entity: document, type: EntityWithDelegationTypeName.Document }, undefined))[0]\n if (!key) return undefined\n const tryParse = this.parserFor(returnType)\n const attachmentInfo = await this.getAndTryDecryptDocumentAttachment(document, (decrypted) => Promise.resolve(tryParse(decrypted) !== undefined))\n if (attachmentInfo.wasDecrypted) {\n return tryParse(attachmentInfo.data)\n } else return undefined\n }\n private parserFor(returnType: 'application/octet-stream' | 'text/plain' | 'application/json'): (data: ArrayBuffer) => any | undefined {\n if (returnType === 'application/octet-stream') {\n return (data) => data\n } else if (returnType === 'text/plain') {\n return (data) => {\n try {\n return ua2utf8(data)\n } catch (e) {\n return undefined\n }\n }\n } else if (returnType === 'application/json') {\n return (data) => {\n try {\n return JSON.parse(ua2utf8(data))\n } catch (e) {\n return undefined\n }\n }\n } else throw new Error(`Unsupported type ${returnType}`)\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * Converts a MIME type and file extension to a UTI (Uniform Type Identifier).\n * @param mimeType the MIME type.\n * @param extension the file extension.\n * @return the corresponding UTI.\n */\n uti(mimeType: string, extension: string) {\n return (mimeType && mimeType !== 'application/octet-stream' ? this.utiDefs[mimeType] : this.utiExts[extension]) || this.utiDefs[mimeType]\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * Converts a UTI (Uniform Type Identifier) to a MIME type.\n * @param uti the UTI.\n * @return the corresponding MIME type.\n */\n mimeType(uti: string) {\n return this.utiRevDefs[uti]\n }\n\n /**\n * Adds an attachment to a document, encrypting it on client side using the encryption keys of the provided document.\n * @param document a document.\n * @param attachment a new main attachment for the document.\n * @param utis an array of UTIs for the attachment. The first element will be considered as the main UTI for the document. If provided and non-empty\n * overrides existing values.\n * @param deflate if true, compress the attachment before uploading. Reliable decompression of compressed data requires version 26.5 of the API and all users to be using at least version 8.7.0 of the SDK * @return the updated document.\n */\n async encryptAndSetDocumentAttachment(\n document: models.Document,\n attachment: ArrayBuffer | Uint8Array,\n utis?: string[],\n deflate: boolean = false\n ): Promise<models.Document> {\n if (!document.rev) throw new Error('Cannot set attachment on document without rev')\n const realDataSize = ua2ab(attachment).byteLength\n const { data: dataToEncrypt, algorithm: compressionAlgorithm } = deflate\n ? await compressData(attachment, utis)\n : { data: ua2ab(attachment), algorithm: undefined }\n\n const { encryptedData, updatedEntity } = await this.crypto.xapi.encryptDataOf(\n document,\n EntityWithDelegationTypeName.Document,\n dataToEncrypt,\n (d) => this.modifyDocumentWithUser(undefined, d)\n )\n return (\n await this.decrypt([\n await super.setMainDocumentAttachment(\n document.id!,\n updatedEntity?.rev ?? document.rev,\n encryptedData,\n utis,\n true,\n compressionAlgorithm,\n getCompressionVersion(),\n realDataSize\n ),\n ])\n )[0].entity\n }\n\n /**\n * Adds an unencrypted attachment to a document.\n * @param document a document.\n * @param attachment a new main attachment for the document.\n * @param utis an array of UTIs for the attachment. The first element will be considered as the main UTI for the document. If provided and non-empty\n * overrides existing values.\n * @param deflate if true, compress the attachment before uploading. Reliable decompression of compressed data requires version 26.5 of the API and all users to be using at least version 8.7.0 of the SDK * @return the updated document.\n */\n async setClearDocumentAttachment(\n document: models.Document,\n attachment: ArrayBuffer | Uint8Array,\n utis?: string[],\n deflate: boolean = false\n ): Promise<models.Document> {\n if (!document.rev) throw new Error('Cannot set attachment on document without rev')\n const realDataSize = ua2ab(attachment).byteLength\n const { data: dataToUpload, algorithm: compressionAlgorithm } = deflate\n ? await compressData(attachment, utis)\n : { data: ua2ab(attachment), algorithm: undefined }\n\n return (\n await this.decrypt([\n await super.setMainDocumentAttachment(\n document.id!,\n document.rev,\n dataToUpload,\n utis,\n false,\n compressionAlgorithm,\n getCompressionVersion(),\n realDataSize\n ),\n ])\n )[0].entity\n }\n\n /**\n * Adds a secondary attachment to a document, encrypting it on client side using the encryption keys of the provided document.\n * @param document a document.\n * @param secondaryAttachmentKey key for the secondary attachment.\n * @param attachment a new secondary attachment for the document.\n * @param utis an array of UTIs for the attachment. The first element will be considered as the main UTI for the document. If provided and non-empty\n * overrides existing values.\n * @param deflate if true, compress the attachment before uploading. Reliable decompression of compressed data requires version 26.5 of the API and all users to be using at least version 8.7.0 of the SDK * @return the updated document.\n */\n async encryptAndSetSecondaryDocumentAttachment(\n document: models.Document,\n secondaryAttachmentKey: string,\n attachment: ArrayBuffer | Uint8Array,\n utis?: string[],\n deflate: boolean = false\n ): Promise<models.Document> {\n if (!document.rev) throw new Error('Cannot set attachment on document without rev')\n const realDataSize = ua2ab(attachment).byteLength\n const { data: dataToEncrypt, algorithm: compressionAlgorithm } = deflate\n ? await compressData(attachment, utis)\n : { data: ua2ab(attachment), algorithm: undefined }\n\n const { encryptedData, updatedEntity } = await this.crypto.xapi.encryptDataOf(\n document,\n EntityWithDelegationTypeName.Document,\n dataToEncrypt,\n (d) => this.modifyDocumentWithUser(undefined, d)\n )\n return (\n await this.decrypt([\n await super.setSecondaryAttachment(\n document.id!,\n secondaryAttachmentKey,\n updatedEntity?.rev ?? document.rev!,\n encryptedData,\n utis,\n true,\n compressionAlgorithm,\n getCompressionVersion(),\n realDataSize\n ),\n ])\n )[0].entity\n }\n\n /**\n * Adds an unencrypted secondary attachment to a document.\n * @param document a document.\n * @param secondaryAttachmentKey key for the secondary attachment.\n * @param attachment a new secondary attachment for the document.\n * @param utis an array of UTIs for the attachment. The first element will be considered as the main UTI for the document. If provided and non-empty\n * overrides existing values.\n * @param deflate if true, compress the attachment before uploading. Reliable decompression of compressed data requires version 26.5 of the API and all users to be using at least version 8.7.0 of the SDK\n * @return the updated document.\n */\n async setClearSecondaryDocumentAttachment(\n document: models.Document,\n secondaryAttachmentKey: string,\n attachment: ArrayBuffer | Uint8Array,\n utis?: string[],\n deflate: boolean = false\n ): Promise<models.Document> {\n const realDataSize = ua2ab(attachment).byteLength\n const { data: dataToUpload, algorithm: compressionAlgorithm } = deflate\n ? await compressData(attachment, utis)\n : { data: ua2ab(attachment), algorithm: undefined }\n\n return (\n await this.decrypt([\n await super.setSecondaryAttachment(\n document.id!,\n secondaryAttachmentKey,\n document.rev!,\n dataToUpload,\n utis,\n false,\n compressionAlgorithm,\n getCompressionVersion(),\n realDataSize\n ),\n ])\n )[0].entity\n }\n\n /**\n * Gets the main attachment of a document and tries to decrypt it using the encryption keys of the document, throwing an error if the operation fails.\n * @param document a document.\n * @param validator optionally a validator function which checks if the decryption was successful. In cases where the document 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 getAndDecryptDocumentAttachment(\n document: models.Document,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<ArrayBuffer> {\n const retrieved = await this.getAndTryDecryptDocumentAttachment(document, (x) => validator(x))\n if (!retrieved.wasDecrypted) throw new Error(`No valid key found to decrypt data of document ${document.id}.`)\n return retrieved.data\n }\n\n /**\n * Gets the main attachment of a document and tries to decrypt it using the encryption keys of the document.\n * @param document a document.\n * @param validator optionally a validator function which checks if the decryption was successful. In cases where the document 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 getAndTryDecryptDocumentAttachment(\n document: models.Document,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<{ data: ArrayBuffer; wasDecrypted: boolean }> {\n const compressionAlgorithm = document.extraMainAttachmentInfo?.compressionAlgorithm\n return await this.crypto.xapi.tryDecryptDataOf(\n { entity: document, type: EntityWithDelegationTypeName.Document },\n await super.getRawMainDocumentAttachment(document.id!),\n async (decrypted) => {\n try {\n const data = compressionAlgorithm ? await decompressData(decrypted, compressionAlgorithm) : decrypted\n return (await validator(data)) ? data : undefined\n } catch {\n return undefined\n }\n }\n )\n }\n\n /**\n * Gets the secondary attachment of a document and tries to decrypt it using the encryption keys of the document, throwing an error if the operation fails.\n * @param document a document.\n * @param secondaryAttachmentKey key of the secondary attachment.\n * @param validator optionally a validator function which checks if the decryption was successful. In cases where the document 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.\n */\n async getAndDecryptSecondaryDocumentAttachment(\n document: models.Document,\n secondaryAttachmentKey: string,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<ArrayBuffer> {\n const { data, wasDecrypted } = await this.getAndTryDecryptSecondaryDocumentAttachment(document, secondaryAttachmentKey, (x) => validator(x))\n if (!wasDecrypted) throw new Error(`No valid key found to decrypt data of document ${document.id}.`)\n return data\n }\n\n /**\n * Gets the secondary attachment of a document and tries to decrypt it using the encryption keys of the document.\n * @param document a document.\n * @param secondaryAttachmentKey key of the secondary attachment.\n * @param validator optionally a validator function which checks if the decryption was successful. In cases where the document 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 getAndTryDecryptSecondaryDocumentAttachment(\n document: models.Document,\n secondaryAttachmentKey: string,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<{ data: ArrayBuffer; wasDecrypted: boolean }> {\n const compressionAlgorithm = document.secondaryAttachments?.[secondaryAttachmentKey]?.compressionAlgorithm\n return await this.crypto.xapi.tryDecryptDataOf(\n { entity: document, type: EntityWithDelegationTypeName.Document },\n await super.getSecondaryAttachment(document.id!, secondaryAttachmentKey),\n async (decrypted) => {\n try {\n const data = compressionAlgorithm ? await decompressData(decrypted, compressionAlgorithm) : decrypted\n return (await validator(data)) ? data : undefined\n } catch {\n return undefined\n }\n }\n )\n }\n\n /**\n * @param document a document\n * @return the id of the message that the document 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 decryptMessageIdOf(document: models.Document): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: document, type: EntityWithDelegationTypeName.Document }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given document\n */\n async hasWriteAccess(document: models.Document): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: document, type: EntityWithDelegationTypeName.Document })\n }\n\n /**\n * Share an existing document with other data owners, allowing them to access the non-encrypted data of the document 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 document.\n * @param document the document to share.\n * @param options optional parameters to customize the sharing behaviour:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - shareMessageId: specifies if the id of the message that this document 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 document: models.Document,\n options: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n shareMessageId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Document> {\n return this.shareWithMany(document, { [delegateId]: options })\n }\n\n /**\n * Share an existing document with other data owners, allowing them to access the non-encrypted data of the document and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param document the document to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - shareMessageId: specifies if the id of the message that this document 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 document: models.Document,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n shareMessageId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Document> {\n return (await this.tryShareWithMany(document, delegates)).updatedEntityOrThrow\n }\n /**\n * Share an existing document with other data owners, allowing them to access the non-encrypted data of the document and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param document the document to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - shareMessageId: specifies if the id of the message that this document 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 document: models.Document,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n shareMessageId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.Document>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(document, EntityWithDelegationTypeName.Document)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyDocumentWithUser(undefined, entityWithEncryptionKey) : document\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.Document,\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.shareMessageId,\n shareSecretIds: options.shareSecretIds,\n },\n ])\n ),\n (x) => super.bulkShareDocument(x)\n )\n .then((r) => r.mapSuccessAsync(async (m) => (await this.decrypt([m]))[0].entity))\n }\n\n /**\n * Gets the data owners that have access to a document.\n * @param entity the document.\n * @return an object containing the permissions by data owner id and a flag indicating if there are unknown anonymous data owners.\n */\n getDataOwnersWithAccessTo(\n entity: models.Document\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.Document })\n }\n\n /**\n * Gets the encryption keys of a document.\n * @param entity the document.\n * @return an array of encryption keys.\n */\n getEncryptionKeysOf(entity: models.Document): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.Document }, undefined)\n }\n\n /**\n * Creates delegation de-anonymization metadata for a document.\n * @param entity the document.\n * @param delegates the data owner ids of the delegates.\n */\n createDelegationDeAnonymizationMetadata(entity: models.Document, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo(\n { entity, type: EntityWithDelegationTypeName.Document },\n delegates\n )\n }\n\n private async decryptPage(page: PaginatedListDocument): Promise<PaginatedListDocument> {\n return {\n ...page,\n rows: (await this.decrypt(page.rows ?? [])).map((x) => x.entity),\n }\n }\n\n /**\n * Creates a new document.\n * @param user the user (not used).\n * @param body the document to create.\n * @return the created document.\n */\n async createDocumentWithUser(user: models.User | undefined, body: models.Document): Promise<models.Document> {\n return (await this.decrypt([await super.createDocument((await this.encrypt([body]))[0])]))[0].entity\n }\n\n /**\n * Deletes the main attachment of a document.\n * @param user the user (not used).\n * @param documentId the id of the document.\n * @return the updated document.\n */\n async deleteAttachmentWithUser(user: models.User | undefined, documentId: string): Promise<models.Document> {\n return (await this.decrypt([await super.deleteAttachment(documentId)]))[0].entity\n }\n\n /**\n * @deprecated\n */\n async findByTypeHCPartyMessageSecretFKeysWithUser(\n user: models.User | undefined,\n documentTypeCode: string,\n hcPartyId: string,\n secretFKeys: string[]\n ): Promise<Array<models.Document>> {\n return (await this.decrypt(await super.findByTypeHCPartyMessageSecretFKeys(documentTypeCode, hcPartyId, secretFKeys))).map((x) => x.entity)\n }\n\n /**\n * @deprecated\n */\n async findDocumentsByHCPartyPatientForeignKeysWithUser(\n user: models.User | undefined,\n hcPartyId: string,\n secretFKeys: string[]\n ): Promise<Array<models.Document>> {\n return (await this.decrypt(await super.findDocumentsByHCPartyPatientForeignKeys(hcPartyId, secretFKeys))).map((x) => x.entity)\n }\n\n /**\n * @deprecated\n */\n async findDocumentsByHCPartyPatientForeignKeyWithUser(\n user: models.User | undefined,\n hcPartyId: string,\n secretFKey: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): Promise<PaginatedListDocument> {\n return await this.decryptPage(await super.findDocumentsByHCPartyPatientForeignKey(hcPartyId, secretFKey, startKey, startDocumentId, limit))\n }\n\n async findWithoutDelegationWithUser(user: models.User | undefined, limit?: number): Promise<Array<models.Document>> {\n return (await this.decrypt(await super.findWithoutDelegation(limit))).map((x) => x.entity)\n }\n\n /**\n * Gets a document by id.\n * @param user the user (not used).\n * @param documentId the id of the document.\n * @return the document.\n */\n async getDocumentWithUser(user: models.User | undefined, documentId: string): Promise<models.Document> {\n return (await this.decrypt([await super.getDocument(documentId)]))[0].entity\n }\n\n /**\n * Gets a document by external UUID.\n * @param user the user (not used).\n * @param externalUuid the external UUID of the document.\n * @return the document.\n */\n async getDocumentByExternalUuidWithUser(user: models.User | undefined, externalUuid: string): Promise<models.Document> {\n return (await this.decrypt([await super.getDocumentByExternalUuid(externalUuid)]))[0].entity\n }\n\n /**\n * Gets multiple documents by their ids.\n * @param user the user (not used).\n * @param body a list of document ids.\n * @return the documents.\n */\n async getDocumentsWithUser(user: models.User | undefined, body?: ListOfIds): Promise<Array<models.Document>> {\n return (await this.decrypt(await super.getDocuments(body))).map((x) => x.entity)\n }\n\n /**\n * Gets all documents with a specific external UUID.\n * @param user the user (not used).\n * @param externalUuid the external UUID.\n * @return the documents.\n */\n async getDocumentsByExternalUuidWithUser(user: models.User | undefined, externalUuid: string): Promise<Array<models.Document>> {\n return (await this.decrypt(await super.getDocumentsByExternalUuid(externalUuid))).map((x) => x.entity)\n }\n\n /**\n * Updates a document.\n * @param user the user (not used).\n * @param body the document to update.\n * @return the updated document.\n */\n async modifyDocumentWithUser(user: models.User | undefined, body: models.Document): Promise<models.Document> {\n return (await this.decrypt([await super.modifyDocument((await this.encrypt([body]))[0])]))[0].entity\n }\n\n /**\n * Updates multiple documents.\n * @param user the user (not used).\n * @param body the documents to update.\n * @return the updated documents.\n */\n async modifyDocumentsWithUser(user: models.User | undefined, body: Array<models.Document>): Promise<Array<models.Document>> {\n return (await this.decrypt(await super.modifyDocuments(await this.encrypt(body)))).map((x) => x.entity)\n }\n\n /**\n * Sets the main attachment of a document.\n * @param user the user (not used).\n * @param documentId the id of the document.\n * @param documentRev the revision of the document.\n * @param body the attachment data.\n * @param utis an array of UTIs for the attachment.\n * @param dataIsEncrypted whether the data is already encrypted.\n * @return the updated document.\n */\n async setMainDocumentAttachmentWithUser(\n user: models.User | undefined,\n documentId: string,\n documentRev: string,\n body: Object,\n utis?: Array<string>,\n dataIsEncrypted?: boolean\n ): Promise<models.Document> {\n return (await this.decrypt([await super.setMainDocumentAttachment(documentId, documentRev, body, utis, dataIsEncrypted)]))[0].entity\n }\n\n /**\n * Sets a secondary attachment on a document.\n * @param user the user (not used).\n * @param documentId the id of the document.\n * @param key the key for the secondary attachment.\n * @param rev the revision of the document.\n * @param attachment the attachment data.\n * @param utis an array of UTIs for the attachment.\n * @param dataIsEncrypted whether the data is already encrypted.\n * @return the updated document.\n */\n async setSecondaryAttachmentWithUser(\n user: models.User | undefined,\n documentId: string,\n key: string,\n rev: string,\n attachment: Object,\n utis?: Array<string>,\n dataIsEncrypted?: boolean\n ): Promise<models.Document> {\n return (await this.decrypt([await super.setSecondaryAttachment(documentId, key, rev, attachment, utis, dataIsEncrypted)]))[0].entity\n }\n\n /**\n * Deletes a secondary attachment from a document.\n * @param user the user (not used).\n * @param documentId the id of the document.\n * @param key the key of the secondary attachment.\n * @param rev the revision of the document.\n * @return the updated document.\n */\n async deleteSecondaryAttachmentWithUser(user: models.User | undefined, documentId: string, key: string, rev: string): Promise<models.Document> {\n return (await this.decrypt([await super.deleteSecondaryAttachment(documentId, key, rev)]))[0].entity\n }\n\n createDocument(body?: models.Document): never {\n throw new Error('Use withUser method')\n }\n\n deleteAttachment(documentId: string): never {\n throw new Error('Use withUser method')\n }\n\n findByTypeHCPartyMessageSecretFKeys(documentTypeCode: string, hcPartyId: string, secretFKeys: string[]): never {\n throw new Error('Use withUser method')\n }\n\n findDocumentsByHCPartyPatientForeignKeys(hcPartyId: string, secretFKeys: string[]): never {\n throw new Error('Use withUser method')\n }\n\n findDocumentsByHCPartyPatientForeignKey(hcPartyId: string, secretFKey: string, startKey?: string, startDocumentId?: string, limit?: number): never {\n throw new Error('Use withUser method')\n }\n\n findWithoutDelegation(limit?: number): never {\n throw new Error('Use withUser method')\n }\n\n getDocument(documentId: string): never {\n throw new Error('Use withUser method')\n }\n\n getDocumentByExternalUuid(externalUuid: string): never {\n throw new Error('Use withUser method')\n }\n\n getDocuments(body?: ListOfIds): never {\n throw new Error('Use withUser method')\n }\n\n getDocumentsByExternalUuid(externalUuid: string): never {\n throw new Error('Use withUser method')\n }\n\n modifyDocument(body?: models.Document): never {\n throw new Error('Use withUser method')\n }\n\n modifyDocuments(body?: Array<models.Document>): never {\n throw new Error('Use withUser method')\n }\n\n setMainDocumentAttachment(documentId: string, documentRev: string, body: Object, utis?: Array<string>, dataIsEncrypted?: boolean): never {\n throw new Error('Use withUser method')\n }\n\n setDocumentAttachmentBody(documentId: string, documentRev: string, enckeys?: null, body?: Object, utis?: string[]): never {\n throw new Error('Use withUser method')\n }\n\n setDocumentAttachment(documentId: string, documentRev: string, enckeys?: null, body?: Object, utis?: string[]): never {\n throw new Error('Use withUser method')\n }\n\n setDocumentAttachmentMulti(attachment: ArrayBuffer, documentRev: string, documentId: string, enckeys?: null): never {\n throw new Error('Use withUser method')\n }\n\n setSecondaryAttachment(documentId: string, key: string, rev: string, attachment: Object, utis?: Array<string>, dataIsEncrypted?: boolean): never {\n throw new Error('Use withUser method')\n }\n\n deleteSecondaryAttachment(documentId: string, key: string, rev: string): never {\n throw new Error('Use withUser method')\n }\n\n /**\n * Like {@link getConflictsForEntity} but additionally decrypts the conflicting revisions.\n * @param user the current user (unused for documents, kept for API consistency).\n * @param entityId the id of the document to retrieve the conflicts for.\n * @return the decrypted conflicting revisions of the document.\n */\n getConflictsForEntityWithUser(user: models.User, entityId: string): Promise<Array<models.Document>> {\n return super\n .getConflictsForEntity(entityId)\n .then((ds) => this.decrypt(ds))\n .then((res) => res.map(({ entity }) => entity))\n }\n\n /**\n * Like {@link declareConflictWinner} but encrypts the winning revision before sending it and decrypts the saved\n * winner returned by the backend.\n * @param user the current user (unused for documents, kept for API consistency).\n * @param request the {@link models.ConflictResolutionRequest} carrying the (decrypted) winning revision and the conflicts to purge.\n * @return the {@link models.ConflictResolutionResult} with the decrypted saved winner and the conflicts that are still unresolved.\n */\n async declareConflictWinnerWithUser(\n user: models.User,\n request: models.ConflictResolutionRequest<models.Document>\n ): Promise<models.ConflictResolutionResult<models.Document>> {\n const encrypted = (await this.encrypt([cloneDeep(request.document!)]))[0]\n const result = await super.declareConflictWinner({ ...request, document: encrypted })\n if (result.document) result.document = (await this.decrypt([result.document]))[0].entity\n return result\n }\n\n /**\n * Like {@link getConflictsForEntityWithUser} but targets the entity of the group with the given id.\n * @param user the current user (unused for documents, kept for API consistency).\n * @param groupId the id of the group the document belongs to.\n * @param entityId the id of the document to retrieve the conflicts for.\n * @return the decrypted conflicting revisions of the document.\n */\n getConflictsForEntityInGroupWithUser(user: models.User, groupId: string, entityId: string): Promise<Array<models.Document>> {\n return super\n .getConflictsForEntityInGroup(groupId, entityId)\n .then((ds) => this.decrypt(ds))\n .then((res) => res.map(({ entity }) => entity))\n }\n\n /**\n * Like {@link declareConflictWinnerWithUser} but targets the entity of the group with the given id.\n * @param user the current user (unused for documents, kept for API consistency).\n * @param groupId the id of the group the document belongs to.\n * @param request the {@link models.ConflictResolutionRequest} carrying the (decrypted) winning revision and the conflicts to purge.\n * @return the {@link models.ConflictResolutionResult} with the decrypted saved winner and the conflicts that are still unresolved.\n */\n async declareConflictWinnerInGroupWithUser(\n user: models.User,\n groupId: string,\n request: models.ConflictResolutionRequest<models.Document>\n ): Promise<models.ConflictResolutionResult<models.Document>> {\n const encrypted = (await this.encrypt([cloneDeep(request.document!)]))[0]\n const result = await super.declareConflictWinnerInGroup(groupId, { ...request, document: encrypted })\n if (result.document) result.document = (await this.decrypt([result.document]))[0].entity\n return result\n }\n}\n"]}
1
+ {"version":3,"file":"icc-document-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-document-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAuD;AAGvD,4CAAwC;AACxC,kDAAiD;AAEjD,uDAAqD;AAErD,0EAAgG;AAChG,wEAAoE;AAKpE,mCAAqG;AACrG,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAEzD,kEAA8D;AAE9D,iEAA+F;AAC/F,+DAAoD;AAEpD,qCAAqC;AACrC,MAAa,eAAgB,SAAQ,wBAAc;IAwhBjD,YACE,IAAY,EACZ,OAAkC,EAC1B,MAAqB,EACrB,OAAmB,EAC3B,YAA8B,EACb,cAAuB,EACxC,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,gBAA+B,EAAE,EACjC,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,KAAK;QAET,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAA;QAZ/C,WAAM,GAAN,MAAM,CAAe;QACrB,YAAO,GAAP,OAAO,CAAY;QAEV,mBAAc,GAAd,cAAc,CAAS;QA3hB1C,mGAAmG;QACnG,qBAAgB,GAA8B;YAC5C,kCAAkC,EAAE,WAAW;YAC/C,+BAA+B,EAAE,yBAAyB;YAC1D,yBAAyB,EAAE,gBAAgB;YAC3C,0BAA0B,EAAE,WAAW;YACvC,6BAA6B,EAAE,0BAA0B;YACzD,6BAA6B,EAAE,0BAA0B;YACzD,2BAA2B,EAAE,qBAAqB;YAClD,yBAAyB,EAAE,oBAAoB;YAC/C,yBAAyB,EAAE,+BAA+B;YAC1D,4BAA4B,EAAE,uBAAuB;YACrD,qCAAqC,EAAE,8BAA8B;YACrE,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ourcesContent":["import { IccAuthApi, IccDocumentApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\n\nimport { XHR } from '../icc-api/api/XHR'\nimport * as models from '../icc-api/model/models'\n\nimport { ua2ab, ua2utf8 } from './utils/binary-utils'\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 { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { EncryptedFieldsManifest, EntityWithDelegationTypeName, parseEncryptedFields } from './utils'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\nimport { ListOfIds, PaginatedListDocument, PaginatedListMessage } from '../icc-api/model/models'\nimport { compressData, decompressData, getCompressionVersion } from './utils/compression-utils'\nimport { cloneDeep } from './utils/collection-utils'\n\n// noinspection JSUnusedGlobalSymbols\nexport class IccDocumentXApi extends IccDocumentApi implements EncryptedEntityXApi<models.Document> {\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n\n /** maps invalid UTI values to corresponding MIME type for backward-compatibility (pre-v1.0.117) */\n compatUtiRevDefs: { [key: string]: string } = {\n 'com.adobe.encapsulatedPostscript': 'image/eps',\n 'com.adobe.illustrator.aiImage': 'application/illustrator',\n 'com.adobe.indesignImage': 'image/indesign',\n 'com.adobe.photoshopImage': 'image/psd',\n 'com.adobe.postscriptPfaFont': 'application/x-font-type1',\n 'com.adobe.postscriptPfbFont': 'application/x-font-type1',\n 'com.allume.stuffitArchive': 'application/stuffit',\n 'com.apple.binhexArchive': 'application/binhex',\n 'com.apple.diskImageUdif': 'application/x-apple-diskimage',\n 'com.apple.macbinaryArchive': 'application/macbinary',\n 'com.apple.quartzComposerComposition': 'application/x-quartzcomposer',\n 'com.apple.quicktimeImage': 'image/x-quicktime',\n 'com.apple.quicktimeMovie': 'video/quicktime',\n 'com.js.efxFax': 'image/efax',\n 'com.macromedia.shockwaveFlash': 'application/x-shockwave-flash',\n 'com.microsoft.advancedStreamRedirector': 'video/x-ms-asx',\n 'com.microsoft.advancedSystemsFormat': 'video/x-ms-asf',\n 'com.microsoft.waveformAudio': 'audio/wave',\n 'com.microsoft.windowsDynamicLinkLibrary': 'application/x-msdownload',\n 'com.microsoft.windowsExecutable': 'application/exe',\n 'com.microsoft.windowsMediaWax': 'audio/x-ms-wax',\n 'com.microsoft.windowsMediaWm': 'video/x-ms-wm',\n 'com.microsoft.windowsMediaWma': 'audio/x-ms-wma',\n 'com.microsoft.windowsMediaWmd': 'video/x-ms-wmd',\n 'com.microsoft.windowsMediaWmp': 'video/x-ms-wmp',\n 'com.microsoft.windowsMediaWmv': 'video/x-ms-wmv',\n 'com.microsoft.windowsMediaWmx': 'video/x-ms-wmx',\n 'com.microsoft.windowsMediaWmz': 'video/x-ms-wmz',\n 'com.microsoft.windowsMediaWvx': 'video/x-ms-wvx',\n 'com.netscape.javascriptSource': 'text/javascript',\n 'com.pkware.zipArchive': 'application/zip',\n 'com.rarlab.rarArchive': 'application/rar',\n 'com.redhat.redhatPackage': 'application/x-redhat-package',\n 'com.sgi.sgiImage': 'image/sgi',\n 'com.sun.javaAppDescriptor': 'text/vnd.sun.j2me.app-descriptor',\n 'com.sun.javaArchive': 'application/java-archive',\n 'com.sun.javaClass': 'application/java',\n 'com.sun.javaSource': 'text/x-java-source',\n 'com.sun.javaWebStart': 'application/jnlp',\n 'com.truevision.tgaImage': 'image/tga',\n 'org.bzip.bzip2Archive': 'application/x-bzip2',\n 'org.debian.debianPackage': 'application/x-debian-package',\n 'org.gnu.gnuTarArchive': 'application/x-gtar',\n 'org.gnu.gnuZipArchive': 'application/gzip',\n 'org.oasis.opendocument.textMaster': 'application/vnd.oasis.opendocument.text-master',\n 'org.oasis.opendocument.textWeb': 'application/vnd.oasis.opendocument.text-web',\n 'org.xiph.oggTheora': 'video/ogg',\n 'org.xiph.oggVorbis': 'audio/ogg',\n 'public.aifcAudio': 'audio/aiff',\n 'public.aiffAudio': 'audio/aiff',\n 'public.assemblySource': 'text/x-asm',\n 'public.cHeader': 'text/x-c-header',\n 'public.cpioArchive': 'application/x-cpio',\n 'public.cPlusPlusHeader': 'text/x-c++-hdr',\n 'public.cPlusPlusSource': 'application/x-cplusplus',\n 'public.cshScript': 'application/x-csh',\n 'public.cSource': 'text/x-c-code',\n 'public.isoImage': 'application/x-iso-image',\n 'public.mpeg4Audio': 'audio/mp4',\n 'public.objectiveCPlusPlusSource': 'text/x-objcppsrc',\n 'public.objectiveCSource': 'text/x-objcsrc',\n 'public.opentypeFont': 'font/opentype',\n 'public.perlScript': 'text/x-perl',\n 'public.phpScript': 'text/php',\n 'public.plainText': 'text/plain',\n 'public.pythonScript': 'text/x-python-script',\n 'public.shellScript': 'application/x-sh',\n 'public.tarArchive': 'application/tar',\n 'public.truetypeTtfFont': 'application/x-font-ttf',\n 'public.ulawAudio': 'audio/au',\n 'public.xbitmapImage': 'image/xbm',\n 'unofficial.atomFeed': 'application/atom+xml',\n 'unofficial.m3u8Playlist': 'application/x-mpegURL',\n 'unofficial.plsPlaylist': 'audio/scpls',\n 'unofficial.rdfFeed': 'application/rdf+xml',\n 'unofficial.rssFeed': 'application/rss+xml',\n }\n\n utiRevDefs: { [key: string]: string } = {\n ...this.compatUtiRevDefs,\n 'com.adobe.encapsulated-postscript': 'image/eps',\n 'com.adobe.illustrator.ai-image': 'application/illustrator',\n 'com.adobe.indesign-image': 'image/indesign',\n 'com.adobe.pdf': 'application/pdf',\n 'com.adobe.photoshop-image': 'image/psd',\n 'com.adobe.postscript': 'application/postscript',\n 'com.adobe.postscript-pfa-font': 'application/x-font-type1',\n 'com.adobe.postscript-pfb-font': 'application/x-font-type1',\n 'com.allume.stuffit-archive': 'application/stuffit',\n 'com.apple.applescript.script': 'application/x-applescript',\n 'com.apple.applescript.text': 'application/x-applescript',\n 'com.apple.binhex-archive': 'application/binhex',\n 'com.apple.disk-image-udif': 'application/x-apple-diskimage',\n 'com.apple.ical.ics': 'text/calendar',\n 'com.apple.ical.vcs': 'text/x-vcalendar',\n 'com.apple.macbinary-archive': 'application/macbinary',\n 'com.apple.pict': 'image/pict',\n 'com.apple.quartz-composer-composition': 'application/x-quartzcomposer',\n 'com.apple.quicktime-image': 'image/x-quicktime',\n 'com.apple.quicktime-movie': 'video/quicktime',\n 'com.bittorrent.torrent': 'application/x-bittorrent',\n 'com.compuserve.gif': 'image/gif',\n 'com.js.efx-fax': 'image/efax',\n 'com.kodak.flashpix.image': 'image/vndfpx',\n 'com.lizardtech.djvu': 'image/vnd.djvu',\n 'com.macromedia.shockwave-flash': 'application/x-shockwave-flash',\n 'com.microsoft.advanced-stream-redirector': 'video/x-ms-asx',\n 'com.microsoft.advanced-systems-format': 'video/x-ms-asf',\n 'com.microsoft.bmp': 'image/bmp',\n 'com.microsoft.excel.xls': 'application/excel',\n 'com.microsoft.ico': 'image/x-icon',\n 'com.microsoft.powerpoint.ppt': 'application/powerpoint',\n 'com.microsoft.waveform-audio': 'audio/wave',\n 'com.microsoft.windows-dynamic-link-library': 'application/x-msdownload',\n 'com.microsoft.windows-executable': 'application/exe',\n 'com.microsoft.windows-media-wax': 'audio/x-ms-wax',\n 'com.microsoft.windows-media-wm': 'video/x-ms-wm',\n 'com.microsoft.windows-media-wma': 'audio/x-ms-wma',\n 'com.microsoft.windows-media-wmd': 'video/x-ms-wmd',\n 'com.microsoft.windows-media-wmp': 'video/x-ms-wmp',\n 'com.microsoft.windows-media-wmv': 'video/x-ms-wmv',\n 'com.microsoft.windows-media-wmx': 'video/x-ms-wmx',\n 'com.microsoft.windows-media-wmz': 'video/x-ms-wmz',\n 'com.microsoft.windows-media-wvx': 'video/x-ms-wvx',\n 'com.microsoft.word.doc': 'application/msword',\n 'com.netscape.javascript-source': 'text/javascript',\n 'com.pkware.zip-archive': 'application/zip',\n 'com.rarlab.rar-archive': 'application/rar',\n 'com.real.realaudio': 'audio/vnd.rn-realaudio',\n 'com.real.realmedia': 'application/vnd.rn-realmedia',\n 'com.real.smil': 'application/smil',\n 'com.redhat.redhat-package': 'application/x-redhat-package',\n 'com.sgi.sgi-image': 'image/sgi',\n 'com.soundblaster.soundfont': 'application/x-soundfont',\n 'com.sun.java-app-descriptor': 'text/vnd.sun.j2me.app-descriptor',\n 'com.sun.java-archive': 'application/java-archive',\n 'com.sun.java-class': 'application/java',\n 'com.sun.java-source': 'text/x-java-source',\n 'com.sun.java-web-start': 'application/jnlp',\n 'com.truevision.tga-image': 'image/tga',\n 'org.bzip.bzip2-archive': 'application/x-bzip2',\n 'org.debian.debian-package': 'application/x-debian-package',\n 'org.gnu.gnu-tar-archive': 'application/x-gtar',\n 'org.gnu.gnu-zip-archive': 'application/gzip',\n 'org.neooffice.calc': 'application/vnd.sun.xml.calc',\n 'org.neooffice.draw': 'application/vnd.sun.xml.draw',\n 'org.neooffice.global': 'application/vnd.sun.xml.writer.global',\n 'org.neooffice.impress': 'application/vnd.sun.xml.impress',\n 'org.neooffice.math': 'application/vnd.sun.xml.math',\n 'org.neooffice.writer': 'application/vnd.sun.xml.writer',\n 'org.oasis.opendocument.chart': 'application/vnd.oasis.opendocument.chart',\n 'org.oasis.opendocument.database': 'application/vnd.oasis.opendocument.database',\n 'org.oasis.opendocument.formula': 'application/vnd.oasis.opendocument.formula',\n 'org.oasis.opendocument.graphics': 'application/vnd.oasis.opendocument.graphics',\n 'org.oasis.opendocument.image': 'application/vnd.oasis.opendocument.image',\n 'org.oasis.opendocument.presentation': 'application/vnd.oasis.opendocument.presentation',\n 'org.oasis.opendocument.spreadsheet': 'application/vnd.oasis.opendocument.spreadsheet',\n 'org.oasis.opendocument.text': 'application/vnd.oasis.opendocument.text',\n 'org.oasis.opendocument.text-master': 'application/vnd.oasis.opendocument.text-master',\n 'org.oasis.opendocument.text-web': 'application/vnd.oasis.opendocument.text-web',\n 'org.tug.tex': 'text/tex',\n 'org.xiph.flac': 'audio/flac',\n 'org.xiph.ogg-theora': 'video/ogg',\n 'org.xiph.ogg-vorbis': 'audio/ogg',\n 'public.3gpp': 'video/3gpp',\n 'public.3gpp2': 'video/3gpp2',\n 'public.aifc-audio': 'audio/aiff',\n 'public.aiff-audio': 'audio/aiff',\n 'public.assembly-source': 'text/x-asm',\n 'public.avi': 'video/avi',\n 'public.c-header': 'text/x-c-header',\n 'public.cpio-archive': 'application/x-cpio',\n 'public.c-plus-plus-header': 'text/x-c++-hdr',\n 'public.c-plus-plus-source': 'application/x-cplusplus',\n 'public.csh-script': 'application/x-csh',\n 'public.c-source': 'text/x-c-code',\n 'public.css': 'text/css',\n 'public.dv': 'video/x-dv',\n 'public.flv': 'video/x-flv',\n 'public.html': 'text/html',\n 'public.iso-image': 'application/x-iso-image',\n 'public.jpeg': 'image/jpeg',\n 'public.jpeg2000': 'image/jp2',\n 'public.midi': 'audio/midi',\n 'public.mka': 'audio/x-matroska',\n 'public.mkv': 'video/x-matroska',\n 'public.mp3': 'audio/mp3',\n 'public.mpeg': 'video/mpeg',\n 'public.mpeg4': 'video/mp4',\n 'public.mpeg4-audio': 'audio/mp4',\n 'public.mpegts': 'video/MP2T',\n 'public.objective-c-plus-plus-source': 'text/x-objcppsrc',\n 'public.objective-c-source': 'text/x-objcsrc',\n 'public.opentype-font': 'font/opentype',\n 'public.perl-script': 'text/x-perl',\n 'public.php-script': 'text/php',\n 'public.plain-text': 'text/plain',\n 'public.png': 'image/png',\n 'public.python-script': 'text/x-python-script',\n 'public.rtf': 'text/rtf',\n 'public.shell-script': 'application/x-sh',\n 'public.tar-archive': 'application/tar',\n 'public.tiff': 'image/tiff',\n 'public.truetype-ttf-font': 'application/x-font-ttf',\n 'public.ulaw-audio': 'audio/au',\n 'public.vcard': 'text/vcard',\n 'public.webm': 'video/webm',\n 'public.xbitmap-image': 'image/xbm',\n 'public.xml': 'text/xml',\n 'unofficial.atom-feed': 'application/atom+xml',\n 'unofficial.m3u8-playlist': 'application/x-mpegURL',\n 'unofficial.opml': 'text/x-opml',\n 'unofficial.pls-playlist': 'audio/scpls',\n 'unofficial.rdf-feed': 'application/rdf+xml',\n 'unofficial.rss-feed': 'application/rss+xml',\n }\n\n utiExts: { [key: string]: string } = {\n jpg: 'public.jpeg',\n jpeg: 'public.jpeg',\n png: 'public.png',\n rtf: 'public.rtf',\n mpeg: 'public.mpeg',\n mpg: 'public.mpeg',\n html: 'public.html',\n htm: 'public.html',\n pdf: 'com.adobe.pdf',\n xls: 'com.microsoft.excel.xls',\n xlsx: 'com.microsoft.excel.xls',\n doc: 'com.microsoft.word.doc',\n docx: 'com.microsoft.word.doc',\n }\n\n utiDefs: { [key: string]: string } = {\n 'application/atom+xml': 'unofficial.atom-feed',\n 'application/bat': 'com.microsoft.windows-executable',\n 'application/binhex': 'com.apple.binhex-archive',\n 'application/binhex4': 'com.apple.binhex-archive',\n 'application/ecmascript': 'com.netscape.javascript-source',\n 'application/eps': 'com.adobe.encapsulated-postscript',\n 'application/excel': 'com.microsoft.excel.xls',\n 'application/exe': 'com.microsoft.windows-executable',\n 'application/gnutar': 'public.tar-archive',\n 'application/gzip': 'org.gnu.gnu-zip-archive',\n 'application/illustrator': 'com.adobe.illustrator.ai-image',\n 'application/indesign': 'com.adobe.indesign-image',\n 'application/java-archive': 'com.sun.java-archive',\n 'application/java-byte-code': 'com.sun.java-class',\n 'application/java': 'com.sun.java-class',\n 'application/javascript': 'com.netscape.javascript-source',\n 'application/jnlp': 'com.sun.java-web-start',\n 'application/latex': 'org.tug.tex',\n 'application/mac-binary': 'com.apple.macbinary-archive',\n 'application/mac-binhex': 'com.apple.binhex-archive',\n 'application/mac-binhex40': 'com.apple.binhex-archive',\n 'application/macbinary': 'com.apple.macbinary-archive',\n 'application/mspowerpoint': 'com.microsoft.powerpoint.ppt',\n 'application/msword': 'com.microsoft.word.doc',\n 'application/octet-stream': 'com.microsoft.windows-executable',\n 'application/pdf': 'com.adobe.pdf',\n 'application/photoshop': 'com.adobe.photoshop-image',\n 'application/php': 'public.php-script',\n 'application/plain': 'public.plain-text',\n 'application/postscript': 'com.adobe.postscript',\n 'application/powerpoint': 'com.microsoft.powerpoint.ppt',\n 'application/rar': 'com.rarlab.rar-archive',\n 'application/rdf+xml': 'unofficial.rdf-feed',\n 'application/rss+xml': 'unofficial.rss-feed',\n 'application/rtf': 'public.rtf',\n 'application/smil': 'com.real.smil',\n 'application/stuffit': 'com.allume.stuffit-archive',\n 'application/tar': 'public.tar-archive',\n 'application/tga': 'com.truevision.tga-image',\n 'application/vnd.fpx': 'com.kodak.flashpix.image',\n 'application/vnd.ms-excel': 'com.microsoft.excel.xls',\n 'application/vnd.ms-powerpoint': 'com.microsoft.powerpoint.ppt',\n 'application/vnd.oasis.opendocument.chart': 'org.oasis.opendocument.chart',\n 'application/vnd.oasis.opendocument.database': 'org.oasis.opendocument.database',\n 'application/vnd.oasis.opendocument.formula': 'org.oasis.opendocument.formula',\n 'application/vnd.oasis.opendocument.graphics-template': 'org.oasis.opendocument.graphics',\n 'application/vnd.oasis.opendocument.graphics': 'org.oasis.opendocument.graphics',\n 'application/vnd.oasis.opendocument.image': 'org.oasis.opendocument.image',\n 'application/vnd.oasis.opendocument.presentation-template': 'org.oasis.opendocument.presentation',\n 'application/vnd.oasis.opendocument.presentation': 'org.oasis.opendocument.presentation',\n 'application/vnd.oasis.opendocument.spreadsheet-template': 'org.oasis.opendocument.spreadsheet',\n 'application/vnd.oasis.opendocument.spreadsheet': 'org.oasis.opendocument.spreadsheet',\n 'application/vnd.oasis.opendocument.text-master': 'org.oasis.opendocument.text-master',\n 'application/vnd.oasis.opendocument.text-template': 'org.oasis.opendocument.text',\n 'application/vnd.oasis.opendocument.text-web': 'org.oasis.opendocument.text-web',\n 'application/vnd.oasis.opendocument.text': 'org.oasis.opendocument.text',\n 'application/vnd.rn-realmedia': 'com.real.realmedia',\n 'application/vnd.sun.xml.calc.template': 'org.neooffice.calc',\n 'application/vnd.sun.xml.calc': 'org.neooffice.calc',\n 'application/vnd.sun.xml.draw.template': 'org.neooffice.draw',\n 'application/vnd.sun.xml.draw': 'org.neooffice.draw',\n 'application/vnd.sun.xml.impress.template': 'org.neooffice.impress',\n 'application/vnd.sun.xml.impress': 'org.neooffice.impress',\n 'application/vnd.sun.xml.math': 'org.neooffice.math',\n 'application/vnd.sun.xml.writer.global': 'org.neooffice.global',\n 'application/vnd.sun.xml.writer.template': 'org.neooffice.writer',\n 'application/vnd.sun.xml.writer': 'org.neooffice.writer',\n 'application/vndms-excel': 'com.microsoft.excel.xls',\n 'application/vndms-powerpoint': 'com.microsoft.powerpoint.ppt',\n 'application/vndrn-realmedia': 'com.real.realmedia',\n 'application/x-apple-diskimage': 'com.apple.disk-image-udif',\n 'application/x-applescript': 'com.apple.applescript.script',\n 'application/x-bat': 'com.microsoft.windows-executable',\n 'application/x-binary': 'com.apple.macbinary-archive',\n 'application/x-binhex40': 'com.apple.binhex-archive',\n 'application/x-bittorrent': 'com.bittorrent.torrent',\n 'application/x-bzip2': 'org.bzip.bzip2-archive',\n 'application/x-cpio': 'public.cpio-archive',\n 'application/x-cplusplus': 'public.c-plus-plus-source',\n 'application/x-csh': 'public.csh-script',\n 'application/x-deb': 'org.debian.debian-package',\n 'application/x-debian-package': 'org.debian.debian-package',\n 'application/x-eps': 'com.adobe.encapsulated-postscript',\n 'application/x-excel': 'com.microsoft.excel.xls',\n 'application/x-exe': 'com.microsoft.windows-executable',\n 'application/x-flac': 'org.xiph.flac',\n 'application/x-font-ttf': 'public.truetype-ttf-font',\n 'application/x-font-type1': 'com.adobe.postscript-pfa-font',\n 'application/x-gtar': 'org.gnu.gnu-tar-archive',\n 'application/x-gzip': 'org.gnu.gnu-zip-archive',\n 'application/x-iso-image': 'public.iso-image',\n 'application/x-java-class': 'com.sun.java-class',\n 'application/x-java': 'com.sun.java-web-start',\n 'application/x-javascript': 'com.netscape.javascript-source',\n 'application/x-latex': 'org.tug.tex',\n 'application/x-mac-binhex40': 'com.apple.binhex-archive',\n 'application/x-macbinary': 'com.apple.macbinary-archive',\n 'application/x-midi': 'public.midi',\n 'application/x-mpegURL': 'unofficial.m3u8-playlist',\n 'application/x-ms-wmd': 'com.microsoft.windows-media-wmd',\n 'application/x-ms-wmz': 'com.microsoft.windows-media-wmz',\n 'application/x-msdos-program': 'com.microsoft.windows-executable',\n 'application/x-msdownload': 'com.microsoft.windows-executable',\n 'application/x-msexcel': 'com.microsoft.excel.xls',\n 'application/x-mspowerpoint': 'com.microsoft.powerpoint.ppt',\n 'application/x-pdf': 'com.adobe.pdf',\n 'application/x-perl': 'public.perl-script',\n 'application/x-php': 'public.php-script',\n 'application/x-quartzcomposer': 'com.apple.quartz-composer-composition',\n 'application/x-rar-compressed': 'com.rarlab.rar-archive',\n 'application/x-redhat-package': 'com.redhat.redhat-package',\n 'application/x-rpm': 'com.redhat.redhat-package',\n 'application/x-rtf': 'public.rtf',\n 'application/x-sh': 'public.shell-script',\n 'application/x-shellscript': 'public.shell-script',\n 'application/x-shockwave-flash': 'com.macromedia.shockwave-flash',\n 'application/x-sit': 'com.allume.stuffit-archive',\n 'application/x-smil': 'com.real.smil',\n 'application/x-soundfont': 'com.soundblaster.soundfont',\n 'application/x-stuffit': 'com.allume.stuffit-archive',\n 'application/x-tar': 'public.tar-archive',\n 'application/x-tex': 'org.tug.tex',\n 'application/x-texinfo': 'org.tug.tex',\n 'application/x-troff-msvideo': 'public.avi',\n 'application/x-zip-compressed': 'com.pkware.zip-archive',\n 'application/xhtml+xml': 'public.html',\n 'application/xml': 'public.xml',\n 'application/zip': 'com.pkware.zip-archive',\n 'audio/3gpp': 'public.3gpp',\n 'audio/3gpp2': 'public.3gpp2',\n 'audio/aiff': 'public.aiff-audio',\n 'audio/au': 'public.ulaw-audio',\n 'audio/basic': 'public.ulaw-audio',\n 'audio/flac': 'org.xiph.flac',\n 'audio/mid': 'public.midi',\n 'audio/midi': 'public.midi',\n 'audio/mp3': 'public.mp3',\n 'audio/mp4': 'public.mpeg4-audio',\n 'audio/mp4a-latm': 'public.mpeg4-audio',\n 'audio/mpeg': 'public.mp3',\n 'audio/mpeg3': 'public.mp3',\n 'audio/mpegurl': 'unofficial.m3u-playlist',\n 'audio/mpg': 'public.mp3',\n 'audio/ogg': 'org.xiph.ogg-vorbis',\n 'audio/scpls': 'unofficial.pls-playlist',\n 'audio/snd': 'public.ulaw-audio',\n 'audio/vnd.rn-realaudio': 'com.real.realaudio',\n 'audio/wav': 'com.microsoft.waveform-audio',\n 'audio/wave': 'com.microsoft.waveform-audio',\n 'audio/webm': 'public.webm',\n 'audio/x-adpcm': 'public.ulaw-audio',\n 'audio/x-aiff': 'public.aiff-audio',\n 'audio/x-au': 'public.ulaw-audio',\n 'audio/x-flac': 'org.xiph.flac',\n 'audio/x-matroska': 'public.mka',\n 'audio/x-mid': 'public.midi',\n 'audio/x-midi': 'public.midi',\n 'audio/x-mp3': 'public.mp3',\n 'audio/x-mpeg-3': 'public.mp3',\n 'audio/x-mpeg': 'public.mp3',\n 'audio/x-mpeg3': 'public.mp3',\n 'audio/x-mpegurl': 'unofficial.m3u-playlist',\n 'audio/x-mpg': 'public.mp3',\n 'audio/x-ms-wax': 'com.microsoft.windows-media-wax',\n 'audio/x-ms-wma': 'com.microsoft.windows-media-wma',\n 'audio/x-ogg': 'org.xiph.ogg-vorbis',\n 'audio/x-pn-realaudio-plugin': 'com.real.realaudio',\n 'audio/x-pn-realaudio': 'com.real.realaudio',\n 'audio/x-pn-wav': 'com.microsoft.waveform-audio',\n 'audio/x-realaudio': 'com.real.realmedia',\n 'audio/x-scpls': 'unofficial.pls-playlist',\n 'audio/x-wav': 'com.microsoft.waveform-audio',\n 'font/opentype': 'public.opentype-font',\n 'image/bmp': 'com.microsoft.bmp',\n 'image/efax': 'com.js.efx-fax',\n 'image/eps': 'com.adobe.encapsulated-postscript',\n 'image/fpx': 'com.kodak.flashpix.image',\n 'image/gif': 'com.compuserve.gif',\n 'image/indd': 'com.adobe.indesign-image',\n 'image/indesign': 'com.adobe.indesign-image',\n 'image/jp2': 'public.jpeg2000',\n 'image/jpeg': 'public.jpeg',\n 'image/ms-bmp': 'com.microsoft.bmp',\n 'image/photoshop': 'com.adobe.photoshop-image',\n 'image/pict': 'com.apple.pict',\n 'image/pipeg': 'public.jpeg',\n 'image/pjpeg': 'public.jpeg',\n 'image/png': 'public.png',\n 'image/psd': 'com.adobe.photoshop-image',\n 'image/sgi': 'com.sgi.sgi-image',\n 'image/targa': 'com.truevision.tga-image',\n 'image/tga': 'com.truevision.tga-image',\n 'image/tiff': 'public.tiff',\n 'image/vnd.djvu': 'com.lizardtech.djvu',\n 'image/vndfpx': 'com.kodak.flashpix.image',\n 'image/vndnet-fpx': 'com.kodak.flashpix.image',\n 'image/webp': 'public.webp',\n 'image/x-bitmap': 'com.microsoft.bmp',\n 'image/x-bmp': 'com.microsoft.bmp',\n 'image/x-djvu': 'com.lizardtech.djvu',\n 'image/x-eps': 'com.adobe.encapsulated-postscript',\n 'image/x-icon': 'com.microsoft.ico',\n 'image/x-indesign': 'com.adobe.indesign-image',\n 'image/x-macpict': 'com.apple.pict',\n 'image/x-ms-bmp': 'com.microsoft.bmp',\n 'image/x-photoshop': 'com.adobe.photoshop-image',\n 'image/x-pict': 'com.apple.pict',\n 'image/x-quicktime': 'com.apple.quicktime-image',\n 'image/x-tiff': 'public.tiff',\n 'image/x-windows-bmp': 'com.microsoft.bmp',\n 'image/x-xbitmap': 'com.microsoft.bmp',\n 'image/x-xbm': 'public.xbitmap-image',\n 'image/xbm': 'public.xbitmap-image',\n 'multipart/x-gzip': 'org.gnu.gnu-zip-archive',\n 'multipart/x-zip': 'com.pkware.zip-archive',\n 'music/crescendo': 'public.midi',\n 'text/calendar': 'com.apple.ical.ics',\n 'text/css': 'public.css',\n 'text/directory': 'public.vcard',\n 'text/ecmascript': 'com.netscape.javascript-source',\n 'text/html': 'public.html',\n 'text/javascript': 'com.netscape.javascript-source',\n 'text/php': 'public.php-script',\n 'text/plain': 'public.plain-text',\n 'text/richtext': 'public.rtf',\n 'text/rtf': 'public.rtf',\n 'text/ruby-script': 'public.ruby-script',\n 'text/tex': 'org.tug.tex',\n 'text/vcard': 'public.vcard',\n 'text/vnd.sun.j2me.app-descriptor': 'com.sun.java-app-descriptor',\n 'text/x-asm': 'public.assembly-source',\n 'text/x-c-code': 'public.c-source',\n 'text/x-c-header': 'public.c-header',\n 'text/x-c': 'public.c-source',\n 'text/x-c++-code': 'public.c-plus-plus-source',\n 'text/x-c++-hdr': 'public.c-plus-plus-header',\n 'text/x-c++-src': 'public.c-plus-plus-source',\n 'text/x-c++src': 'public.c-plus-plus-source',\n 'text/x-h': 'public.c-header',\n 'text/x-java-source': 'com.sun.java-source',\n 'text/x-latex': 'org.tug.tex',\n 'text/x-objcppsrc': 'public.objective-c-plus-plus-source',\n 'text/x-objcsrc': 'public.objective-c-source',\n 'text/x-opml': 'unofficial.opml',\n 'text/x-perl-script': 'public.perl-script',\n 'text/x-perl': 'public.perl-script',\n 'text/x-php-script': 'public.php-script',\n 'text/x-python-script': 'public.python-script',\n 'text/x-python': 'public.python-script',\n 'text/x-scriptcsh': 'public.csh-script',\n 'text/x-scriptperl-module': 'public.perl-script',\n 'text/x-scriptperl': 'public.perl-script',\n 'text/x-scriptphyton': 'public.python-script',\n 'text/x-scriptsh': 'public.shell-script',\n 'text/x-server-parsed-html': 'public.html',\n 'text/x-tex': 'org.tug.tex',\n 'text/x-vcalendar': 'com.apple.ical.vcs',\n 'text/x-vcard': 'public.vcard',\n 'text/xhtml': 'public.html',\n 'text/xml': 'public.xml',\n 'video/3gpp': 'public.3gpp',\n 'video/3gpp2': 'public.3gpp2',\n 'video/avi': 'public.avi',\n 'video/MP2T': 'public.mpegts',\n 'video/mp4': 'public.mpeg4',\n 'video/mp4v': 'public.mpeg4',\n 'video/mpeg': 'public.mpeg',\n 'video/mpg': 'public.mpeg',\n 'video/msvideo': 'public.avi',\n 'video/ogg': 'org.xiph.ogg-theora',\n 'video/quicktime': 'com.apple.quicktime-movie',\n 'video/webm': 'public.webm',\n 'video/x-dv': 'public.dv',\n 'video/x-flv': 'public.flv',\n 'video/x-m4v': 'public.mpeg4',\n 'video/x-matroska': 'public.mkv',\n 'video/x-mpeg': 'public.mpeg',\n 'video/x-mpg': 'public.mpeg',\n 'video/x-ms-asf-plugin': 'com.microsoft.advanced-systems-format',\n 'video/x-ms-asf': 'com.microsoft.advanced-systems-format',\n 'video/x-ms-asx': 'com.microsoft.advanced-stream-redirector',\n 'video/x-ms-wm': 'com.microsoft.windows-media-wm',\n 'video/x-ms-wmd': 'com.microsoft.windows-media-wmd',\n 'video/x-ms-wmp': 'com.microsoft.windows-media-wmp',\n 'video/x-ms-wmv': 'com.microsoft.windows-media-wmv',\n 'video/x-ms-wmx': 'com.microsoft.windows-media-wmx',\n 'video/x-ms-wmz': 'com.microsoft.windows-media-wmz',\n 'video/x-ms-wvx': 'com.microsoft.windows-media-wvx',\n 'video/x-msvideo': 'public.avi',\n 'video/x-ogg': 'org.xiph.ogg-theora',\n 'x-msdos-program': 'com.microsoft.windows-executable',\n 'x-music/x-midi': 'public.midi',\n }\n dataOwnerApi: IccDataOwnerXApi\n authenticationProvider: AuthenticationProvider\n private readonly encryptedFields: EncryptedFieldsManifest\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n private crypto: IccCryptoXApi,\n private authApi: IccAuthApi,\n dataOwnerApi: IccDataOwnerXApi,\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.fetchImpl = fetchImpl\n this.authenticationProvider = authenticationProvider\n this.dataOwnerApi = dataOwnerApi\n this.encryptedFields = parseEncryptedFields(encryptedKeys, 'Document.')\n }\n\n override get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.Document))\n }\n\n /**\n * Creates a new instance of document with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param message the message this document refers to.\n * @param c initialised data for the document. 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 * - sfkOption: specifies which sfk of the owning entity to use.\n * - ignoreAutoDelegations: if true the data won't be shared with the autodelegations of the user, but only with additional delegates\n * - alternateRootDelegation: by default a new entity is created with a root delegation from self to self. In keyless mode this is not possible,\n * and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.\n * @return a new instance of document.\n */\n async newInstance(\n user: models.User,\n message?: models.Message,\n c: any = {},\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n ignoreAutoDelegations?: boolean\n alternateRootDelegation?: string\n } = {}\n ) {\n const document = {\n ...(c ?? {}),\n _type: 'org.taktik.icure.entities.Document',\n id: c?.id ?? this.crypto.primitives.randomUuid(),\n created: c?.created ?? new Date().getTime(),\n modified: c?.modified ?? new Date().getTime(),\n responsible: c?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: c?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: c?.codes ?? [],\n tags: c?.tags ?? [],\n }\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 = message\n ? await this.crypto.xapi.resolveSecretIdUseOptions(\n { entity: message, type: EntityWithDelegationTypeName.Message },\n options.sfkOption ?? SecretIdUseOption.UseAnySharedWithParent\n )\n : []\n const extraDelegations = {\n ...(options.ignoreAutoDelegations == true\n ? {}\n : Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.medicalInformation ?? [])].map((d) => [d, AccessLevelEnum.WRITE])\n )),\n ...(options?.additionalDelegates ?? {}),\n }\n return new models.Document(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(\n document,\n EntityWithDelegationTypeName.Document,\n message?.id,\n sfk,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n .then((x) => x.updatedEntity)\n )\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * Same as {@link findByMessage} but it will only return the ids of the documents. It can also filter the documents where Document.created is between\n * startDate and endDate in ascending or descending order by that field. (default: ascending).\n */\n async findIdsByMessage(hcpartyId: string, message: models.Message, startDate?: number, endDate?: number, descending?: boolean): Promise<string[]> {\n const extractedKeys = await this.crypto.xapi.secretIdsOf({ entity: message, type: EntityWithDelegationTypeName.Message }, hcpartyId)\n const topmostParentId = (await this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0]\n return this.findDocumentIdsByDataOwnerSecretForeignKey(topmostParentId, [...new Set(extractedKeys)], startDate, endDate, descending)\n }\n\n /**\n * Decrypts an array of documents.\n * @param documents the documents to decrypt.\n * @return an array of objects containing the document and a flag indicating if it was successfully decrypted.\n */\n async decrypt(documents: Array<models.Document>): Promise<{ entity: models.Document; decrypted: boolean }[]> {\n return await this.crypto.xapi.tryDecryptEntities(documents, EntityWithDelegationTypeName.Document, (x) => new models.Document(x))\n }\n\n /**\n * Encrypts an array of documents.\n * @param documents the documents to encrypt.\n * @return the encrypted documents.\n */\n encrypt(documents: Array<models.Document>): Promise<Array<models.Document>> {\n return this.crypto.xapi.tryEncryptEntities(\n documents,\n EntityWithDelegationTypeName.Document,\n this.encryptedFields,\n true,\n false,\n (x) => new models.Document(x)\n )\n }\n\n //prettier-ignore\n getAttachmentAs(documentId: string, attachmentId: string, returnType: \"application/octet-stream\", enckeys?: string, fileName?: string): Promise<ArrayBuffer>\n //prettier-ignore\n getAttachmentAs(documentId: string, attachmentId: string, returnType: \"text/plain\", enckeys?: string, fileName?: string): Promise<string>\n //prettier-ignore\n getAttachmentAs(documentId: string, attachmentId: string, returnType: \"application/json\", enckeys?: string, fileName?: string): Promise<any>\n /**\n * @deprecated use getMainAttachmentAs instead\n */\n async getAttachmentAs(\n documentId: string,\n attachmentId: string,\n returnType: 'application/octet-stream' | 'text/plain' | 'application/json',\n enckeys?: string,\n fileName?: string\n ): Promise<any> {\n if (!!enckeys || !!fileName) {\n console.warn('Using getAttachmentAs method with a value for enckeys or fileName does nothing anymore.')\n }\n return this.getMainAttachmentAs(documentId, returnType)\n }\n\n //prettier-ignore\n getMainAttachmentAs(documentId: string, returnType: \"application/octet-stream\"): Promise<ArrayBuffer>\n //prettier-ignore\n getMainAttachmentAs(documentId: string, returnType: \"text/plain\"): Promise<string>\n //prettier-ignore\n getMainAttachmentAs(documentId: string, returnType: \"application/json\", tryHardToParseJson?: boolean): Promise<any>\n //prettier-ignore\n getMainAttachmentAs(documentId: string, returnType: 'application/octet-stream' | 'text/plain' | 'application/json', tryHardToParseJson?: boolean): Promise<any>\n /**\n * Gets the main attachment of a document without decrypting it.\n * @param documentId the id of the document.\n * @param returnType the desired return type for the attachment data.\n * @param tryHardToParseJson if true, will attempt to parse JSON even if the content type is not application/json.\n * @return the attachment data in the requested format.\n */\n async getMainAttachmentAs(\n documentId: string,\n returnType: 'application/octet-stream' | 'text/plain' | 'application/json',\n tryHardToParseJson: boolean = false\n ): Promise<any> {\n const url = this.host + `/document/${documentId}/attachment` + '?ts=' + new Date().getTime()\n return XHR.sendCommand(\n 'GET',\n url,\n await this.headers,\n null,\n this.fetchImpl,\n returnType,\n this.authenticationProvider.getAuthService(),\n undefined,\n returnType == 'application/json' && tryHardToParseJson\n )\n .then((doc) => doc.body)\n .catch((err) => this.handleError(err))\n }\n\n //prettier-ignore\n getAndTryDecryptMainAttachmentAs(document: models.Document, returnType: \"application/octet-stream\"): Promise<ArrayBuffer | undefined>\n //prettier-ignore\n getAndTryDecryptMainAttachmentAs(document: models.Document, returnType: \"text/plain\"): Promise<string | undefined>\n //prettier-ignore\n getAndTryDecryptMainAttachmentAs(document: models.Document, returnType: \"application/json\"): Promise<any | undefined>\n //prettier-ignore\n getAndTryDecryptMainAttachmentAs(document: models.Document, returnType: 'application/octet-stream' | 'text/plain' | 'application/json'): Promise<any | undefined>\n /**\n * Gets and decrypts the main attachment of a document, parsing it to the requested format.\n * @param document the document containing the attachment.\n * @param returnType the desired return type for the attachment data.\n * @return the decrypted and parsed attachment data, or undefined if decryption failed or parsing was unsuccessful.\n */\n async getAndTryDecryptMainAttachmentAs(\n document: models.Document,\n returnType: 'application/octet-stream' | 'text/plain' | 'application/json'\n ): Promise<any | undefined> {\n const key = (await this.crypto.xapi.encryptionKeysOf({ entity: document, type: EntityWithDelegationTypeName.Document }, undefined))[0]\n if (!key) return undefined\n const tryParse = this.parserFor(returnType)\n const attachmentInfo = await this.getAndTryDecryptDocumentAttachment(document, (decrypted) => Promise.resolve(tryParse(decrypted) !== undefined))\n if (attachmentInfo.wasDecrypted) {\n return tryParse(attachmentInfo.data)\n } else return undefined\n }\n private parserFor(returnType: 'application/octet-stream' | 'text/plain' | 'application/json'): (data: ArrayBuffer) => any | undefined {\n if (returnType === 'application/octet-stream') {\n return (data) => data\n } else if (returnType === 'text/plain') {\n return (data) => {\n try {\n return ua2utf8(data)\n } catch (e) {\n return undefined\n }\n }\n } else if (returnType === 'application/json') {\n return (data) => {\n try {\n return JSON.parse(ua2utf8(data))\n } catch (e) {\n return undefined\n }\n }\n } else throw new Error(`Unsupported type ${returnType}`)\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * Converts a MIME type and file extension to a UTI (Uniform Type Identifier).\n * @param mimeType the MIME type.\n * @param extension the file extension.\n * @return the corresponding UTI.\n */\n uti(mimeType: string, extension: string) {\n return (mimeType && mimeType !== 'application/octet-stream' ? this.utiDefs[mimeType] : this.utiExts[extension]) || this.utiDefs[mimeType]\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * Converts a UTI (Uniform Type Identifier) to a MIME type.\n * @param uti the UTI.\n * @return the corresponding MIME type.\n */\n mimeType(uti: string) {\n return this.utiRevDefs[uti]\n }\n\n /**\n * Adds an attachment to a document, encrypting it on client side using the encryption keys of the provided document.\n * @param document a document.\n * @param attachment a new main attachment for the document.\n * @param utis an array of UTIs for the attachment. The first element will be considered as the main UTI for the document. If provided and non-empty\n * overrides existing values.\n * @param deflate if true, compress the attachment before uploading. Reliable decompression of compressed data requires version 26.5 of the API and all users to be using at least version 8.7.0 of the SDK * @return the updated document.\n */\n async encryptAndSetDocumentAttachment(\n document: models.Document,\n attachment: ArrayBuffer | Uint8Array,\n utis?: string[],\n deflate: boolean = false\n ): Promise<models.Document> {\n if (!document.rev) throw new Error('Cannot set attachment on document without rev')\n const raw = ua2ab(attachment)\n const realDataSize = raw.byteLength\n const { data: dataToEncrypt, algorithm: compressionAlgorithm } = deflate\n ? await compressData(attachment, utis)\n : { data: raw, algorithm: undefined }\n\n const { encryptedData, updatedEntity } = await this.crypto.xapi.encryptDataOf(\n document,\n EntityWithDelegationTypeName.Document,\n dataToEncrypt,\n (d) => this.modifyDocumentWithUser(undefined, d)\n )\n return (\n await this.decrypt([\n await super.setMainDocumentAttachment(\n document.id!,\n updatedEntity?.rev ?? document.rev,\n encryptedData,\n utis,\n true,\n compressionAlgorithm,\n getCompressionVersion(),\n realDataSize\n ),\n ])\n )[0].entity\n }\n\n /**\n * Adds an unencrypted attachment to a document.\n * @param document a document.\n * @param attachment a new main attachment for the document.\n * @param utis an array of UTIs for the attachment. The first element will be considered as the main UTI for the document. If provided and non-empty\n * overrides existing values.\n * @param deflate if true, compress the attachment before uploading. Reliable decompression of compressed data requires version 26.5 of the API and all users to be using at least version 8.7.0 of the SDK * @return the updated document.\n */\n async setClearDocumentAttachment(\n document: models.Document,\n attachment: ArrayBuffer | Uint8Array,\n utis?: string[],\n deflate: boolean = false\n ): Promise<models.Document> {\n if (!document.rev) throw new Error('Cannot set attachment on document without rev')\n const raw = ua2ab(attachment)\n const realDataSize = raw.byteLength\n const { data: dataToUpload, algorithm: compressionAlgorithm } = deflate\n ? await compressData(attachment, utis)\n : { data: raw, algorithm: undefined }\n\n return (\n await this.decrypt([\n await super.setMainDocumentAttachment(\n document.id!,\n document.rev,\n dataToUpload,\n utis,\n false,\n compressionAlgorithm,\n getCompressionVersion(),\n realDataSize\n ),\n ])\n )[0].entity\n }\n\n /**\n * Adds a secondary attachment to a document, encrypting it on client side using the encryption keys of the provided document.\n * @param document a document.\n * @param secondaryAttachmentKey key for the secondary attachment.\n * @param attachment a new secondary attachment for the document.\n * @param utis an array of UTIs for the attachment. The first element will be considered as the main UTI for the document. If provided and non-empty\n * overrides existing values.\n * @param deflate if true, compress the attachment before uploading. Reliable decompression of compressed data requires version 26.5 of the API and all users to be using at least version 8.7.0 of the SDK * @return the updated document.\n */\n async encryptAndSetSecondaryDocumentAttachment(\n document: models.Document,\n secondaryAttachmentKey: string,\n attachment: ArrayBuffer | Uint8Array,\n utis?: string[],\n deflate: boolean = false\n ): Promise<models.Document> {\n if (!document.rev) throw new Error('Cannot set attachment on document without rev')\n const raw = ua2ab(attachment)\n const realDataSize = raw.byteLength\n const { data: dataToEncrypt, algorithm: compressionAlgorithm } = deflate\n ? await compressData(attachment, utis)\n : { data: raw, algorithm: undefined }\n\n const { encryptedData, updatedEntity } = await this.crypto.xapi.encryptDataOf(\n document,\n EntityWithDelegationTypeName.Document,\n dataToEncrypt,\n (d) => this.modifyDocumentWithUser(undefined, d)\n )\n return (\n await this.decrypt([\n await super.setSecondaryAttachment(\n document.id!,\n secondaryAttachmentKey,\n updatedEntity?.rev ?? document.rev!,\n encryptedData,\n utis,\n true,\n compressionAlgorithm,\n getCompressionVersion(),\n realDataSize\n ),\n ])\n )[0].entity\n }\n\n /**\n * Adds an unencrypted secondary attachment to a document.\n * @param document a document.\n * @param secondaryAttachmentKey key for the secondary attachment.\n * @param attachment a new secondary attachment for the document.\n * @param utis an array of UTIs for the attachment. The first element will be considered as the main UTI for the document. If provided and non-empty\n * overrides existing values.\n * @param deflate if true, compress the attachment before uploading. Reliable decompression of compressed data requires version 26.5 of the API and all users to be using at least version 8.7.0 of the SDK\n * @return the updated document.\n */\n async setClearSecondaryDocumentAttachment(\n document: models.Document,\n secondaryAttachmentKey: string,\n attachment: ArrayBuffer | Uint8Array,\n utis?: string[],\n deflate: boolean = false\n ): Promise<models.Document> {\n const raw = ua2ab(attachment)\n const realDataSize = raw.byteLength\n const { data: dataToUpload, algorithm: compressionAlgorithm } = deflate\n ? await compressData(attachment, utis)\n : { data: raw, algorithm: undefined }\n\n return (\n await this.decrypt([\n await super.setSecondaryAttachment(\n document.id!,\n secondaryAttachmentKey,\n document.rev!,\n dataToUpload,\n utis,\n false,\n compressionAlgorithm,\n getCompressionVersion(),\n realDataSize\n ),\n ])\n )[0].entity\n }\n\n /**\n * Gets the main attachment of a document and tries to decrypt it using the encryption keys of the document, throwing an error if the operation fails.\n * @param document a document.\n * @param validator optionally a validator function which checks if the decryption was successful. In cases where the document 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 getAndDecryptDocumentAttachment(\n document: models.Document,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<ArrayBuffer> {\n const retrieved = await this.getAndTryDecryptDocumentAttachment(document, (x) => validator(x))\n if (!retrieved.wasDecrypted) throw new Error(`No valid key found to decrypt data of document ${document.id}.`)\n return retrieved.data\n }\n\n /**\n * Gets the main attachment of a document and tries to decrypt it using the encryption keys of the document.\n * @param document a document.\n * @param validator optionally a validator function which checks if the decryption was successful. In cases where the document 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 getAndTryDecryptDocumentAttachment(\n document: models.Document,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<{ data: ArrayBuffer; wasDecrypted: boolean }> {\n const compressionAlgorithm = document.extraMainAttachmentInfo?.compressionAlgorithm\n return await this.crypto.xapi.tryDecryptDataOf(\n { entity: document, type: EntityWithDelegationTypeName.Document },\n await super.getRawMainDocumentAttachment(document.id!),\n async (decrypted) => {\n try {\n const data = compressionAlgorithm ? await decompressData(decrypted, compressionAlgorithm) : decrypted\n return (await validator(data)) ? data : undefined\n } catch {\n return undefined\n }\n }\n )\n }\n\n /**\n * Gets the secondary attachment of a document and tries to decrypt it using the encryption keys of the document, throwing an error if the operation fails.\n * @param document a document.\n * @param secondaryAttachmentKey key of the secondary attachment.\n * @param validator optionally a validator function which checks if the decryption was successful. In cases where the document 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.\n */\n async getAndDecryptSecondaryDocumentAttachment(\n document: models.Document,\n secondaryAttachmentKey: string,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<ArrayBuffer> {\n const { data, wasDecrypted } = await this.getAndTryDecryptSecondaryDocumentAttachment(document, secondaryAttachmentKey, (x) => validator(x))\n if (!wasDecrypted) throw new Error(`No valid key found to decrypt data of document ${document.id}.`)\n return data\n }\n\n /**\n * Gets the secondary attachment of a document and tries to decrypt it using the encryption keys of the document.\n * @param document a document.\n * @param secondaryAttachmentKey key of the secondary attachment.\n * @param validator optionally a validator function which checks if the decryption was successful. In cases where the document 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 getAndTryDecryptSecondaryDocumentAttachment(\n document: models.Document,\n secondaryAttachmentKey: string,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<{ data: ArrayBuffer; wasDecrypted: boolean }> {\n const compressionAlgorithm = document.secondaryAttachments?.[secondaryAttachmentKey]?.compressionAlgorithm\n return await this.crypto.xapi.tryDecryptDataOf(\n { entity: document, type: EntityWithDelegationTypeName.Document },\n await super.getSecondaryAttachment(document.id!, secondaryAttachmentKey),\n async (decrypted) => {\n try {\n const data = compressionAlgorithm ? await decompressData(decrypted, compressionAlgorithm) : decrypted\n return (await validator(data)) ? data : undefined\n } catch {\n return undefined\n }\n }\n )\n }\n\n /**\n * @param document a document\n * @return the id of the message that the document 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 decryptMessageIdOf(document: models.Document): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: document, type: EntityWithDelegationTypeName.Document }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given document\n */\n async hasWriteAccess(document: models.Document): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: document, type: EntityWithDelegationTypeName.Document })\n }\n\n /**\n * Share an existing document with other data owners, allowing them to access the non-encrypted data of the document 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 document.\n * @param document the document to share.\n * @param options optional parameters to customize the sharing behaviour:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - shareMessageId: specifies if the id of the message that this document 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 document: models.Document,\n options: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n shareMessageId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<models.Document> {\n return this.shareWithMany(document, { [delegateId]: options })\n }\n\n /**\n * Share an existing document with other data owners, allowing them to access the non-encrypted data of the document and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param document the document to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - shareMessageId: specifies if the id of the message that this document 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 document: models.Document,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n shareMessageId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Document> {\n return (await this.tryShareWithMany(document, delegates)).updatedEntityOrThrow\n }\n /**\n * Share an existing document with other data owners, allowing them to access the non-encrypted data of the document and optionally also\n * the encrypted content, with read-only or read-write permissions.\n * @param document the document to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - shareMessageId: specifies if the id of the message that this document 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 document: models.Document,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n shareMessageId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.Document>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(document, EntityWithDelegationTypeName.Document)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyDocumentWithUser(undefined, entityWithEncryptionKey) : document\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.Document,\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.shareMessageId,\n shareSecretIds: options.shareSecretIds,\n },\n ])\n ),\n (x) => super.bulkShareDocument(x)\n )\n .then((r) => r.mapSuccessAsync(async (m) => (await this.decrypt([m]))[0].entity))\n }\n\n /**\n * Gets the data owners that have access to a document.\n * @param entity the document.\n * @return an object containing the permissions by data owner id and a flag indicating if there are unknown anonymous data owners.\n */\n getDataOwnersWithAccessTo(\n entity: models.Document\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.Document })\n }\n\n /**\n * Gets the encryption keys of a document.\n * @param entity the document.\n * @return an array of encryption keys.\n */\n getEncryptionKeysOf(entity: models.Document): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.Document }, undefined)\n }\n\n /**\n * Creates delegation de-anonymization metadata for a document.\n * @param entity the document.\n * @param delegates the data owner ids of the delegates.\n */\n createDelegationDeAnonymizationMetadata(entity: models.Document, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo(\n { entity, type: EntityWithDelegationTypeName.Document },\n delegates\n )\n }\n\n private async decryptPage(page: PaginatedListDocument): Promise<PaginatedListDocument> {\n return {\n ...page,\n rows: (await this.decrypt(page.rows ?? [])).map((x) => x.entity),\n }\n }\n\n /**\n * Creates a new document.\n * @param user the user (not used).\n * @param body the document to create.\n * @return the created document.\n */\n async createDocumentWithUser(user: models.User | undefined, body: models.Document): Promise<models.Document> {\n return (await this.decrypt([await super.createDocument((await this.encrypt([body]))[0])]))[0].entity\n }\n\n /**\n * Deletes the main attachment of a document.\n * @param user the user (not used).\n * @param documentId the id of the document.\n * @return the updated document.\n */\n async deleteAttachmentWithUser(user: models.User | undefined, documentId: string): Promise<models.Document> {\n return (await this.decrypt([await super.deleteAttachment(documentId)]))[0].entity\n }\n\n /**\n * @deprecated\n */\n async findByTypeHCPartyMessageSecretFKeysWithUser(\n user: models.User | undefined,\n documentTypeCode: string,\n hcPartyId: string,\n secretFKeys: string[]\n ): Promise<Array<models.Document>> {\n return (await this.decrypt(await super.findByTypeHCPartyMessageSecretFKeys(documentTypeCode, hcPartyId, secretFKeys))).map((x) => x.entity)\n }\n\n /**\n * @deprecated\n */\n async findDocumentsByHCPartyPatientForeignKeysWithUser(\n user: models.User | undefined,\n hcPartyId: string,\n secretFKeys: string[]\n ): Promise<Array<models.Document>> {\n return (await this.decrypt(await super.findDocumentsByHCPartyPatientForeignKeys(hcPartyId, secretFKeys))).map((x) => x.entity)\n }\n\n /**\n * @deprecated\n */\n async findDocumentsByHCPartyPatientForeignKeyWithUser(\n user: models.User | undefined,\n hcPartyId: string,\n secretFKey: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): Promise<PaginatedListDocument> {\n return await this.decryptPage(await super.findDocumentsByHCPartyPatientForeignKey(hcPartyId, secretFKey, startKey, startDocumentId, limit))\n }\n\n async findWithoutDelegationWithUser(user: models.User | undefined, limit?: number): Promise<Array<models.Document>> {\n return (await this.decrypt(await super.findWithoutDelegation(limit))).map((x) => x.entity)\n }\n\n /**\n * Gets a document by id.\n * @param user the user (not used).\n * @param documentId the id of the document.\n * @return the document.\n */\n async getDocumentWithUser(user: models.User | undefined, documentId: string): Promise<models.Document> {\n return (await this.decrypt([await super.getDocument(documentId)]))[0].entity\n }\n\n /**\n * Gets a document by external UUID.\n * @param user the user (not used).\n * @param externalUuid the external UUID of the document.\n * @return the document.\n */\n async getDocumentByExternalUuidWithUser(user: models.User | undefined, externalUuid: string): Promise<models.Document> {\n return (await this.decrypt([await super.getDocumentByExternalUuid(externalUuid)]))[0].entity\n }\n\n /**\n * Gets multiple documents by their ids.\n * @param user the user (not used).\n * @param body a list of document ids.\n * @return the documents.\n */\n async getDocumentsWithUser(user: models.User | undefined, body?: ListOfIds): Promise<Array<models.Document>> {\n return (await this.decrypt(await super.getDocuments(body))).map((x) => x.entity)\n }\n\n /**\n * Gets all documents with a specific external UUID.\n * @param user the user (not used).\n * @param externalUuid the external UUID.\n * @return the documents.\n */\n async getDocumentsByExternalUuidWithUser(user: models.User | undefined, externalUuid: string): Promise<Array<models.Document>> {\n return (await this.decrypt(await super.getDocumentsByExternalUuid(externalUuid))).map((x) => x.entity)\n }\n\n /**\n * Updates a document.\n * @param user the user (not used).\n * @param body the document to update.\n * @return the updated document.\n */\n async modifyDocumentWithUser(user: models.User | undefined, body: models.Document): Promise<models.Document> {\n return (await this.decrypt([await super.modifyDocument((await this.encrypt([body]))[0])]))[0].entity\n }\n\n /**\n * Updates multiple documents.\n * @param user the user (not used).\n * @param body the documents to update.\n * @return the updated documents.\n */\n async modifyDocumentsWithUser(user: models.User | undefined, body: Array<models.Document>): Promise<Array<models.Document>> {\n return (await this.decrypt(await super.modifyDocuments(await this.encrypt(body)))).map((x) => x.entity)\n }\n\n /**\n * Sets the main attachment of a document.\n * @param user the user (not used).\n * @param documentId the id of the document.\n * @param documentRev the revision of the document.\n * @param body the attachment data.\n * @param utis an array of UTIs for the attachment.\n * @param dataIsEncrypted whether the data is already encrypted.\n * @return the updated document.\n */\n async setMainDocumentAttachmentWithUser(\n user: models.User | undefined,\n documentId: string,\n documentRev: string,\n body: Object,\n utis?: Array<string>,\n dataIsEncrypted?: boolean\n ): Promise<models.Document> {\n return (await this.decrypt([await super.setMainDocumentAttachment(documentId, documentRev, body, utis, dataIsEncrypted)]))[0].entity\n }\n\n /**\n * Sets a secondary attachment on a document.\n * @param user the user (not used).\n * @param documentId the id of the document.\n * @param key the key for the secondary attachment.\n * @param rev the revision of the document.\n * @param attachment the attachment data.\n * @param utis an array of UTIs for the attachment.\n * @param dataIsEncrypted whether the data is already encrypted.\n * @return the updated document.\n */\n async setSecondaryAttachmentWithUser(\n user: models.User | undefined,\n documentId: string,\n key: string,\n rev: string,\n attachment: Object,\n utis?: Array<string>,\n dataIsEncrypted?: boolean\n ): Promise<models.Document> {\n return (await this.decrypt([await super.setSecondaryAttachment(documentId, key, rev, attachment, utis, dataIsEncrypted)]))[0].entity\n }\n\n /**\n * Deletes a secondary attachment from a document.\n * @param user the user (not used).\n * @param documentId the id of the document.\n * @param key the key of the secondary attachment.\n * @param rev the revision of the document.\n * @return the updated document.\n */\n async deleteSecondaryAttachmentWithUser(user: models.User | undefined, documentId: string, key: string, rev: string): Promise<models.Document> {\n return (await this.decrypt([await super.deleteSecondaryAttachment(documentId, key, rev)]))[0].entity\n }\n\n createDocument(body?: models.Document): never {\n throw new Error('Use withUser method')\n }\n\n deleteAttachment(documentId: string): never {\n throw new Error('Use withUser method')\n }\n\n findByTypeHCPartyMessageSecretFKeys(documentTypeCode: string, hcPartyId: string, secretFKeys: string[]): never {\n throw new Error('Use withUser method')\n }\n\n findDocumentsByHCPartyPatientForeignKeys(hcPartyId: string, secretFKeys: string[]): never {\n throw new Error('Use withUser method')\n }\n\n findDocumentsByHCPartyPatientForeignKey(hcPartyId: string, secretFKey: string, startKey?: string, startDocumentId?: string, limit?: number): never {\n throw new Error('Use withUser method')\n }\n\n findWithoutDelegation(limit?: number): never {\n throw new Error('Use withUser method')\n }\n\n getDocument(documentId: string): never {\n throw new Error('Use withUser method')\n }\n\n getDocumentByExternalUuid(externalUuid: string): never {\n throw new Error('Use withUser method')\n }\n\n getDocuments(body?: ListOfIds): never {\n throw new Error('Use withUser method')\n }\n\n getDocumentsByExternalUuid(externalUuid: string): never {\n throw new Error('Use withUser method')\n }\n\n modifyDocument(body?: models.Document): never {\n throw new Error('Use withUser method')\n }\n\n modifyDocuments(body?: Array<models.Document>): never {\n throw new Error('Use withUser method')\n }\n\n setMainDocumentAttachment(documentId: string, documentRev: string, body: Object, utis?: Array<string>, dataIsEncrypted?: boolean): never {\n throw new Error('Use withUser method')\n }\n\n setDocumentAttachmentBody(documentId: string, documentRev: string, enckeys?: null, body?: Object, utis?: string[]): never {\n throw new Error('Use withUser method')\n }\n\n setDocumentAttachment(documentId: string, documentRev: string, enckeys?: null, body?: Object, utis?: string[]): never {\n throw new Error('Use withUser method')\n }\n\n setDocumentAttachmentMulti(attachment: ArrayBuffer, documentRev: string, documentId: string, enckeys?: null): never {\n throw new Error('Use withUser method')\n }\n\n setSecondaryAttachment(documentId: string, key: string, rev: string, attachment: Object, utis?: Array<string>, dataIsEncrypted?: boolean): never {\n throw new Error('Use withUser method')\n }\n\n deleteSecondaryAttachment(documentId: string, key: string, rev: string): never {\n throw new Error('Use withUser method')\n }\n\n /**\n * Like {@link getConflictsForEntity} but additionally decrypts the conflicting revisions.\n * @param user the current user (unused for documents, kept for API consistency).\n * @param entityId the id of the document to retrieve the conflicts for.\n * @return the decrypted conflicting revisions of the document.\n */\n getConflictsForEntityWithUser(user: models.User, entityId: string): Promise<Array<models.Document>> {\n return super\n .getConflictsForEntity(entityId)\n .then((ds) => this.decrypt(ds))\n .then((res) => res.map(({ entity }) => entity))\n }\n\n /**\n * Like {@link declareConflictWinner} but encrypts the winning revision before sending it and decrypts the saved\n * winner returned by the backend.\n * @param user the current user (unused for documents, kept for API consistency).\n * @param request the {@link models.ConflictResolutionRequest} carrying the (decrypted) winning revision and the conflicts to purge.\n * @return the {@link models.ConflictResolutionResult} with the decrypted saved winner and the conflicts that are still unresolved.\n */\n async declareConflictWinnerWithUser(\n user: models.User,\n request: models.ConflictResolutionRequest<models.Document>\n ): Promise<models.ConflictResolutionResult<models.Document>> {\n const encrypted = (await this.encrypt([cloneDeep(request.document!)]))[0]\n const result = await super.declareConflictWinner({ ...request, document: encrypted })\n if (result.document) result.document = (await this.decrypt([result.document]))[0].entity\n return result\n }\n\n /**\n * Like {@link getConflictsForEntityWithUser} but targets the entity of the group with the given id.\n * @param user the current user (unused for documents, kept for API consistency).\n * @param groupId the id of the group the document belongs to.\n * @param entityId the id of the document to retrieve the conflicts for.\n * @return the decrypted conflicting revisions of the document.\n */\n getConflictsForEntityInGroupWithUser(user: models.User, groupId: string, entityId: string): Promise<Array<models.Document>> {\n return super\n .getConflictsForEntityInGroup(groupId, entityId)\n .then((ds) => this.decrypt(ds))\n .then((res) => res.map(({ entity }) => entity))\n }\n\n /**\n * Like {@link declareConflictWinnerWithUser} but targets the entity of the group with the given id.\n * @param user the current user (unused for documents, kept for API consistency).\n * @param groupId the id of the group the document belongs to.\n * @param request the {@link models.ConflictResolutionRequest} carrying the (decrypted) winning revision and the conflicts to purge.\n * @return the {@link models.ConflictResolutionResult} with the decrypted saved winner and the conflicts that are still unresolved.\n */\n async declareConflictWinnerInGroupWithUser(\n user: models.User,\n groupId: string,\n request: models.ConflictResolutionRequest<models.Document>\n ): Promise<models.ConflictResolutionResult<models.Document>> {\n const encrypted = (await this.encrypt([cloneDeep(request.document!)]))[0]\n const result = await super.declareConflictWinnerInGroup(groupId, { ...request, document: encrypted })\n if (result.document) result.document = (await this.decrypt([result.document]))[0].entity\n return result\n }\n}\n"]}
@@ -142,10 +142,9 @@ class IccReceiptXApi extends icc_api_1.IccReceiptApi {
142
142
  encryptCompressAndSetReceiptDataAttachment(receipt_1, blobType_1, attachment_1) {
143
143
  return __awaiter(this, arguments, void 0, function* (receipt, blobType, attachment, deflate = false) {
144
144
  var _a;
145
- const realDataSize = (0, utils_1.ua2ab)(attachment).byteLength;
146
- const { data: dataToEncrypt, algorithm: compressionAlgorithm } = deflate
147
- ? yield (0, compression_utils_1.compressData)(attachment)
148
- : { data: (0, utils_1.ua2ab)(attachment), algorithm: undefined };
145
+ const raw = (0, utils_1.ua2ab)(attachment);
146
+ const realDataSize = raw.byteLength;
147
+ const { data: dataToEncrypt, algorithm: compressionAlgorithm } = deflate ? yield (0, compression_utils_1.compressData)(attachment) : { data: raw, algorithm: undefined };
149
148
  const { encryptedData, updatedEntity } = yield this.crypto.xapi.encryptDataOf(receipt, utils_1.EntityWithDelegationTypeName.Receipt, dataToEncrypt, (r) => this.modifyReceipt(r));
150
149
  return yield this.setReceiptDataAttachment(receipt.id, blobType, (_a = updatedEntity === null || updatedEntity === void 0 ? void 0 : updatedEntity.rev) !== null && _a !== void 0 ? _a : receipt.rev, encryptedData, compressionAlgorithm, (0, compression_utils_1.getCompressionVersion)(), realDataSize);
151
150
  });
@@ -160,10 +159,9 @@ class IccReceiptXApi extends icc_api_1.IccReceiptApi {
160
159
  */
161
160
  setClearReceiptDataAttachment(receipt_1, blobType_1, attachment_1) {
162
161
  return __awaiter(this, arguments, void 0, function* (receipt, blobType, attachment, deflate = false) {
163
- const realDataSize = (0, utils_1.ua2ab)(attachment).byteLength;
164
- const { data: dataToUpload, algorithm: compressionAlgorithm } = deflate
165
- ? yield (0, compression_utils_1.compressData)(attachment)
166
- : { data: (0, utils_1.ua2ab)(attachment), algorithm: undefined };
162
+ const raw = (0, utils_1.ua2ab)(attachment);
163
+ const realDataSize = raw.byteLength;
164
+ const { data: dataToUpload, algorithm: compressionAlgorithm } = deflate ? yield (0, compression_utils_1.compressData)(attachment) : { data: raw, algorithm: undefined };
167
165
  return yield this.setReceiptDataAttachment(receipt.id, blobType, receipt.rev, dataToUpload, compressionAlgorithm, (0, compression_utils_1.getCompressionVersion)(), realDataSize);
168
166
  });
169
167
  }
@@ -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,kDAAiD;AAEjD,0EAAgG;AAChG,4EAAwE;AAIxE,wEAAoE;AACpE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAIzD,mCAA6D;AAC7D,iEAA+F;AAE/F,MAAa,cAAe,SAAQ,uBAAa;IAC/C,IAAI,OAAO;QACT,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,2BAA2B,CAAC,CAAC,EAAE,oCAA4B,CAAC,OAAO,CAAC,CAAC,CAAA;IAC7I,CAAC;IAED,YACE,IAAY,EACZ,OAAkC,EACjB,MAAqB,EACrB,YAA8B,EAC9B,cAAuB,EACxC,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,OAAO,IAAI,KA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CACH,EACD,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAChC,CAAA;QACH,CAAC;KAAA;IAED;;;;OAIG;IACH,yBAAyB,CACvB,MAAsB;QAEtB,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,yBAAyB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,OAAO,EAAE,CAAC,CAAA;IACjI,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CAAC,MAAsB;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAA;IAC7G,CAAC;IAED;;;;;OAKG;IACH,uCAAuC,CAAC,MAAsB,EAAE,SAAmB;QACjF,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,iCAAiC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAA;IACpJ,CAAC;CACF;AAvZD,wCAuZC","sourcesContent":["import { IccReceiptApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\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 { ShareResult } from './utils/ShareResult'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { MaintenanceTask } from '../icc-api/model/models'\nimport { EntityWithDelegationTypeName, ua2ab } from './utils'\nimport { compressData, decompressData, getCompressionVersion } from './utils/compression-utils'\n\nexport class IccReceiptXApi extends IccReceiptApi implements EncryptedEntityXApi<models.Receipt> {\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.Receipt))\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 autofillAuthor: boolean,\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\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.\n * - ignoreAutoDelegations: if true the data won't be shared with the autodelegations of the user, but only with additional delegates\n * - alternateRootDelegation: by default a new entity is created with a root delegation from self to self. In keyless mode this is not possible,\n * and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.\n * @return a new instance of receipt.\n */\n async newInstance(\n user: models.User,\n r: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n ignoreAutoDelegations?: boolean\n alternateRootDelegation?: string\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.primitives.randomUuid(),\n created: r?.created ?? new Date().getTime(),\n modified: r?.modified ?? new Date().getTime(),\n responsible: r?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: r?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: r?.codes ?? [],\n tags: r?.tags ?? [],\n })\n\n const extraDelegations = {\n ...(options.ignoreAutoDelegations == true\n ? {}\n : Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.medicalInformation ?? [])].map((d) => [d, AccessLevelEnum.WRITE])\n )),\n ...(options?.additionalDelegates ?? {}),\n }\n return new models.Receipt(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(\n receipt,\n EntityWithDelegationTypeName.Receipt,\n undefined,\n undefined,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n .then((x) => x.updatedEntity)\n )\n }\n\n /**\n * Creates a new receipt linked to a document and optionally attaches a blob to it.\n * @param user the current user.\n * @param docId the id of the document this receipt refers to.\n * @param refs an array of reference strings to associate with the receipt.\n * @param blobType the type of the blob attachment.\n * @param blob the binary content to attach; if empty (byteLength == 0), no attachment is set.\n * @return the created receipt, with the attachment set if the blob was non-empty.\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.setReceiptAttachmentForBlobType(rcpt.id!, rcpt.rev!, 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, updatedEntity } = await this.crypto.xapi.encryptDataOf(receipt, EntityWithDelegationTypeName.Receipt, attachment, (r) =>\n this.modifyReceipt(r)\n )\n return await this.setReceiptAttachmentForBlobType(receipt.id!, updatedEntity?.rev ?? receipt.rev!, blobType, 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.setReceiptAttachmentForBlobType(receipt.id!, receipt.rev!, blobType, ua2ab(attachment))\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 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 retrieved = await this.getAndTryDecryptReceiptAttachment(receipt, attachmentId, (x) => validator(x))\n if (!retrieved.wasDecrypted) throw new Error(`No valid key found to decrypt data of receipt ${receipt.id}.`)\n return retrieved.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.xapi.tryDecryptDataOf(\n { entity: receipt, type: EntityWithDelegationTypeName.Receipt },\n await this.getReceiptAttachment(receipt.id!, attachmentId),\n async (x) => ((await validator(x)) ? x : undefined)\n )\n }\n\n // --- New data attachment methods (with compression support) ---\n\n /**\n * Compresses, encrypts, and uploads a receipt attachment using the new data attachment endpoint.\n * Compression is attempted automatically; if the compressed result is not smaller, the original data is used.\n * @param receipt a receipt.\n * @param blobType the type of the attachment.\n * @param attachment the raw attachment data.\n * @param deflate if true, compress the attachment before uploading. Reliable decompression of compressed data requires version 26.5 of the API and all users to be using at least version 8.7.0 of the SDK * @return the updated receipt.\n */\n async encryptCompressAndSetReceiptDataAttachment(\n receipt: models.Receipt,\n blobType: string,\n attachment: ArrayBuffer | Uint8Array,\n deflate: boolean = false\n ): Promise<models.Receipt> {\n const realDataSize = ua2ab(attachment).byteLength\n const { data: dataToEncrypt, algorithm: compressionAlgorithm } = deflate\n ? await compressData(attachment)\n : { data: ua2ab(attachment), algorithm: undefined }\n\n const { encryptedData, updatedEntity } = await this.crypto.xapi.encryptDataOf(\n receipt,\n EntityWithDelegationTypeName.Receipt,\n dataToEncrypt,\n (r) => this.modifyReceipt(r)\n )\n return await this.setReceiptDataAttachment(\n receipt.id!,\n blobType,\n updatedEntity?.rev ?? receipt.rev!,\n encryptedData,\n compressionAlgorithm,\n getCompressionVersion(),\n realDataSize\n )\n }\n\n /**\n * Compresses and uploads an unencrypted receipt attachment using the new data attachment endpoint.\n * Compression is attempted automatically; if the compressed result is not smaller, the original data is used.\n * @param receipt a receipt.\n * @param blobType the type of the attachment.\n * @param attachment the raw attachment data.\n * @param deflate if true, compress the attachment before uploading. Reliable decompression of compressed data requires version 26.5 of the API and all users to be using at least version 8.7.0 of the SDK * @return the updated receipt.\n */\n async setClearReceiptDataAttachment(\n receipt: models.Receipt,\n blobType: string,\n attachment: ArrayBuffer | Uint8Array,\n deflate: boolean = false\n ): Promise<models.Receipt> {\n const realDataSize = ua2ab(attachment).byteLength\n const { data: dataToUpload, algorithm: compressionAlgorithm } = deflate\n ? await compressData(attachment)\n : { data: ua2ab(attachment), algorithm: undefined }\n\n return await this.setReceiptDataAttachment(\n receipt.id!,\n blobType,\n receipt.rev!,\n dataToUpload,\n compressionAlgorithm,\n getCompressionVersion(),\n realDataSize\n )\n }\n\n /**\n * Gets a receipt's data attachment by blob type, decrypts it, and decompresses if needed.\n * Throws if decryption fails.\n * @param receipt a receipt.\n * @param blobType the blob type of the attachment to retrieve.\n * @param validator optionally a validator function which checks if the decryption was successful.\n * @return the decrypted (and decompressed) attachment.\n */\n async getAndDecryptReceiptDataAttachment(\n receipt: models.Receipt,\n blobType: string,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<ArrayBuffer> {\n const retrieved = await this.getAndTryDecryptReceiptDataAttachment(receipt, blobType, validator)\n if (!retrieved.wasDecrypted) throw new Error(`No valid key found to decrypt data of receipt ${receipt.id}.`)\n return retrieved.data\n }\n\n /**\n * Gets a receipt's data attachment by blob type, tries to decrypt it, and decompresses if needed.\n * @param receipt a receipt.\n * @param blobType the blob type of the attachment to retrieve.\n * @param validator optionally a validator function which checks if the decryption was successful.\n * @return an object containing:\n * - data: the decrypted (and decompressed) attachment, or the raw data if decryption failed.\n * - wasDecrypted: if the data was successfully decrypted or not.\n */\n async getAndTryDecryptReceiptDataAttachment(\n receipt: models.Receipt,\n blobType: string,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<{ data: ArrayBuffer; wasDecrypted: boolean }> {\n const compressionAlgorithm = receipt.attachmentInfos?.[blobType]?.compressionAlgorithm\n return await this.crypto.xapi.tryDecryptDataOf(\n { entity: receipt, type: EntityWithDelegationTypeName.Receipt },\n await this.getReceiptAttachmentByBlobType(receipt.id!, blobType),\n async (decrypted) => {\n try {\n const data = compressionAlgorithm ? await decompressData(decrypted, compressionAlgorithm) : decrypted\n return (await validator(data)) ? data : undefined\n } catch {\n return undefined\n }\n }\n )\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given receipt\n */\n async hasWriteAccess(receipt: models.Receipt): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: receipt, type: EntityWithDelegationTypeName.Receipt })\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, with read-only or read-write permissions.\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 * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * receipt does not have encrypted content.\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 receipt: models.Receipt,\n options: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\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, with read-only or read-write permissions.\n * @param receipt the receipt to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * receipt does not have encrypted content.\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWithMany(\n receipt: models.Receipt,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Receipt> {\n return (await this.tryShareWithMany(receipt, delegates)).updatedEntityOrThrow\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, with read-only or read-write permissions.\n * @param receipt the receipt to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * receipt does not have encrypted content.\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 receipt: models.Receipt,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.Receipt>> {\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(receipt, EntityWithDelegationTypeName.Receipt)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyReceipt(entityWithEncryptionKey) : receipt\n return this.crypto.xapi.simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.Receipt,\n },\n Object.fromEntries(\n Object.entries(delegates).map(([delegateId, options]) => [\n delegateId,\n {\n requestedPermissions: options.requestedPermissions,\n shareEncryptionKeys: options.shareEncryptionKey,\n shareOwningEntityIds: ShareMetadataBehaviour.NEVER,\n shareSecretIds: options.shareSecretIds,\n },\n ])\n ),\n (x) => this.bulkShareReceipt(x)\n )\n }\n\n /**\n * Retrieves the data owners that have access to the given receipt, along with their access levels.\n * @param entity the receipt.\n * @return an object containing a map of data owner ids to their access levels, and a flag indicating if there are unknown anonymous data owners.\n */\n getDataOwnersWithAccessTo(\n entity: models.Receipt\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.Receipt })\n }\n\n /**\n * Retrieves the encryption keys of the given receipt.\n * @param entity the receipt.\n * @return the encryption key ids.\n */\n getEncryptionKeysOf(entity: models.Receipt): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.Receipt }, undefined)\n }\n\n /**\n * Creates or updates de-anonymization metadata for the given receipt, allowing the specified delegates to\n * identify the data owners that have access to it.\n * @param entity the receipt.\n * @param delegates the data owner ids for which to create de-anonymization metadata.\n */\n createDelegationDeAnonymizationMetadata(entity: models.Receipt, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: EntityWithDelegationTypeName.Receipt }, delegates)\n }\n}\n"]}
1
+ {"version":3,"file":"icc-receipt-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-receipt-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA0C;AAE1C,kDAAiD;AAEjD,0EAAgG;AAChG,4EAAwE;AAIxE,wEAAoE;AACpE,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAIzD,mCAA6D;AAC7D,iEAA+F;AAE/F,MAAa,cAA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ccCryptoXApi } from './icc-crypto-x-api'\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 { ShareResult } from './utils/ShareResult'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { MaintenanceTask } from '../icc-api/model/models'\nimport { EntityWithDelegationTypeName, ua2ab } from './utils'\nimport { compressData, decompressData, getCompressionVersion } from './utils/compression-utils'\n\nexport class IccReceiptXApi extends IccReceiptApi implements EncryptedEntityXApi<models.Receipt> {\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.Receipt))\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 autofillAuthor: boolean,\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\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.\n * - ignoreAutoDelegations: if true the data won't be shared with the autodelegations of the user, but only with additional delegates\n * - alternateRootDelegation: by default a new entity is created with a root delegation from self to self. In keyless mode this is not possible,\n * and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.\n * @return a new instance of receipt.\n */\n async newInstance(\n user: models.User,\n r: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n ignoreAutoDelegations?: boolean\n alternateRootDelegation?: string\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.primitives.randomUuid(),\n created: r?.created ?? new Date().getTime(),\n modified: r?.modified ?? new Date().getTime(),\n responsible: r?.responsible ?? (this.autofillAuthor ? this.dataOwnerApi.getDataOwnerIdOf(user) : undefined),\n author: r?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: r?.codes ?? [],\n tags: r?.tags ?? [],\n })\n\n const extraDelegations = {\n ...(options.ignoreAutoDelegations == true\n ? {}\n : Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.medicalInformation ?? [])].map((d) => [d, AccessLevelEnum.WRITE])\n )),\n ...(options?.additionalDelegates ?? {}),\n }\n return new models.Receipt(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(\n receipt,\n EntityWithDelegationTypeName.Receipt,\n undefined,\n undefined,\n true,\n extraDelegations,\n options.alternateRootDelegation\n )\n .then((x) => x.updatedEntity)\n )\n }\n\n /**\n * Creates a new receipt linked to a document and optionally attaches a blob to it.\n * @param user the current user.\n * @param docId the id of the document this receipt refers to.\n * @param refs an array of reference strings to associate with the receipt.\n * @param blobType the type of the blob attachment.\n * @param blob the binary content to attach; if empty (byteLength == 0), no attachment is set.\n * @return the created receipt, with the attachment set if the blob was non-empty.\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.setReceiptAttachmentForBlobType(rcpt.id!, rcpt.rev!, 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, updatedEntity } = await this.crypto.xapi.encryptDataOf(receipt, EntityWithDelegationTypeName.Receipt, attachment, (r) =>\n this.modifyReceipt(r)\n )\n return await this.setReceiptAttachmentForBlobType(receipt.id!, updatedEntity?.rev ?? receipt.rev!, blobType, 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.setReceiptAttachmentForBlobType(receipt.id!, receipt.rev!, blobType, ua2ab(attachment))\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 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 retrieved = await this.getAndTryDecryptReceiptAttachment(receipt, attachmentId, (x) => validator(x))\n if (!retrieved.wasDecrypted) throw new Error(`No valid key found to decrypt data of receipt ${receipt.id}.`)\n return retrieved.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.xapi.tryDecryptDataOf(\n { entity: receipt, type: EntityWithDelegationTypeName.Receipt },\n await this.getReceiptAttachment(receipt.id!, attachmentId),\n async (x) => ((await validator(x)) ? x : undefined)\n )\n }\n\n // --- New data attachment methods (with compression support) ---\n\n /**\n * Compresses, encrypts, and uploads a receipt attachment using the new data attachment endpoint.\n * Compression is attempted automatically; if the compressed result is not smaller, the original data is used.\n * @param receipt a receipt.\n * @param blobType the type of the attachment.\n * @param attachment the raw attachment data.\n * @param deflate if true, compress the attachment before uploading. Reliable decompression of compressed data requires version 26.5 of the API and all users to be using at least version 8.7.0 of the SDK * @return the updated receipt.\n */\n async encryptCompressAndSetReceiptDataAttachment(\n receipt: models.Receipt,\n blobType: string,\n attachment: ArrayBuffer | Uint8Array,\n deflate: boolean = false\n ): Promise<models.Receipt> {\n const raw = ua2ab(attachment)\n const realDataSize = raw.byteLength\n const { data: dataToEncrypt, algorithm: compressionAlgorithm } = deflate ? await compressData(attachment) : { data: raw, algorithm: undefined }\n\n const { encryptedData, updatedEntity } = await this.crypto.xapi.encryptDataOf(receipt, EntityWithDelegationTypeName.Receipt, dataToEncrypt, (r) =>\n this.modifyReceipt(r)\n )\n return await this.setReceiptDataAttachment(\n receipt.id!,\n blobType,\n updatedEntity?.rev ?? receipt.rev!,\n encryptedData,\n compressionAlgorithm,\n getCompressionVersion(),\n realDataSize\n )\n }\n\n /**\n * Compresses and uploads an unencrypted receipt attachment using the new data attachment endpoint.\n * Compression is attempted automatically; if the compressed result is not smaller, the original data is used.\n * @param receipt a receipt.\n * @param blobType the type of the attachment.\n * @param attachment the raw attachment data.\n * @param deflate if true, compress the attachment before uploading. Reliable decompression of compressed data requires version 26.5 of the API and all users to be using at least version 8.7.0 of the SDK * @return the updated receipt.\n */\n async setClearReceiptDataAttachment(\n receipt: models.Receipt,\n blobType: string,\n attachment: ArrayBuffer | Uint8Array,\n deflate: boolean = false\n ): Promise<models.Receipt> {\n const raw = ua2ab(attachment)\n const realDataSize = raw.byteLength\n const { data: dataToUpload, algorithm: compressionAlgorithm } = deflate ? await compressData(attachment) : { data: raw, algorithm: undefined }\n\n return await this.setReceiptDataAttachment(\n receipt.id!,\n blobType,\n receipt.rev!,\n dataToUpload,\n compressionAlgorithm,\n getCompressionVersion(),\n realDataSize\n )\n }\n\n /**\n * Gets a receipt's data attachment by blob type, decrypts it, and decompresses if needed.\n * Throws if decryption fails.\n * @param receipt a receipt.\n * @param blobType the blob type of the attachment to retrieve.\n * @param validator optionally a validator function which checks if the decryption was successful.\n * @return the decrypted (and decompressed) attachment.\n */\n async getAndDecryptReceiptDataAttachment(\n receipt: models.Receipt,\n blobType: string,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<ArrayBuffer> {\n const retrieved = await this.getAndTryDecryptReceiptDataAttachment(receipt, blobType, validator)\n if (!retrieved.wasDecrypted) throw new Error(`No valid key found to decrypt data of receipt ${receipt.id}.`)\n return retrieved.data\n }\n\n /**\n * Gets a receipt's data attachment by blob type, tries to decrypt it, and decompresses if needed.\n * @param receipt a receipt.\n * @param blobType the blob type of the attachment to retrieve.\n * @param validator optionally a validator function which checks if the decryption was successful.\n * @return an object containing:\n * - data: the decrypted (and decompressed) attachment, or the raw data if decryption failed.\n * - wasDecrypted: if the data was successfully decrypted or not.\n */\n async getAndTryDecryptReceiptDataAttachment(\n receipt: models.Receipt,\n blobType: string,\n validator: (decrypted: ArrayBuffer) => Promise<boolean> = () => Promise.resolve(true)\n ): Promise<{ data: ArrayBuffer; wasDecrypted: boolean }> {\n const compressionAlgorithm = receipt.attachmentInfos?.[blobType]?.compressionAlgorithm\n return await this.crypto.xapi.tryDecryptDataOf(\n { entity: receipt, type: EntityWithDelegationTypeName.Receipt },\n await this.getReceiptAttachmentByBlobType(receipt.id!, blobType),\n async (decrypted) => {\n try {\n const data = compressionAlgorithm ? await decompressData(decrypted, compressionAlgorithm) : decrypted\n return (await validator(data)) ? data : undefined\n } catch {\n return undefined\n }\n }\n )\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given receipt\n */\n async hasWriteAccess(receipt: models.Receipt): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: receipt, type: EntityWithDelegationTypeName.Receipt })\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, with read-only or read-write permissions.\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 * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * receipt does not have encrypted content.\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 receipt: models.Receipt,\n options: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\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, with read-only or read-write permissions.\n * @param receipt the receipt to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * receipt does not have encrypted content.\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWithMany(\n receipt: models.Receipt,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<models.Receipt> {\n return (await this.tryShareWithMany(receipt, delegates)).updatedEntityOrThrow\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, with read-only or read-write permissions.\n * @param receipt the receipt to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a\n * receipt does not have encrypted content.\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 receipt: models.Receipt,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<models.Receipt>> {\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(receipt, EntityWithDelegationTypeName.Receipt)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyReceipt(entityWithEncryptionKey) : receipt\n return this.crypto.xapi.simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.Receipt,\n },\n Object.fromEntries(\n Object.entries(delegates).map(([delegateId, options]) => [\n delegateId,\n {\n requestedPermissions: options.requestedPermissions,\n shareEncryptionKeys: options.shareEncryptionKey,\n shareOwningEntityIds: ShareMetadataBehaviour.NEVER,\n shareSecretIds: options.shareSecretIds,\n },\n ])\n ),\n (x) => this.bulkShareReceipt(x)\n )\n }\n\n /**\n * Retrieves the data owners that have access to the given receipt, along with their access levels.\n * @param entity the receipt.\n * @return an object containing a map of data owner ids to their access levels, and a flag indicating if there are unknown anonymous data owners.\n */\n getDataOwnersWithAccessTo(\n entity: models.Receipt\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.Receipt })\n }\n\n /**\n * Retrieves the encryption keys of the given receipt.\n * @param entity the receipt.\n * @return the encryption key ids.\n */\n getEncryptionKeysOf(entity: models.Receipt): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.Receipt }, undefined)\n }\n\n /**\n * Creates or updates de-anonymization metadata for the given receipt, allowing the specified delegates to\n * identify the data owners that have access to it.\n * @param entity the receipt.\n * @param delegates the data owner ids for which to create de-anonymization metadata.\n */\n createDelegationDeAnonymizationMetadata(entity: models.Receipt, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: EntityWithDelegationTypeName.Receipt }, delegates)\n }\n}\n"]}
@@ -13,6 +13,7 @@ exports.getCompressionVersion = getCompressionVersion;
13
13
  exports.compressData = compressData;
14
14
  exports.decompressData = decompressData;
15
15
  const lzma_wasm_1 = require("./lzma-wasm");
16
+ const binary_utils_1 = require("./binary-utils");
16
17
  const COMPRESSION_VERSION = '1';
17
18
  const MINIMUM_SIZE_FOR_COMPRESSION = 64;
18
19
  /** UTIs for formats that are already compressed and won't benefit from additional compression. */
@@ -68,7 +69,7 @@ function getCompressionVersion() {
68
69
  */
69
70
  function compressData(data, utis) {
70
71
  return __awaiter(this, void 0, void 0, function* () {
71
- const raw = toArrayBuffer(data);
72
+ const raw = (0, binary_utils_1.ua2ab)(data);
72
73
  if ((utis === null || utis === void 0 ? void 0 : utis.some((uti) => ALREADY_COMPRESSED_UTIS.has(uti))) || raw.byteLength < MINIMUM_SIZE_FOR_COMPRESSION) {
73
74
  return { data: raw, algorithm: undefined };
74
75
  }
@@ -90,7 +91,7 @@ function compressData(data, utis) {
90
91
  function decompressData(data, algorithm) {
91
92
  return __awaiter(this, void 0, void 0, function* () {
92
93
  if (!algorithm) {
93
- return toArrayBuffer(data);
94
+ return (0, binary_utils_1.ua2ab)(data);
94
95
  }
95
96
  if (algorithm === 'lzma2') {
96
97
  return (0, lzma_wasm_1.lzmaWasmDecompress)(data);
@@ -98,9 +99,4 @@ function decompressData(data, algorithm) {
98
99
  throw new Error(`Unsupported compression algorithm: ${algorithm}`);
99
100
  });
100
101
  }
101
- function toArrayBuffer(data) {
102
- if (data instanceof ArrayBuffer)
103
- return data;
104
- return new Uint8Array(data).buffer;
105
- }
106
102
  //# sourceMappingURL=compression-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compression-utils.js","sourceRoot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IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAA;QAC/C,IAAI,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;YAC3C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,CAAA;QACjD,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,CAAA;IAC5C,CAAC;CAAA;AAED;;;;;;;GAOG;AACH,SAAsB,cAAc,CAAC,IAA8B,EAAE,SAA6B;;QAChG,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;QAC5B,CAAC;QACD,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;YAC1B,OAAO,IAAA,8BAAkB,EAAC,IAAI,CAAC,CAAA;QACjC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,sCAAsC,SAAS,EAAE,CAAC,CAAA;IACpE,CAAC;CAAA;AAED,SAAS,aAAa,CAAC,IAA8B;IACnD,IAAI,IAAI,YAAY,WAAW;QAAE,OAAO,IAAI,CAAA;IAC5C,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,MAAqB,CAAA;AACnD,CAAC","sourcesContent":["import { lzmaWasmCompress, lzmaWasmDecompress } from './lzma-wasm'\n\nconst COMPRESSION_VERSION = '1'\nconst MINIMUM_SIZE_FOR_COMPRESSION = 64\n\n/** UTIs for formats that are already compressed and won't benefit from additional compression. */\nconst ALREADY_COMPRESSED_UTIS = new Set([\n // Images\n 'public.jpeg',\n 'public.jpeg2000',\n 'public.png',\n 'com.compuserve.gif',\n 'com.microsoft.bmp', // low entropy but compression marginal vs overhead\n // Video\n 'public.mpeg',\n 'public.mpeg4',\n 'public.mpegts',\n 'com.apple.quicktime-movie',\n // Audio\n 'public.mpeg4-audio',\n 'public.mp3',\n // Archives / compressed formats\n 'com.pkware.zip-archive',\n 'org.gnu.gnu-zip-archive',\n 'org.bzip.bzip2-archive',\n 'com.rarlab.rar-archive',\n 'com.allume.stuffit-archive',\n 'org.7-zip.7-zip-archive',\n 'public.tar-archive',\n 'org.gnu.gnu-tar-archive',\n // Legacy UTI variants (pre-v1.0.117 camelCase format)\n 'com.pkware.zipArchive',\n 'org.gnu.gnuZipArchive',\n 'org.bzip.bzip2Archive',\n 'com.rarlab.rarArchive',\n 'com.allume.stuffitArchive',\n 'org.gnu.gnuTarArchive',\n 'public.mpeg4Audio',\n 'com.apple.quicktimeMovie',\n])\n\nexport interface CompressionResult {\n data: ArrayBuffer\n algorithm: string | undefined\n}\n\n/**\n * Returns the current compression algorithms version string.\n * This version is bumped whenever the set of tried algorithms changes.\n */\nexport function getCompressionVersion(): string {\n return COMPRESSION_VERSION\n}\n\n/**\n * Attempts to compress the given data using available compression algorithms, picking the best result.\n * If any of the provided UTIs indicates the data is already in a compressed format (jpeg, png, zip, ...),\n * compression is skipped entirely.\n *\n * @param data the raw data to compress.\n * @param utis optional UTIs describing the data format; used to skip compression for already-compressed formats.\n * @returns the (possibly compressed) data and the algorithm used, or undefined if no compression was applied.\n */\nexport async function compressData(data: ArrayBuffer | Uint8Array, utis?: string[]): Promise<CompressionResult> {\n const raw = toArrayBuffer(data)\n\n if (utis?.some((uti) => ALREADY_COMPRESSED_UTIS.has(uti)) || raw.byteLength < MINIMUM_SIZE_FOR_COMPRESSION) {\n return { data: raw, algorithm: undefined }\n }\n\n const compressed = await lzmaWasmCompress(data)\n if (compressed.byteLength < raw.byteLength) {\n return { data: compressed, algorithm: 'lzma2' }\n }\n return { data: raw, algorithm: undefined }\n}\n\n/**\n * Decompresses data that was compressed using one of the supported algorithms.\n *\n * @param data the compressed data.\n * @param algorithm the compression algorithm that was used (e.g. 'lzma'). If undefined, returns the data as-is.\n * @returns the decompressed data.\n * @throws if the algorithm is not supported or decompression fails.\n */\nexport async function decompressData(data: ArrayBuffer | Uint8Array, algorithm: string | undefined): Promise<ArrayBuffer> {\n if (!algorithm) {\n return toArrayBuffer(data)\n }\n if (algorithm === 'lzma2') {\n return lzmaWasmDecompress(data)\n }\n throw new Error(`Unsupported compression algorithm: ${algorithm}`)\n}\n\nfunction toArrayBuffer(data: ArrayBuffer | Uint8Array): ArrayBuffer {\n if (data instanceof ArrayBuffer) return data\n return new Uint8Array(data).buffer as ArrayBuffer\n}\n"]}
1
+ {"version":3,"file":"compression-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/compression-utils.ts"],"names":[],"mappings":";;;;;;;;;;;AAmDA,sDAEC;AAWD,oCAYC;AAUD,wCAQC;AA9FD,2CAAkE;AAClE,iDAAsC;AAEtC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAC/B,MAAM,4BAA4B,GAAG,EAAE,CAAA;AAEvC,kGAAkG;AAClG,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC;IACtC,SAAS;IACT,aAAa;IACb,iBAAiB;IACjB,YAAY;IACZ,oBAAoB;IACpB,mBAAmB,EAAE,mDAAmD;IACxE,QAAQ;IACR,aAAa;IACb,cAAc;IACd,eAAe;IACf,2BAA2B;IAC3B,QAAQ;IACR,oBAAoB;IACpB,YAAY;IACZ,gCAAgC;IAChC,wBAAwB;IACxB,yBAAyB;IACzB,wBAAwB;IACxB,wBAAwB;IACxB,4BAA4B;IAC5B,yBAAyB;IACzB,oBAAoB;IACpB,yBAAyB;IACzB,sDAAsD;IACtD,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,2BAA2B;IAC3B,uBAAuB;IACvB,mBAAmB;IACnB,0BAA0B;CAC3B,CAAC,CAAA;AAOF;;;GAGG;AACH,SAAgB,qBAAqB;IACnC,OAAO,mBAAmB,CAAA;AAC5B,CAAC;AAED;;;;;;;;GAQG;AACH,SAAsB,YAAY,CAAC,IAA8B,EAAE,IAAe;;QAChF,MAAM,GAAG,GAAG,IAAA,oBAAK,EAAC,IAAI,CAAC,CAAA;QAEvB,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,uBAAuB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAI,GAAG,CAAC,UAAU,GAAG,4BAA4B,EAAE,CAAC;YAC3G,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,CAAA;QAC5C,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAA;QAC/C,IAAI,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;YAC3C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,CAAA;QACjD,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,CAAA;IAC5C,CAAC;CAAA;AAED;;;;;;;GAOG;AACH,SAAsB,cAAc,CAAC,IAA8B,EAAE,SAA6B;;QAChG,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,IAAA,oBAAK,EAAC,IAAI,CAAC,CAAA;QACpB,CAAC;QACD,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;YAC1B,OAAO,IAAA,8BAAkB,EAAC,IAAI,CAAC,CAAA;QACjC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,sCAAsC,SAAS,EAAE,CAAC,CAAA;IACpE,CAAC;CAAA","sourcesContent":["import { lzmaWasmCompress, lzmaWasmDecompress } from './lzma-wasm'\nimport { ua2ab } from './binary-utils'\n\nconst COMPRESSION_VERSION = '1'\nconst MINIMUM_SIZE_FOR_COMPRESSION = 64\n\n/** UTIs for formats that are already compressed and won't benefit from additional compression. */\nconst ALREADY_COMPRESSED_UTIS = new Set([\n // Images\n 'public.jpeg',\n 'public.jpeg2000',\n 'public.png',\n 'com.compuserve.gif',\n 'com.microsoft.bmp', // low entropy but compression marginal vs overhead\n // Video\n 'public.mpeg',\n 'public.mpeg4',\n 'public.mpegts',\n 'com.apple.quicktime-movie',\n // Audio\n 'public.mpeg4-audio',\n 'public.mp3',\n // Archives / compressed formats\n 'com.pkware.zip-archive',\n 'org.gnu.gnu-zip-archive',\n 'org.bzip.bzip2-archive',\n 'com.rarlab.rar-archive',\n 'com.allume.stuffit-archive',\n 'org.7-zip.7-zip-archive',\n 'public.tar-archive',\n 'org.gnu.gnu-tar-archive',\n // Legacy UTI variants (pre-v1.0.117 camelCase format)\n 'com.pkware.zipArchive',\n 'org.gnu.gnuZipArchive',\n 'org.bzip.bzip2Archive',\n 'com.rarlab.rarArchive',\n 'com.allume.stuffitArchive',\n 'org.gnu.gnuTarArchive',\n 'public.mpeg4Audio',\n 'com.apple.quicktimeMovie',\n])\n\nexport interface CompressionResult {\n data: ArrayBuffer\n algorithm: string | undefined\n}\n\n/**\n * Returns the current compression algorithms version string.\n * This version is bumped whenever the set of tried algorithms changes.\n */\nexport function getCompressionVersion(): string {\n return COMPRESSION_VERSION\n}\n\n/**\n * Attempts to compress the given data using available compression algorithms, picking the best result.\n * If any of the provided UTIs indicates the data is already in a compressed format (jpeg, png, zip, ...),\n * compression is skipped entirely.\n *\n * @param data the raw data to compress.\n * @param utis optional UTIs describing the data format; used to skip compression for already-compressed formats.\n * @returns the (possibly compressed) data and the algorithm used, or undefined if no compression was applied.\n */\nexport async function compressData(data: ArrayBuffer | Uint8Array, utis?: string[]): Promise<CompressionResult> {\n const raw = ua2ab(data)\n\n if (utis?.some((uti) => ALREADY_COMPRESSED_UTIS.has(uti)) || raw.byteLength < MINIMUM_SIZE_FOR_COMPRESSION) {\n return { data: raw, algorithm: undefined }\n }\n\n const compressed = await lzmaWasmCompress(data)\n if (compressed.byteLength < raw.byteLength) {\n return { data: compressed, algorithm: 'lzma2' }\n }\n return { data: raw, algorithm: undefined }\n}\n\n/**\n * Decompresses data that was compressed using one of the supported algorithms.\n *\n * @param data the compressed data.\n * @param algorithm the compression algorithm that was used (e.g. 'lzma'). If undefined, returns the data as-is.\n * @returns the decompressed data.\n * @throws if the algorithm is not supported or decompression fails.\n */\nexport async function decompressData(data: ArrayBuffer | Uint8Array, algorithm: string | undefined): Promise<ArrayBuffer> {\n if (!algorithm) {\n return ua2ab(data)\n }\n if (algorithm === 'lzma2') {\n return lzmaWasmDecompress(data)\n }\n throw new Error(`Unsupported compression algorithm: ${algorithm}`)\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icure/api",
3
- "version": "8.9.0",
3
+ "version": "8.9.1",
4
4
  "description": "Typescript version of iCure standalone API client",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",