@icure/api 8.7.0 → 8.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/icc-api/api/IccDocumentApi.d.ts +1 -1
- package/icc-api/api/IccDocumentApi.js +1 -1
- package/icc-api/api/IccDocumentApi.js.map +1 -1
- package/icc-x-api/utils/collection-utils.js +12 -2
- package/icc-x-api/utils/collection-utils.js.map +1 -1
- package/icc-x-api/utils/formatting-util.d.ts +4 -1
- package/icc-x-api/utils/formatting-util.js +133 -9
- package/icc-x-api/utils/formatting-util.js.map +1 -1
- package/package.json +1 -1
|
@@ -157,7 +157,7 @@ export declare class IccDocumentApi {
|
|
|
157
157
|
* overrides existing values.
|
|
158
158
|
* @param dataIsEncrypted set this to true if the body you provided is containing encrypted data. This helps to have the appropriate content type
|
|
159
159
|
* for the attachment. Defaults is false
|
|
160
|
-
* @param compressionAlgorithm the client-side compression algorithm used on the data, if any (e.g. '
|
|
160
|
+
* @param compressionAlgorithm the client-side compression algorithm used on the data, if any (e.g. 'lzma2'). Null/undefined if no compression was applied.
|
|
161
161
|
* @param triedCompressionAlgorithmsVersion a version string indicating which compression algorithms were tried by the SDK, used to decide whether
|
|
162
162
|
* re-compression with newer algorithms should be attempted on read.
|
|
163
163
|
* @param realDataSize the size in bytes of the original data before compression and encryption, used for informational purposes.
|
|
@@ -365,7 +365,7 @@ class IccDocumentApi {
|
|
|
365
365
|
* overrides existing values.
|
|
366
366
|
* @param dataIsEncrypted set this to true if the body you provided is containing encrypted data. This helps to have the appropriate content type
|
|
367
367
|
* for the attachment. Defaults is false
|
|
368
|
-
* @param compressionAlgorithm the client-side compression algorithm used on the data, if any (e.g. '
|
|
368
|
+
* @param compressionAlgorithm the client-side compression algorithm used on the data, if any (e.g. 'lzma2'). Null/undefined if no compression was applied.
|
|
369
369
|
* @param triedCompressionAlgorithmsVersion a version string indicating which compression algorithms were tried by the SDK, used to decide whether
|
|
370
370
|
* re-compression with newer algorithms should be attempted on read.
|
|
371
371
|
* @param realDataSize the size in bytes of the original data before compression and encryption, used for informational purposes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IccDocumentApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccDocumentApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,+BAA2B;AAC3B,0DAAsD;AACtD,gDAA4C;AAE5C,kDAA8C;AAC9C,wFAA8G;AAC9G,qDAAiD;AAEjD,mFAA+E;AAE/E,0EAAsE;AAItE,MAAa,cAAc;IAMzB,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,CAAA;QAChH,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAED,UAAU,CAAC,CAAoB;QAC7B,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAA;IACnB,CAAC;IAED,WAAW,CAAC,CAAe;QACzB,MAAM,CAAC,CAAA;IACT,CAAC;IAED;;;;OAIG;IACG,cAAc,CAAC,IAAe;;YAClC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,WAAW,GAAG,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC,OA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C;iBACvL,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAE,GAAG,CAAC,IAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;iBAClK,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;QAC1C,CAAC;KAAA;CACF;AAjkBD,wCAikBC","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 { Document } from '../model/Document'\nimport { IcureStub } from '../model/IcureStub'\nimport { ListOfIds } from '../model/ListOfIds'\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 { BulkShareOrUpdateMetadataParams } from '../model/requests/BulkShareOrUpdateMetadataParams'\nimport { PaginatedListDocument } from '../model/PaginatedListDocument'\nimport { AbstractFilterDocument } from '../model/AbstractFilterDocument'\nimport { TimingInfo } from '../model/TimingInfo'\n\nexport class IccDocumentApi {\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 * Creates a document and returns an instance of created document afterward\n * @summary Create a document\n * @param body\n */\n async createDocument(body?: Document): Promise<Document> {\n const _url = this.host + `/document` + '?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 Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Deletes a document's attachment and returns the modified document instance afterward\n * @summary Delete a document's attachment\n * @param documentId\n */\n async deleteAttachment(documentId: string): Promise<Document> {\n let _body = null\n\n const _url = this.host + `/document/${encodeURIComponent(String(documentId))}/attachment` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('DELETE', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a batch of documents and returns the list of deleted document ids.\n *\n * @param documentIds a ListOfIds containing the ids of the documents to delete.\n * @return a Promise that will resolve in an array of DocIdentifier of the successfully deleted documents.\n */\n async deleteDocuments(documentIds: 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 + `/document/delete/batch` + '?ts=' + new Date().getTime(),\n headers,\n documentIds,\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 document by id.\n *\n * @param documentId the id of the document to delete.\n * @return a DocIdentifier of the document.\n */\n async deleteDocument(documentId: string): Promise<DocIdentifier> {\n return XHR.sendCommand(\n 'DELETE',\n this.host + `/document/${encodeURIComponent(documentId)}` + '?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 * @summary Purges a single document, also purging any attachment linked to it.\n *\n * @param document the document to purge.\n * @return a DocIdentifier of the document.\n */\n async purgeDocument(document: Document): Promise<DocIdentifier> {\n if (document.id == null || document.rev == null) {\n throw new Error('Cannot purge document with null id or rev')\n }\n return XHR.sendCommand(\n 'DELETE',\n this.host + `/document/purge/${encodeURIComponent(document.id)}?ts=${new Date().getTime()}&rev=${encodeURIComponent(document.rev)}`,\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 * Keys must be delimited by coma\n * @deprecated use {@link findDocumentIdsByDataOwnerSecretForeignKey} instead.\n * @summary List documents found By type, By Healthcare Party and secret foreign keys.\n * @param documentTypeCode\n * @param hcPartyId\n * @param secretFKeys\n */\n async findByTypeHCPartyMessageSecretFKeys(documentTypeCode: string, hcPartyId: string, secretFKeys: string[]): Promise<Array<Document>> {\n const body = new ListOfIds({ ids: secretFKeys })\n const _url =\n this.host +\n `/document/byHcPartySecretForeignKeys` +\n '?ts=' +\n new Date().getTime() +\n (documentTypeCode ? '&documentTypeCode=' + encodeURIComponent(String(documentTypeCode)) : '') +\n (hcPartyId ? '&hcPartyId=' + encodeURIComponent(String(hcPartyId)) : '')\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) => (doc.body as Array<JSON>).map((it) => new Document(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Keys must be delimited by commas.\n * @deprecated use {@link findDocumentIdsByDataOwnerSecretForeignKey} instead.\n * @summary List documents found By Healthcare Party and secret foreign keys.\n * @param hcPartyId\n * @param secretFKeys\n */\n async findDocumentsByHCPartyPatientForeignKeys(hcPartyId: string, secretFKeys: string[]): Promise<Array<Document>> {\n const body = new ListOfIds({ ids: secretFKeys })\n const _url =\n this.host +\n `/document/byHcPartySecretForeignKeys` +\n '?ts=' +\n new Date().getTime() +\n (hcPartyId ? '&hcPartyId=' + encodeURIComponent(String(hcPartyId)) : '')\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) => (doc.body as Array<JSON>).map((it) => new Document(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary List documents found By Healthcare Party and a single secret foreign key with pagination.\n * @deprecated use {@link findDocumentIdsByDataOwnerSecretForeignKey} instead.\n * @param hcPartyId the healthcare party id.\n * @param secretFKey the secret foreign key.\n * @param startKey the startKey provided by the previous page or undefined for the first page.\n * @param startDocumentId the startDocumentId provided by the previous page or undefined for the first page.\n * @param limit the number of elements that the page should contain.\n * @return a promise that will resolve in a PaginatedListDocument.\n */\n async findDocumentsByHCPartyPatientForeignKey(\n hcPartyId: string,\n secretFKey: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): Promise<PaginatedListDocument> {\n const _url =\n this.host +\n `/document/byHcPartySecretForeignKey?ts=${new Date().getTime()}` +\n `&hcPartyId=${encodeURIComponent(hcPartyId)}` +\n `&secretFKey=${encodeURIComponent(secretFKey)}` +\n (!!startKey ? `&startKey=${encodeURIComponent(startKey)}` : '') +\n (!!startDocumentId ? `&startDocumentId=${encodeURIComponent(startDocumentId)}` : '') +\n (!!limit ? `&limit=${limit}` : '')\n const headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListDocument(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n async findDocumentIdsByDataOwnerSecretForeignKey(\n dataOwnerId: string,\n secretForeignKeys: string[],\n startDate?: number,\n endDate?: number,\n descending?: boolean\n ): Promise<string[]> {\n const _url =\n this.host +\n `/document/byDataOwnerPatientCreated?ts=${new Date().getTime()}` +\n `&dataOwnerId=${encodeURIComponent(dataOwnerId)}` +\n (!!startDate ? `&startDate=${encodeURIComponent(startDate)}` : '') +\n (!!endDate ? `&endDate=${encodeURIComponent(endDate)}` : '') +\n (!!descending ? `&descending=${descending}` : '')\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, { ids: secretForeignKeys }, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => JSON.parse(JSON.stringify(it))))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Keys must be delimited by commas.\n * @summary List documents with no delegation\n * @param limit\n */\n async findWithoutDelegation(limit?: number): Promise<Array<Document>> {\n let _body = null\n\n const _url = this.host + `/document/woDelegation` + '?ts=' + new Date().getTime() + (limit ? '&limit=' + encodeURIComponent(String(limit)) : '')\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 Document(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns the document corresponding to the identifier passed in the request\n * @summary Get a document\n * @param documentId\n */\n async getDocument(documentId: string): Promise<Document> {\n let _body = null\n\n const _url = this.host + `/document/${encodeURIComponent(String(documentId))}` + '?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 Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @deprecated use getMainDocumentAttachment instead\n */\n async getDocumentAttachment(documentId: string, attachmentId: string, enckeys?: string, fileName?: string): Promise<ArrayBuffer> {\n if (enckeys) {\n throw new Error('Server-side encryption of attachment is not allowed anymore')\n }\n return this.getMainDocumentAttachment(documentId)\n }\n\n /**\n * Get the main attachment of a document\n * @param documentId id of the document\n * @return the content of the main attachment for the document (if any)\n */\n async getMainDocumentAttachment(documentId: string): Promise<ArrayBuffer> {\n let _body = null\n\n const _url = this.host + `/document/${encodeURIComponent(String(documentId))}/attachment` + '?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)\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Get the main attachment of a document forcing usage of `application/octet-stream` in Content-Type\n * @param documentId id of the document\n * @return the content of the main attachment for the document (if any)\n */\n async getRawMainDocumentAttachment(documentId: string): Promise<ArrayBuffer> {\n let _body = null\n\n const _url = this.host + `/document/${encodeURIComponent(String(documentId))}/attachment` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, 'application/octet-stream', this.authenticationProvider.getAuthService())\n .then((doc) => doc.body)\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns the first document corresponding to the externalUuid passed in the request\n * @summary Get a document\n * @param externalUuid\n */\n async getDocumentByExternalUuid(externalUuid: string): Promise<Document> {\n let _body = null\n\n const _url = this.host + `/document/externaluuid/${encodeURIComponent(String(externalUuid))}` + '?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 Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of document corresponding to the identifiers passed in the body\n * @summary Get a batch of document\n * @param body\n */\n async getDocuments(body?: ListOfIds): Promise<Array<Document>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/document/byIds` + '?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) => (doc.body as Array<JSON>).map((it) => new Document(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of document corresponding to the externalUuid passed in the request\n * @summary Get all documents with externalUuid\n * @param externalUuid\n */\n async getDocumentsByExternalUuid(externalUuid: string): Promise<Array<Document>> {\n let _body = null\n\n const _url = this.host + `/document/externaluuid/${encodeURIComponent(String(externalUuid))}/all` + '?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 Document(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Updates the document and returns an instance of the modified document afterward\n * @summary Update a document\n * @param body\n */\n async modifyDocument(body?: Document): Promise<Document> {\n let _body = null\n _body = body\n\n const _url = this.host + `/document` + '?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 Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns the modified documents.\n * @summary Update a batch of documents\n * @param body\n */\n async modifyDocuments(body?: Array<Document>): Promise<Array<Document>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/document/batch` + '?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) => (doc.body as Array<JSON>).map((it) => new Document(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Creates or updates a main attachment for a document and returns the modified document instance afterward\n * @param documentId id of the document\n * @param documentRev revision of the document\n * @param body content of the attachment (must be compatible with XHR body)\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 dataIsEncrypted set this to true if the body you provided is containing encrypted data. This helps to have the appropriate content type\n * for the attachment. Defaults is false\n * @param compressionAlgorithm the client-side compression algorithm used on the data, if any (e.g. 'lzma'). Null/undefined if no compression was applied.\n * @param triedCompressionAlgorithmsVersion a version string indicating which compression algorithms were tried by the SDK, used to decide whether\n * re-compression with newer algorithms should be attempted on read.\n * @param realDataSize the size in bytes of the original data before compression and encryption, used for informational purposes.\n */\n async setMainDocumentAttachment(\n documentId: string,\n documentRev: string,\n body: Object,\n utis?: Array<string>,\n dataIsEncrypted?: boolean,\n compressionAlgorithm?: string,\n triedCompressionAlgorithmsVersion?: string,\n realDataSize?: number\n ): Promise<Document> {\n if (!documentRev) throw new Error('Document rev is required')\n let _body = body\n\n const _url =\n this.host +\n `/document/${encodeURIComponent(String(documentId))}/attachment` +\n '?ts=' +\n new Date().getTime() +\n '&rev=' +\n encodeURIComponent(String(documentRev)) +\n (utis ? utis.map((x) => '&utis=' + encodeURIComponent(String(x))).join('') : '') +\n (dataIsEncrypted ? '&encrypted=' + encodeURIComponent(String(dataIsEncrypted)) : '') +\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.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 Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @deprecated use setMainDocumentAttachment instead\n */\n setDocumentAttachmentBody(documentId: string, documentRev: string, enckeys?: null, body?: Object, utis?: string[]): Promise<Document> {\n if (enckeys) {\n throw new Error('Server-side encryption of attachment is not allowed anymore')\n }\n if (!body) {\n throw new Error('body is now required.')\n }\n return this.setMainDocumentAttachment(documentId, documentRev, body, utis)\n }\n\n /**\n * @deprecated use setMainDocumentAttachment instead\n */\n setDocumentAttachment(documentId: string, documentRev: string, enckeys?: null, body?: Object, utis?: string[]): Promise<Document> {\n if (enckeys) {\n throw new Error('Server-side encryption of attachment is not allowed anymore')\n }\n if (!body) {\n throw new Error('body is now required.')\n }\n return this.setMainDocumentAttachment(documentId, documentRev, body, utis)\n }\n\n /**\n * @deprecated use setMainDocumentAttachment instead\n */\n setDocumentAttachmentMulti(attachment: ArrayBuffer, documentRev: string, documentId: string, enckeys?: null): Promise<Document> {\n if (enckeys) {\n throw new Error('Server-side encryption of attachment is not allowed anymore')\n }\n return this.setMainDocumentAttachment(documentId, documentRev, attachment)\n }\n\n /**\n * Creates or updates a secondary attachment for a document and returns the modified document instance afterward\n * @summary Creates or modifies a secondary attachment for a document\n * @param documentId id of the document to update\n * @param key Key of the secondary attachment to update\n * @param rev Revision of the latest known version of the document. If the revision does not match the current version of the document the method\n * will fail with CONFLICT status\n * @param attachment\n * @param utis an array of UTIs for the attachment. If provided and non-empty overrides existing values.\n * @param dataIsEncrypted set this to true if the body you provided is containing encrypted data. This helps to have the appropriate content type\n * for the attachment. Defaults is false\n * @param compressionAlgorithm the client-side compression algorithm used on the data, if any (e.g. 'lzma'). Null/undefined if no compression was applied.\n * @param triedCompressionAlgorithmsVersion a version string indicating which compression algorithms were tried by the SDK, used to decide whether\n * re-compression with newer algorithms should be attempted on read.\n * @param realDataSize the size in bytes of the original data before compression and encryption, used for informational purposes.\n * @return the updated document\n */\n async setSecondaryAttachment(\n documentId: string,\n key: string,\n rev: string,\n attachment: Object,\n utis?: Array<string>,\n dataIsEncrypted?: boolean,\n compressionAlgorithm?: string,\n triedCompressionAlgorithmsVersion?: string,\n realDataSize?: number\n ): Promise<Document> {\n const _url =\n this.host +\n `/document/` +\n encodeURIComponent(String(documentId)) +\n '/secondaryAttachments/' +\n encodeURIComponent(String(key)) +\n '?ts=' +\n new Date().getTime() +\n (rev ? '&rev=' + encodeURIComponent(String(rev)) : '') +\n (utis ? utis.map((x) => '&utis=' + encodeURIComponent(String(x))).join('') : '') +\n (dataIsEncrypted ? '&encrypted=' + encodeURIComponent(String(dataIsEncrypted)) : '') +\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.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/octet-stream'))\n return XHR.sendCommand('PUT', _url, headers, attachment, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Get the secondary attachment with the provided key for a document\n * @summary Retrieve a secondary attachment of a document\n * @param documentId id of the document\n * @param key Key of the secondary attachment to retrieve\n * @param fileName\n * @return the content of the attachment\n */\n async getSecondaryAttachment(documentId: string, key: string, fileName?: string): Promise<ArrayBuffer> {\n let _body = null\n\n const _url =\n this.host +\n `/document/${encodeURIComponent(String(documentId))}/secondaryAttachments/${encodeURIComponent(String(key))}` +\n '?ts=' +\n new Date().getTime() +\n (fileName ? '&fileName=' + encodeURIComponent(String(fileName)) : '')\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 * Deletes a document's attachment and returns the modified document instance afterward\n * @summary Delete a document's attachment\n * @param documentId id of the document\n * @param key Key of the secondary attachment to delete\n * @param rev Revision of the latest known version of the document. If the revision does not match the current version of the document the method will fail with CONFLICT status\n * @return the updated document\n */\n async deleteSecondaryAttachment(documentId: string, key: string, rev: string): Promise<Document> {\n let _body = null\n\n const _url =\n this.host +\n `/document/${encodeURIComponent(String(documentId))}/secondaryAttachments/${encodeURIComponent(String(key))}` +\n '?ts=' +\n new Date().getTime() +\n (rev ? '&rev=' + encodeURIComponent(String(rev)) : '')\n let headers = await this.headers\n return XHR.sendCommand('DELETE', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n // TODO single request multi-attachment update\n\n /**\n * @internal this method is for internal use only and may be changed without notice\n */\n async bulkShareDocument(request: BulkShareOrUpdateMetadataParams): Promise<EntityBulkShareResult<Document>[]> {\n const _url = this.host + '/document/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<Document>(x, Document)))\n .catch((err) => this.handleError(err))\n }\n\n matchDocumentsBy(body?: AbstractFilterDocument, collectTiming?: false): Promise<Array<string>>\n matchDocumentsBy(body?: AbstractFilterDocument, collectTiming?: true): Promise<Array<string> & TimingInfo>\n async matchDocumentsBy(body?: AbstractFilterDocument, collectTiming: boolean = false): Promise<Array<string>> {\n const _url = this.host + `/document/match` + '?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(), undefined, false, collectTiming ? ['x-filter-timing-*'] : [])\n .then((doc) => Object.assign((doc.body as Array<JSON>).map((it) => JSON.parse(JSON.stringify(it))), collectTiming ? { responseHeaders: doc.responseHeaders } : {}))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IccDocumentApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccDocumentApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,+BAA2B;AAC3B,0DAAsD;AACtD,gDAA4C;AAE5C,kDAA8C;AAC9C,wFAA8G;AAC9G,qDAAiD;AAEjD,mFAA+E;AAE/E,0EAAsE;AAItE,MAAa,cAAc;IAMzB,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;QAC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C,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,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;iBACvL,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAE,GAAG,CAAC,IAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;iBAClK,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;QAC1C,CAAC;KAAA;CACF;AAjkBD,wCAikBC","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 { Document } from '../model/Document'\nimport { IcureStub } from '../model/IcureStub'\nimport { ListOfIds } from '../model/ListOfIds'\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 { BulkShareOrUpdateMetadataParams } from '../model/requests/BulkShareOrUpdateMetadataParams'\nimport { PaginatedListDocument } from '../model/PaginatedListDocument'\nimport { AbstractFilterDocument } from '../model/AbstractFilterDocument'\nimport { TimingInfo } from '../model/TimingInfo'\n\nexport class IccDocumentApi {\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 * Creates a document and returns an instance of created document afterward\n * @summary Create a document\n * @param body\n */\n async createDocument(body?: Document): Promise<Document> {\n const _url = this.host + `/document` + '?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 Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Deletes a document's attachment and returns the modified document instance afterward\n * @summary Delete a document's attachment\n * @param documentId\n */\n async deleteAttachment(documentId: string): Promise<Document> {\n let _body = null\n\n const _url = this.host + `/document/${encodeURIComponent(String(documentId))}/attachment` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('DELETE', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Deletes a batch of documents and returns the list of deleted document ids.\n *\n * @param documentIds a ListOfIds containing the ids of the documents to delete.\n * @return a Promise that will resolve in an array of DocIdentifier of the successfully deleted documents.\n */\n async deleteDocuments(documentIds: 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 + `/document/delete/batch` + '?ts=' + new Date().getTime(),\n headers,\n documentIds,\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 document by id.\n *\n * @param documentId the id of the document to delete.\n * @return a DocIdentifier of the document.\n */\n async deleteDocument(documentId: string): Promise<DocIdentifier> {\n return XHR.sendCommand(\n 'DELETE',\n this.host + `/document/${encodeURIComponent(documentId)}` + '?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 * @summary Purges a single document, also purging any attachment linked to it.\n *\n * @param document the document to purge.\n * @return a DocIdentifier of the document.\n */\n async purgeDocument(document: Document): Promise<DocIdentifier> {\n if (document.id == null || document.rev == null) {\n throw new Error('Cannot purge document with null id or rev')\n }\n return XHR.sendCommand(\n 'DELETE',\n this.host + `/document/purge/${encodeURIComponent(document.id)}?ts=${new Date().getTime()}&rev=${encodeURIComponent(document.rev)}`,\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 * Keys must be delimited by coma\n * @deprecated use {@link findDocumentIdsByDataOwnerSecretForeignKey} instead.\n * @summary List documents found By type, By Healthcare Party and secret foreign keys.\n * @param documentTypeCode\n * @param hcPartyId\n * @param secretFKeys\n */\n async findByTypeHCPartyMessageSecretFKeys(documentTypeCode: string, hcPartyId: string, secretFKeys: string[]): Promise<Array<Document>> {\n const body = new ListOfIds({ ids: secretFKeys })\n const _url =\n this.host +\n `/document/byHcPartySecretForeignKeys` +\n '?ts=' +\n new Date().getTime() +\n (documentTypeCode ? '&documentTypeCode=' + encodeURIComponent(String(documentTypeCode)) : '') +\n (hcPartyId ? '&hcPartyId=' + encodeURIComponent(String(hcPartyId)) : '')\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) => (doc.body as Array<JSON>).map((it) => new Document(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Keys must be delimited by commas.\n * @deprecated use {@link findDocumentIdsByDataOwnerSecretForeignKey} instead.\n * @summary List documents found By Healthcare Party and secret foreign keys.\n * @param hcPartyId\n * @param secretFKeys\n */\n async findDocumentsByHCPartyPatientForeignKeys(hcPartyId: string, secretFKeys: string[]): Promise<Array<Document>> {\n const body = new ListOfIds({ ids: secretFKeys })\n const _url =\n this.host +\n `/document/byHcPartySecretForeignKeys` +\n '?ts=' +\n new Date().getTime() +\n (hcPartyId ? '&hcPartyId=' + encodeURIComponent(String(hcPartyId)) : '')\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) => (doc.body as Array<JSON>).map((it) => new Document(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary List documents found By Healthcare Party and a single secret foreign key with pagination.\n * @deprecated use {@link findDocumentIdsByDataOwnerSecretForeignKey} instead.\n * @param hcPartyId the healthcare party id.\n * @param secretFKey the secret foreign key.\n * @param startKey the startKey provided by the previous page or undefined for the first page.\n * @param startDocumentId the startDocumentId provided by the previous page or undefined for the first page.\n * @param limit the number of elements that the page should contain.\n * @return a promise that will resolve in a PaginatedListDocument.\n */\n async findDocumentsByHCPartyPatientForeignKey(\n hcPartyId: string,\n secretFKey: string,\n startKey?: string,\n startDocumentId?: string,\n limit?: number\n ): Promise<PaginatedListDocument> {\n const _url =\n this.host +\n `/document/byHcPartySecretForeignKey?ts=${new Date().getTime()}` +\n `&hcPartyId=${encodeURIComponent(hcPartyId)}` +\n `&secretFKey=${encodeURIComponent(secretFKey)}` +\n (!!startKey ? `&startKey=${encodeURIComponent(startKey)}` : '') +\n (!!startDocumentId ? `&startDocumentId=${encodeURIComponent(startDocumentId)}` : '') +\n (!!limit ? `&limit=${limit}` : '')\n const headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListDocument(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n async findDocumentIdsByDataOwnerSecretForeignKey(\n dataOwnerId: string,\n secretForeignKeys: string[],\n startDate?: number,\n endDate?: number,\n descending?: boolean\n ): Promise<string[]> {\n const _url =\n this.host +\n `/document/byDataOwnerPatientCreated?ts=${new Date().getTime()}` +\n `&dataOwnerId=${encodeURIComponent(dataOwnerId)}` +\n (!!startDate ? `&startDate=${encodeURIComponent(startDate)}` : '') +\n (!!endDate ? `&endDate=${encodeURIComponent(endDate)}` : '') +\n (!!descending ? `&descending=${descending}` : '')\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, { ids: secretForeignKeys }, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => (doc.body as Array<JSON>).map((it) => JSON.parse(JSON.stringify(it))))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Keys must be delimited by commas.\n * @summary List documents with no delegation\n * @param limit\n */\n async findWithoutDelegation(limit?: number): Promise<Array<Document>> {\n let _body = null\n\n const _url = this.host + `/document/woDelegation` + '?ts=' + new Date().getTime() + (limit ? '&limit=' + encodeURIComponent(String(limit)) : '')\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 Document(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns the document corresponding to the identifier passed in the request\n * @summary Get a document\n * @param documentId\n */\n async getDocument(documentId: string): Promise<Document> {\n let _body = null\n\n const _url = this.host + `/document/${encodeURIComponent(String(documentId))}` + '?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 Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @deprecated use getMainDocumentAttachment instead\n */\n async getDocumentAttachment(documentId: string, attachmentId: string, enckeys?: string, fileName?: string): Promise<ArrayBuffer> {\n if (enckeys) {\n throw new Error('Server-side encryption of attachment is not allowed anymore')\n }\n return this.getMainDocumentAttachment(documentId)\n }\n\n /**\n * Get the main attachment of a document\n * @param documentId id of the document\n * @return the content of the main attachment for the document (if any)\n */\n async getMainDocumentAttachment(documentId: string): Promise<ArrayBuffer> {\n let _body = null\n\n const _url = this.host + `/document/${encodeURIComponent(String(documentId))}/attachment` + '?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)\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Get the main attachment of a document forcing usage of `application/octet-stream` in Content-Type\n * @param documentId id of the document\n * @return the content of the main attachment for the document (if any)\n */\n async getRawMainDocumentAttachment(documentId: string): Promise<ArrayBuffer> {\n let _body = null\n\n const _url = this.host + `/document/${encodeURIComponent(String(documentId))}/attachment` + '?ts=' + new Date().getTime()\n let headers = await this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, 'application/octet-stream', this.authenticationProvider.getAuthService())\n .then((doc) => doc.body)\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns the first document corresponding to the externalUuid passed in the request\n * @summary Get a document\n * @param externalUuid\n */\n async getDocumentByExternalUuid(externalUuid: string): Promise<Document> {\n let _body = null\n\n const _url = this.host + `/document/externaluuid/${encodeURIComponent(String(externalUuid))}` + '?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 Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of document corresponding to the identifiers passed in the body\n * @summary Get a batch of document\n * @param body\n */\n async getDocuments(body?: ListOfIds): Promise<Array<Document>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/document/byIds` + '?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) => (doc.body as Array<JSON>).map((it) => new Document(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of document corresponding to the externalUuid passed in the request\n * @summary Get all documents with externalUuid\n * @param externalUuid\n */\n async getDocumentsByExternalUuid(externalUuid: string): Promise<Array<Document>> {\n let _body = null\n\n const _url = this.host + `/document/externaluuid/${encodeURIComponent(String(externalUuid))}/all` + '?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 Document(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Updates the document and returns an instance of the modified document afterward\n * @summary Update a document\n * @param body\n */\n async modifyDocument(body?: Document): Promise<Document> {\n let _body = null\n _body = body\n\n const _url = this.host + `/document` + '?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 Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns the modified documents.\n * @summary Update a batch of documents\n * @param body\n */\n async modifyDocuments(body?: Array<Document>): Promise<Array<Document>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/document/batch` + '?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) => (doc.body as Array<JSON>).map((it) => new Document(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Creates or updates a main attachment for a document and returns the modified document instance afterward\n * @param documentId id of the document\n * @param documentRev revision of the document\n * @param body content of the attachment (must be compatible with XHR body)\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 dataIsEncrypted set this to true if the body you provided is containing encrypted data. This helps to have the appropriate content type\n * for the attachment. Defaults is false\n * @param compressionAlgorithm the client-side compression algorithm used on the data, if any (e.g. 'lzma2'). Null/undefined if no compression was applied.\n * @param triedCompressionAlgorithmsVersion a version string indicating which compression algorithms were tried by the SDK, used to decide whether\n * re-compression with newer algorithms should be attempted on read.\n * @param realDataSize the size in bytes of the original data before compression and encryption, used for informational purposes.\n */\n async setMainDocumentAttachment(\n documentId: string,\n documentRev: string,\n body: Object,\n utis?: Array<string>,\n dataIsEncrypted?: boolean,\n compressionAlgorithm?: string,\n triedCompressionAlgorithmsVersion?: string,\n realDataSize?: number\n ): Promise<Document> {\n if (!documentRev) throw new Error('Document rev is required')\n let _body = body\n\n const _url =\n this.host +\n `/document/${encodeURIComponent(String(documentId))}/attachment` +\n '?ts=' +\n new Date().getTime() +\n '&rev=' +\n encodeURIComponent(String(documentRev)) +\n (utis ? utis.map((x) => '&utis=' + encodeURIComponent(String(x))).join('') : '') +\n (dataIsEncrypted ? '&encrypted=' + encodeURIComponent(String(dataIsEncrypted)) : '') +\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.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 Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @deprecated use setMainDocumentAttachment instead\n */\n setDocumentAttachmentBody(documentId: string, documentRev: string, enckeys?: null, body?: Object, utis?: string[]): Promise<Document> {\n if (enckeys) {\n throw new Error('Server-side encryption of attachment is not allowed anymore')\n }\n if (!body) {\n throw new Error('body is now required.')\n }\n return this.setMainDocumentAttachment(documentId, documentRev, body, utis)\n }\n\n /**\n * @deprecated use setMainDocumentAttachment instead\n */\n setDocumentAttachment(documentId: string, documentRev: string, enckeys?: null, body?: Object, utis?: string[]): Promise<Document> {\n if (enckeys) {\n throw new Error('Server-side encryption of attachment is not allowed anymore')\n }\n if (!body) {\n throw new Error('body is now required.')\n }\n return this.setMainDocumentAttachment(documentId, documentRev, body, utis)\n }\n\n /**\n * @deprecated use setMainDocumentAttachment instead\n */\n setDocumentAttachmentMulti(attachment: ArrayBuffer, documentRev: string, documentId: string, enckeys?: null): Promise<Document> {\n if (enckeys) {\n throw new Error('Server-side encryption of attachment is not allowed anymore')\n }\n return this.setMainDocumentAttachment(documentId, documentRev, attachment)\n }\n\n /**\n * Creates or updates a secondary attachment for a document and returns the modified document instance afterward\n * @summary Creates or modifies a secondary attachment for a document\n * @param documentId id of the document to update\n * @param key Key of the secondary attachment to update\n * @param rev Revision of the latest known version of the document. If the revision does not match the current version of the document the method\n * will fail with CONFLICT status\n * @param attachment\n * @param utis an array of UTIs for the attachment. If provided and non-empty overrides existing values.\n * @param dataIsEncrypted set this to true if the body you provided is containing encrypted data. This helps to have the appropriate content type\n * for the attachment. Defaults is false\n * @param compressionAlgorithm the client-side compression algorithm used on the data, if any (e.g. 'lzma'). Null/undefined if no compression was applied.\n * @param triedCompressionAlgorithmsVersion a version string indicating which compression algorithms were tried by the SDK, used to decide whether\n * re-compression with newer algorithms should be attempted on read.\n * @param realDataSize the size in bytes of the original data before compression and encryption, used for informational purposes.\n * @return the updated document\n */\n async setSecondaryAttachment(\n documentId: string,\n key: string,\n rev: string,\n attachment: Object,\n utis?: Array<string>,\n dataIsEncrypted?: boolean,\n compressionAlgorithm?: string,\n triedCompressionAlgorithmsVersion?: string,\n realDataSize?: number\n ): Promise<Document> {\n const _url =\n this.host +\n `/document/` +\n encodeURIComponent(String(documentId)) +\n '/secondaryAttachments/' +\n encodeURIComponent(String(key)) +\n '?ts=' +\n new Date().getTime() +\n (rev ? '&rev=' + encodeURIComponent(String(rev)) : '') +\n (utis ? utis.map((x) => '&utis=' + encodeURIComponent(String(x))).join('') : '') +\n (dataIsEncrypted ? '&encrypted=' + encodeURIComponent(String(dataIsEncrypted)) : '') +\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.filter((h) => h.header !== 'Content-Type').concat(new XHR.Header('Content-Type', 'application/octet-stream'))\n return XHR.sendCommand('PUT', _url, headers, attachment, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Get the secondary attachment with the provided key for a document\n * @summary Retrieve a secondary attachment of a document\n * @param documentId id of the document\n * @param key Key of the secondary attachment to retrieve\n * @param fileName\n * @return the content of the attachment\n */\n async getSecondaryAttachment(documentId: string, key: string, fileName?: string): Promise<ArrayBuffer> {\n let _body = null\n\n const _url =\n this.host +\n `/document/${encodeURIComponent(String(documentId))}/secondaryAttachments/${encodeURIComponent(String(key))}` +\n '?ts=' +\n new Date().getTime() +\n (fileName ? '&fileName=' + encodeURIComponent(String(fileName)) : '')\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 * Deletes a document's attachment and returns the modified document instance afterward\n * @summary Delete a document's attachment\n * @param documentId id of the document\n * @param key Key of the secondary attachment to delete\n * @param rev Revision of the latest known version of the document. If the revision does not match the current version of the document the method will fail with CONFLICT status\n * @return the updated document\n */\n async deleteSecondaryAttachment(documentId: string, key: string, rev: string): Promise<Document> {\n let _body = null\n\n const _url =\n this.host +\n `/document/${encodeURIComponent(String(documentId))}/secondaryAttachments/${encodeURIComponent(String(key))}` +\n '?ts=' +\n new Date().getTime() +\n (rev ? '&rev=' + encodeURIComponent(String(rev)) : '')\n let headers = await this.headers\n return XHR.sendCommand('DELETE', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new Document(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n // TODO single request multi-attachment update\n\n /**\n * @internal this method is for internal use only and may be changed without notice\n */\n async bulkShareDocument(request: BulkShareOrUpdateMetadataParams): Promise<EntityBulkShareResult<Document>[]> {\n const _url = this.host + '/document/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<Document>(x, Document)))\n .catch((err) => this.handleError(err))\n }\n\n matchDocumentsBy(body?: AbstractFilterDocument, collectTiming?: false): Promise<Array<string>>\n matchDocumentsBy(body?: AbstractFilterDocument, collectTiming?: true): Promise<Array<string> & TimingInfo>\n async matchDocumentsBy(body?: AbstractFilterDocument, collectTiming: boolean = false): Promise<Array<string>> {\n const _url = this.host + `/document/match` + '?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(), undefined, false, collectTiming ? ['x-filter-timing-*'] : [])\n .then((doc) => Object.assign((doc.body as Array<JSON>).map((it) => JSON.parse(JSON.stringify(it))), collectTiming ? { responseHeaders: doc.responseHeaders } : {}))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
|
|
@@ -41,8 +41,18 @@ function cloneDeep(obj) {
|
|
|
41
41
|
return result;
|
|
42
42
|
}
|
|
43
43
|
if (ArrayBuffer.isView(obj)) {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
if (obj instanceof DataView) {
|
|
45
|
+
const clonedBuffer = obj.buffer.slice(obj.byteOffset, obj.byteOffset + obj.byteLength);
|
|
46
|
+
return new DataView(clonedBuffer, 0, obj.byteLength);
|
|
47
|
+
}
|
|
48
|
+
const view = obj;
|
|
49
|
+
if (typeof view.slice === 'function') {
|
|
50
|
+
return view.slice();
|
|
51
|
+
}
|
|
52
|
+
const clonedBuffer = view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength);
|
|
53
|
+
const TypedArrayCtor = view.constructor;
|
|
54
|
+
const length = typeof view.BYTES_PER_ELEMENT === 'number' && typeof view.length === 'number' ? view.length : undefined;
|
|
55
|
+
return new TypedArrayCtor(clonedBuffer, 0, length);
|
|
46
56
|
}
|
|
47
57
|
const result = Object.create(Object.getPrototypeOf(obj));
|
|
48
58
|
for (const key of Object.keys(obj)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/collection-utils.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,8BA8BC;AAKD,wBAQC;AAKD,wBAWC;AAKD,8BAGC;AAKD,kCAMC;AAKD,8BAUC;AAQD,oCAsBC;AAMD,sDAQC;AA7ID;;;GAGG;AACH,SAAgB,SAAS,CAAI,GAAM;IACjC,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAA;IAEvD,IAAI,GAAG,YAAY,IAAI;QAAE,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAiB,CAAA;IACvE,IAAI,GAAG,YAAY,MAAM;QAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAiB,CAAA;IAEnF,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAiB,CAAA;IAEjF,IAAI,GAAG,YAAY,GAAG,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,IA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AAE,OAAO,KAAK,CAAA;IAC1D,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;GAGG;AACH,SAAsB,qBAAqB,CAAI,SAAwC;;QACrF,MAAM,GAAG,GAAG,EAAE,CAAA;QACd,IAAI,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAA;QACnC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACtB,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAA;QACjC,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;CAAA","sourcesContent":["/**\n * Recursively deep clone a value. Handles primitives, arrays, plain objects, Date, RegExp, Set, Map, and typed arrays.\n * Non-cloneable values (functions, WeakMap, WeakSet, etc.) are copied by reference.\n */\nexport function cloneDeep<T>(obj: T): T {\n if (obj === null || typeof obj !== 'object') return obj\n\n if (obj instanceof Date) return new Date(obj.getTime()) as unknown as T\n if (obj instanceof RegExp) return new RegExp(obj.source, obj.flags) as unknown as T\n\n if (Array.isArray(obj)) return obj.map((item) => cloneDeep(item)) as unknown as T\n\n if (obj instanceof Set) {\n const result = new Set()\n obj.forEach((v) => result.add(cloneDeep(v)))\n return result as unknown as T\n }\n\n if (obj instanceof Map) {\n const result = new Map()\n obj.forEach((v, k) => result.set(cloneDeep(k), cloneDeep(v)))\n return result as unknown as T\n }\n\n if (ArrayBuffer.isView(obj)) {\n const TypedArrayCtor = obj.constructor as new (buffer: ArrayBuffer) => typeof obj\n return new TypedArrayCtor((obj as unknown as { buffer: ArrayBuffer }).buffer.slice(0)) as unknown as T\n }\n\n const result: any = Object.create(Object.getPrototypeOf(obj))\n for (const key of Object.keys(obj)) {\n result[key] = cloneDeep((obj as any)[key])\n }\n return result\n}\n\n/**\n * Remove duplicate elements from an array based on a key function or property name.\n */\nexport function uniqBy<T>(arr: T[], key: ((item: T) => unknown) | string): T[] {\n const seen = new Set()\n return arr.filter((item) => {\n const k = typeof key === 'string' ? (item as any)[key] : key(item)\n if (seen.has(k)) return false\n seen.add(k)\n return true\n })\n}\n\n/**\n * Sort an array by a key function. Returns a new sorted array (does not mutate the original).\n */\nexport function sortBy<T>(arr: T[], keyFn: (item: T) => string | number | boolean | null | undefined): T[] {\n return [...arr].sort((a, b) => {\n const ka = keyFn(a)\n const kb = keyFn(b)\n if (ka == null && kb == null) return 0\n if (ka == null) return -1\n if (kb == null) return 1\n if (ka < kb) return -1\n if (ka > kb) return 1\n return 0\n })\n}\n\n/**\n * Check if two sets are equals (they contain the same elements). Will not work if the content can't be compared by `==`.\n */\nexport function setEquals<T>(setA: Set<T>, setB: Set<T>): boolean {\n if (setA.size != setB.size) return false\n return Array.from(setA).every((x) => setB.has(x))\n}\n\n/**\n * Check if two arrays are equals (they contain the same elements).\n */\nexport function arrayEquals<T>(arrayA: T[], arrayB: T[]): boolean {\n if (arrayA.length != arrayB.length) return false\n for (let i = 0; i < arrayA.length; ++i) {\n if (!anyEquals(arrayA[i], arrayB[i])) return false\n }\n return true\n}\n\n/**\n * Check if two elements are equals (they contain the same elements).\n */\nexport function anyEquals(anyA: any, anyB: any): boolean {\n //Test if object is array\n if (Array.isArray(anyA) && Array.isArray(anyB)) {\n return arrayEquals(anyA, anyB)\n } /*Test if objects are set */ else if (anyA instanceof Set && anyB instanceof Set) {\n return setEquals(anyA, anyB)\n } else if (typeof anyA === 'object' && typeof anyB === 'object') {\n return objectEquals(anyA, anyB)\n }\n return anyA === anyB\n}\n\n/**\n * Check if two objects are equals (by comparing the properties in a deep way).\n * @param objectA\n * @param objectB\n * @param ignoredProperties\n */\nexport function objectEquals<T extends { [key: string]: any }>(objectA: T, objectB: T, ignoredProperties?: string[]): boolean {\n const missingInA = Object.keys(objectB)\n .filter((key) => !ignoredProperties?.includes(key))\n .filter((key) => !Object.keys(objectA).includes(key))\n .filter((key) => objectB[key] !== undefined && objectB[key] !== null)\n\n if (missingInA.length > 0) return false\n\n const missingInB = Object.keys(objectA)\n .filter((key) => !ignoredProperties?.includes(key))\n .filter((key) => !Object.keys(objectB).includes(key))\n .filter((key) => objectA[key] !== undefined && objectA[key] !== null)\n\n if (missingInB.length > 0) return false\n\n for (let i = 0, keys = Object.keys(objectA); i < keys.length; i++) {\n const key = keys[i]\n if (ignoredProperties?.includes(key)) continue\n if (!anyEquals(objectA[key], objectB[key])) return false\n }\n\n return true\n}\n\n/**\n * Fully consumes an async generator and provides all results as an array.\n * @param generator an async generator.\n */\nexport async function asyncGeneratorToArray<T>(generator: AsyncGenerator<T, any, never>): Promise<T[]> {\n const res = []\n let latest = await generator.next()\n while (!latest.done) {\n res.push(latest.value)\n latest = await generator.next()\n }\n return res\n}\n"]}
|
|
1
|
+
{"version":3,"file":"collection-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/collection-utils.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,8BAoDC;AAKD,wBAQC;AAKD,wBAWC;AAKD,8BAGC;AAKD,kCAMC;AAKD,8BAUC;AAQD,oCAsBC;AAMD,sDAQC;AAnKD;;;GAGG;AACH,SAAgB,SAAS,CAAI,GAAM;IACjC,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAA;IAEvD,IAAI,GAAG,YAAY,IAAI;QAAE,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAiB,CAAA;IACvE,IAAI,GAAG,YAAY,MAAM;QAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAiB,CAAA;IAEnF,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAiB,CAAA;IAEjF,IAAI,GAAG,YAAY,GAAG,EAAE,CAAC;QACvB,MA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map, and typed arrays.\n * Non-cloneable values (functions, WeakMap, WeakSet, etc.) are copied by reference.\n */\nexport function cloneDeep<T>(obj: T): T {\n if (obj === null || typeof obj !== 'object') return obj\n\n if (obj instanceof Date) return new Date(obj.getTime()) as unknown as T\n if (obj instanceof RegExp) return new RegExp(obj.source, obj.flags) as unknown as T\n\n if (Array.isArray(obj)) return obj.map((item) => cloneDeep(item)) as unknown as T\n\n if (obj instanceof Set) {\n const result = new Set()\n obj.forEach((v) => result.add(cloneDeep(v)))\n return result as unknown as T\n }\n\n if (obj instanceof Map) {\n const result = new Map()\n obj.forEach((v, k) => result.set(cloneDeep(k), cloneDeep(v)))\n return result as unknown as T\n }\n\n if (ArrayBuffer.isView(obj)) {\n if (obj instanceof DataView) {\n const clonedBuffer = obj.buffer.slice(obj.byteOffset, obj.byteOffset + obj.byteLength)\n return new DataView(clonedBuffer, 0, obj.byteLength) as unknown as T\n }\n\n const view = obj as unknown as {\n buffer: ArrayBuffer\n byteOffset: number\n byteLength: number\n length?: number\n BYTES_PER_ELEMENT?: number\n slice?: () => unknown\n constructor: new (buffer: ArrayBuffer, byteOffset?: number, length?: number) => unknown\n }\n\n if (typeof view.slice === 'function') {\n return view.slice() as T\n }\n\n const clonedBuffer = view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength)\n const TypedArrayCtor = view.constructor as new (buffer: ArrayBuffer, byteOffset?: number, length?: number) => typeof obj\n const length =\n typeof view.BYTES_PER_ELEMENT === 'number' && typeof view.length === 'number' ? view.length : undefined\n return new TypedArrayCtor(clonedBuffer, 0, length) as unknown as T\n }\n\n const result: any = Object.create(Object.getPrototypeOf(obj))\n for (const key of Object.keys(obj)) {\n result[key] = cloneDeep((obj as any)[key])\n }\n return result\n}\n\n/**\n * Remove duplicate elements from an array based on a key function or property name.\n */\nexport function uniqBy<T>(arr: T[], key: ((item: T) => unknown) | string): T[] {\n const seen = new Set()\n return arr.filter((item) => {\n const k = typeof key === 'string' ? (item as any)[key] : key(item)\n if (seen.has(k)) return false\n seen.add(k)\n return true\n })\n}\n\n/**\n * Sort an array by a key function. Returns a new sorted array (does not mutate the original).\n */\nexport function sortBy<T>(arr: T[], keyFn: (item: T) => string | number | boolean | null | undefined): T[] {\n return [...arr].sort((a, b) => {\n const ka = keyFn(a)\n const kb = keyFn(b)\n if (ka == null && kb == null) return 0\n if (ka == null) return -1\n if (kb == null) return 1\n if (ka < kb) return -1\n if (ka > kb) return 1\n return 0\n })\n}\n\n/**\n * Check if two sets are equals (they contain the same elements). Will not work if the content can't be compared by `==`.\n */\nexport function setEquals<T>(setA: Set<T>, setB: Set<T>): boolean {\n if (setA.size != setB.size) return false\n return Array.from(setA).every((x) => setB.has(x))\n}\n\n/**\n * Check if two arrays are equals (they contain the same elements).\n */\nexport function arrayEquals<T>(arrayA: T[], arrayB: T[]): boolean {\n if (arrayA.length != arrayB.length) return false\n for (let i = 0; i < arrayA.length; ++i) {\n if (!anyEquals(arrayA[i], arrayB[i])) return false\n }\n return true\n}\n\n/**\n * Check if two elements are equals (they contain the same elements).\n */\nexport function anyEquals(anyA: any, anyB: any): boolean {\n //Test if object is array\n if (Array.isArray(anyA) && Array.isArray(anyB)) {\n return arrayEquals(anyA, anyB)\n } /*Test if objects are set */ else if (anyA instanceof Set && anyB instanceof Set) {\n return setEquals(anyA, anyB)\n } else if (typeof anyA === 'object' && typeof anyB === 'object') {\n return objectEquals(anyA, anyB)\n }\n return anyA === anyB\n}\n\n/**\n * Check if two objects are equals (by comparing the properties in a deep way).\n * @param objectA\n * @param objectB\n * @param ignoredProperties\n */\nexport function objectEquals<T extends { [key: string]: any }>(objectA: T, objectB: T, ignoredProperties?: string[]): boolean {\n const missingInA = Object.keys(objectB)\n .filter((key) => !ignoredProperties?.includes(key))\n .filter((key) => !Object.keys(objectA).includes(key))\n .filter((key) => objectB[key] !== undefined && objectB[key] !== null)\n\n if (missingInA.length > 0) return false\n\n const missingInB = Object.keys(objectA)\n .filter((key) => !ignoredProperties?.includes(key))\n .filter((key) => !Object.keys(objectB).includes(key))\n .filter((key) => objectA[key] !== undefined && objectA[key] !== null)\n\n if (missingInB.length > 0) return false\n\n for (let i = 0, keys = Object.keys(objectA); i < keys.length; i++) {\n const key = keys[i]\n if (ignoredProperties?.includes(key)) continue\n if (!anyEquals(objectA[key], objectB[key])) return false\n }\n\n return true\n}\n\n/**\n * Fully consumes an async generator and provides all results as an array.\n * @param generator an async generator.\n */\nexport async function asyncGeneratorToArray<T>(generator: AsyncGenerator<T, any, never>): Promise<T[]> {\n const res = []\n let latest = await generator.next()\n while (!latest.done) {\n res.push(latest.value)\n latest = await generator.next()\n }\n return res\n}\n"]}
|
|
@@ -74,4 +74,7 @@ export declare function personNameAbbrev(person: {
|
|
|
74
74
|
firstName?: string;
|
|
75
75
|
lastName?: string;
|
|
76
76
|
}): string;
|
|
77
|
-
export declare function
|
|
77
|
+
export declare function momentFormatToDateFnsFormat(format: string): string;
|
|
78
|
+
export declare function toMoment(epochOrLongCalendar: number): {
|
|
79
|
+
format: (format: string) => string;
|
|
80
|
+
} | null;
|
|
@@ -19,6 +19,7 @@ exports.money = money;
|
|
|
19
19
|
exports.toUrlParams = toUrlParams;
|
|
20
20
|
exports.personName = personName;
|
|
21
21
|
exports.personNameAbbrev = personNameAbbrev;
|
|
22
|
+
exports.momentFormatToDateFnsFormat = momentFormatToDateFnsFormat;
|
|
22
23
|
exports.toMoment = toMoment;
|
|
23
24
|
const libphonenumber_js_1 = require("libphonenumber-js");
|
|
24
25
|
const date_fns_1 = require("date-fns");
|
|
@@ -201,18 +202,141 @@ function personNameAbbrev(person) {
|
|
|
201
202
|
const firstName = person.firstName ? person.firstName[0] + '.' : undefined;
|
|
202
203
|
return personName(Object.assign(Object.assign({}, person), { firstName }));
|
|
203
204
|
}
|
|
205
|
+
// Moment.js → date-fns format token mapping. Listed longest-first so the
|
|
206
|
+
// matcher consumes the longest valid moment token at each position.
|
|
207
|
+
const MOMENT_TO_DATE_FNS_TOKENS = [
|
|
208
|
+
// Year
|
|
209
|
+
['YYYY', 'yyyy'],
|
|
210
|
+
['YY', 'yy'],
|
|
211
|
+
['Y', 'y'],
|
|
212
|
+
// Month
|
|
213
|
+
['MMMM', 'MMMM'],
|
|
214
|
+
['MMM', 'MMM'],
|
|
215
|
+
['Mo', 'Mo'],
|
|
216
|
+
['MM', 'MM'],
|
|
217
|
+
['M', 'M'],
|
|
218
|
+
// Quarter
|
|
219
|
+
['Qo', 'Qo'],
|
|
220
|
+
['Q', 'Q'],
|
|
221
|
+
// Day of year (moment DDD/DDDD/DDDo → date-fns D/DDD/Do, additional tokens)
|
|
222
|
+
['DDDDo', 'Do'],
|
|
223
|
+
['DDDD', 'DDD'],
|
|
224
|
+
['DDDo', 'Do'],
|
|
225
|
+
['DDD', 'D'],
|
|
226
|
+
// Day of month
|
|
227
|
+
['Do', 'do'],
|
|
228
|
+
['DD', 'dd'],
|
|
229
|
+
['D', 'd'],
|
|
230
|
+
// Day of week
|
|
231
|
+
['dddd', 'EEEE'],
|
|
232
|
+
['ddd', 'EEE'],
|
|
233
|
+
['dd', 'EEEEEE'],
|
|
234
|
+
['do', 'eo'],
|
|
235
|
+
['d', 'e'],
|
|
236
|
+
['E', 'i'],
|
|
237
|
+
// Week of year
|
|
238
|
+
['ww', 'ww'],
|
|
239
|
+
['wo', 'wo'],
|
|
240
|
+
['w', 'w'],
|
|
241
|
+
['WW', 'II'],
|
|
242
|
+
['Wo', 'Io'],
|
|
243
|
+
['W', 'I'],
|
|
244
|
+
// Hour
|
|
245
|
+
['HH', 'HH'],
|
|
246
|
+
['H', 'H'],
|
|
247
|
+
['hh', 'hh'],
|
|
248
|
+
['h', 'h'],
|
|
249
|
+
['kk', 'kk'],
|
|
250
|
+
['k', 'k'],
|
|
251
|
+
// AM/PM
|
|
252
|
+
['A', 'a'],
|
|
253
|
+
['a', 'aaa'],
|
|
254
|
+
// Minute
|
|
255
|
+
['mm', 'mm'],
|
|
256
|
+
['m', 'm'],
|
|
257
|
+
// Second
|
|
258
|
+
['ss', 'ss'],
|
|
259
|
+
['s', 's'],
|
|
260
|
+
// Fractional seconds
|
|
261
|
+
['SSSS', 'SSSS'],
|
|
262
|
+
['SSS', 'SSS'],
|
|
263
|
+
['SS', 'SS'],
|
|
264
|
+
['S', 'S'],
|
|
265
|
+
// Timezone offset
|
|
266
|
+
['ZZ', 'xx'],
|
|
267
|
+
['Z', 'xxx'],
|
|
268
|
+
// Unix timestamp
|
|
269
|
+
['X', 't'],
|
|
270
|
+
['x', 'T'],
|
|
271
|
+
];
|
|
272
|
+
function momentFormatToDateFnsFormat(format) {
|
|
273
|
+
const parts = [];
|
|
274
|
+
let literalBuffer = '';
|
|
275
|
+
const flushLiteral = () => {
|
|
276
|
+
if (literalBuffer.length > 0) {
|
|
277
|
+
parts.push("'" + literalBuffer.replace(/'/g, "''") + "'");
|
|
278
|
+
literalBuffer = '';
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
let i = 0;
|
|
282
|
+
while (i < format.length) {
|
|
283
|
+
const c = format[i];
|
|
284
|
+
// Moment bracketed literal: [text] → date-fns 'text'
|
|
285
|
+
if (c === '[') {
|
|
286
|
+
const end = format.indexOf(']', i);
|
|
287
|
+
if (end === -1) {
|
|
288
|
+
literalBuffer += format.substring(i + 1);
|
|
289
|
+
i = format.length;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
literalBuffer += format.substring(i + 1, end);
|
|
293
|
+
i = end + 1;
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
// Match the longest moment token starting at the current position.
|
|
297
|
+
let matched;
|
|
298
|
+
for (const token of MOMENT_TO_DATE_FNS_TOKENS) {
|
|
299
|
+
if (format.startsWith(token[0], i)) {
|
|
300
|
+
matched = token;
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (matched) {
|
|
305
|
+
flushLiteral();
|
|
306
|
+
parts.push(matched[1]);
|
|
307
|
+
i += matched[0].length;
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
// Non-token character: alphabetic chars must be escaped as literals,
|
|
311
|
+
// otherwise date-fns would interpret them as its own tokens.
|
|
312
|
+
if (/[A-Za-z]/.test(c)) {
|
|
313
|
+
literalBuffer += c;
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
flushLiteral();
|
|
317
|
+
parts.push(c);
|
|
318
|
+
}
|
|
319
|
+
i++;
|
|
320
|
+
}
|
|
321
|
+
flushLiteral();
|
|
322
|
+
return parts.join('');
|
|
323
|
+
}
|
|
204
324
|
function toMoment(epochOrLongCalendar) {
|
|
205
325
|
if (!epochOrLongCalendar && epochOrLongCalendar !== 0) {
|
|
206
326
|
return null;
|
|
207
327
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
328
|
+
const parsed = (epochOrLongCalendar >= 18000101 && epochOrLongCalendar < 25400000) ?
|
|
329
|
+
(0, date_fns_1.parse)('' + epochOrLongCalendar, 'yyyyMMdd', new Date()) :
|
|
330
|
+
(epochOrLongCalendar >= 18000101000000) ?
|
|
331
|
+
(0, date_fns_1.parse)('' + epochOrLongCalendar, 'yyyyMMddHHmmss', new Date()) :
|
|
332
|
+
new Date(epochOrLongCalendar);
|
|
333
|
+
return {
|
|
334
|
+
format: (format) => {
|
|
335
|
+
return (0, date_fns_1.format)(parsed, momentFormatToDateFnsFormat(format), {
|
|
336
|
+
useAdditionalDayOfYearTokens: true,
|
|
337
|
+
useAdditionalWeekYearTokens: true,
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
};
|
|
217
341
|
}
|
|
218
342
|
//# sourceMappingURL=formatting-util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatting-util.js","sourceRoot":"","sources":["../../../icc-x-api/utils/formatting-util.ts"],"names":[],"mappings":";;;AAgBA,kCAYC;AAED,oCAMC;AAED,gCAEC;A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AE,GAAG,mBAAmB,EAAE,gBAAgB,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;IAC1E,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAA;IACtC,CAAC;AACH,CAAC","sourcesContent":["import { parseNumber, formatNumber, isValidNumber, ParsedNumber } from 'libphonenumber-js'\nimport { format as formatDate, parse as parseDate } from 'date-fns'\n\n// TODO: move this to env.js?\nconst DEFAULT_COUNTRY = 'BE'\n\nexport const nihiiRegExp = new RegExp('^(\\\\d{1})(\\\\d{5})(\\\\d{2})(\\\\d{3})$')\nexport const ssinRegExp = new RegExp('^(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{3})(\\\\d{2})$')\nexport const ibanRegExp = new RegExp('^(\\\\d{4})(\\\\d{4})(\\\\d{4})(\\\\d{4})$')\n\nconst patterns = {\n IBAN: (iban: string) => /^BE\\d{14}$/.test(iban) && isValidIBAN(iban),\n IBANBE: (iban: string) => /^BE\\d{14}$/.test(iban) && isValidIBAN(iban),\n}\n\n//http://ht5ifv.serprest.pt/extensions/tools/IBAN/\nexport function isValidIBAN(iban: string) {\n //This function check if the checksum if correct\n iban = iban.replace(/^(.{4})(.*)$/, '$2$1') //Move the first 4 chars from left to the right\n const fun = (e: string) => (e.charCodeAt(0) - 'A'.charCodeAt(0) + 10).toString()\n iban = iban.replace(/[A-Z]/g, fun) //Convert A-Z to 10-25\n let $sum = 0\n let $ei = 1 //First exponent\n for (let $i = iban.length - 1; $i >= 0; $i--) {\n $sum += $ei * parseInt(iban.charAt($i), 10) //multiply the digit by it's exponent\n $ei = ($ei * 10) % 97 //compute next base 10 exponent in modulus 97\n }\n return $sum % 97 === 1\n}\n\nexport function ibanValidate(iban: string) {\n if (iban.startsWith('BE')) {\n return patterns.IBANBE(iban)\n } else {\n return patterns.IBAN(iban)\n }\n}\n\nexport function ibanFormat(iban: string): string {\n return iban.replace(ibanRegExp, '$1 $2 $3 $4')\n}\n\nexport function nihiiFormat(nihii: string): string {\n return nihii.replace(nihiiRegExp, '$1 $2 $3 $4')\n}\n\nexport function nihiiValidate(nihii: string): boolean {\n return !!nihii.match(nihiiRegExp)\n}\n\nexport function ssinFormat(ssin: string): string {\n return ssin.replace(ssinRegExp, '$1 $2 $3 $4 $5')\n}\n\nexport function ssinValidate(ssin: string): boolean {\n return !!ssin.match(ssinRegExp)\n}\n\n/* Alternate lib free version\nexport function phoneNumberValidate(phoneNumber: string): boolean {\n return (\n !!phoneNumber.match(/(?:\\+|00)([1-9][0-9]{1-2})([- /.]*([0-9]+))+/) ||\n !!phoneNumber.match(/(0[1-9][0-9]*)([- /.]*([0-9]+))+/)\n )\n}\n\nexport function phoneNumberFormat(phoneNumber: string): string {\n let match = phoneNumber.match(/(?:\\+|00)([1-9][0-9]{1-2})([- /.]*([0-9]+))+/)\n if (match) {\n return `+${match[1]} ${match[2].replace(/[- /.]/g, \" \")}`.replace(/ /g, \" \")\n }\n match = phoneNumber.match(/0([1-9][0-9]*)([- /.]*([0-9]+))+/)\n if (match) {\n return `+32 ${match[1]} ${match[2].replace(/[- /.]/g, \" \")}`.replace(/ /g, \" \")\n }\n return phoneNumber\n}\n*/\n\nexport function phoneNumberFormat(phoneNumber: string): string {\n const parsedPhoneNumber = parseNumber(phoneNumber, DEFAULT_COUNTRY) as ParsedNumber\n if (Object.keys(parsedPhoneNumber).length === 0) {\n // The number is not valid, so we leave the input string as-is.\n return phoneNumber\n }\n return formatNumber(parsedPhoneNumber, 'INTERNATIONAL')\n}\n\n/**\n * Converts a backend date number (e.g., patient birth date) into a Date object.\n * @param dateNumber a YYYYMMDD date number from the backend\n * @return a Date object\n * @throws Error if it is impossible to create a date from the number, other if dateNumber is negative.\n * @see #dateEncode\n * @see #timeDecode\n */\nexport function dateDecode(dateNumber: number): Date | undefined {\n if (!dateNumber) {\n return undefined\n }\n\n if (dateNumber < 0) {\n throw new Error(\"We don't decode negative dates. Please make sure you have valid data.\")\n }\n const dateNumberStr: string = dateNumber.toString().padStart(8, '19700101')\n if (dateNumberStr.length > 8) {\n if (dateNumberStr.endsWith('000000')) {\n return dateNumber ? parseDate(dateNumberStr.slice(0, 8), 'yyyyMMdd', new Date()) : undefined\n }\n\n throw Error(\"Decoded date is over year 9999. We can't format it properly.\")\n }\n return dateNumber ? parseDate(dateNumberStr, 'yyyyMMdd', new Date()) : undefined\n}\n\n/**\n * Converts a backend time number (e.g., health element openingDate) into a Date object.\n * @param timeNumber a YYYYMMDD date number from the backend\n * @return a Date object\n * @see #timeEncode\n * @see #dateDecode\n */\nexport function timeDecode(timeNumber: number): Date | undefined {\n return timeNumber ? parseDate(timeNumber.toString(), 'yyyyMMddHHmmss', new Date()) : undefined\n}\n\n/**\n * Encodes a Date object into a backend date number (e.g., patient birth date).\n * @param date a Date object\n * @return a YYYYMMDD date number for the backend\n * @see #dateDecode\n * @see #timeEncode\n */\nexport function dateEncode(date: Date): number | undefined {\n const dateStr = formatDate(date, 'yyyyMMdd').padStart(8, '19700101')\n // date is null if the field is not set\n return date ? Number(dateStr) : undefined\n}\n\n/**\n * Encodes a Date object into a backend time number (e.g., health element openingDate).\n * @param date a Date object\n * @return a YYYYMMDDHHmmss date number for the backend\n * @see #timeDecode\n * @see #dateEncode\n */\nexport function timeEncode(date: Date): number | undefined {\n return date ? Number(formatDate(date, 'yyyyMMddHHmmss')) : undefined\n}\n\n/**\n * Formats a value and a physical unit into text.\n * @param value the numerical or string value to encode\n * @param unit the unit represented as a string (an empty string is also supported)\n */\nexport function unit(value: number | string, unit: string | null): string {\n unit = unit || ''\n let separator: string\n if (!unit || unit.startsWith('°')) {\n separator = ''\n } else {\n // including '%'\n separator = '\\xa0'\n }\n return value + separator + unit\n}\n\n/**\n * 0.1 + 0.2 = 0.30000000000000004. Use this function to be better at maths.\n * @param a number\n * @return the rounded number, two after the comma\n */\nexport function amount(value: number): number {\n return Number((value || 0).toFixed(2))\n}\n\n/**\n * A simple formatter to keep the logic across the app.\n * Input: 2.1 ; Output: 2.10€\n */\nexport function money(value: number): string {\n return [(value || 0).toFixed(2), '€'].join('')\n}\n\n/**\n * Transform a dictionary to a url params.\n * From { key1: value1, key2: value2, ... } returns key1=value1&key2=value2&...=...\n */\nexport function toUrlParams(params: { [key: string]: string }): string {\n return Object.entries(params)\n .map(([key, value]) => (value ? key + '=' + value : undefined))\n .filter(Boolean)\n .join('&')\n}\n\nexport function personName(person: { firstName?: string; lastName?: string }): string {\n return `${person.firstName || ''} ${person.lastName || ''}`.trim()\n}\n\nexport function personNameAbbrev(person: { firstName?: string; lastName?: string }): string {\n const firstName = person.firstName ? person.firstName[0] + '.' : undefined\n return personName({ ...person, firstName })\n}\n\nexport function toMoment(epochOrLongCalendar: number): Date | null {\n if (!epochOrLongCalendar && epochOrLongCalendar !== 0) {\n return null\n }\n if (epochOrLongCalendar >= 18000101 && epochOrLongCalendar < 25400000) {\n return parseDate('' + epochOrLongCalendar, 'yyyyMMdd', new Date())\n } else if (epochOrLongCalendar >= 18000101000000) {\n return parseDate('' + epochOrLongCalendar, 'yyyyMMddHHmmss', new Date())\n } else {\n return new Date(epochOrLongCalendar)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"formatting-util.js","sourceRoot":"","sources":["../../../icc-x-api/utils/formatting-util.ts"],"names":[],"mappings":";;;AAgBA,kCAYC;AAED,oCAMC;AAED,gCAEC;AAED,kCAEC;AAED,sCAEC;AAED,gCAEC;AAED,oCAEC;AAuBD,8CAOC;AAUD,gCAiBC;AASD,gCAEC;AASD,gCAIC;AASD,gCAEC;AAOD,oBAUC;AAOD,wBAEC;AAMD,sBAEC;AAMD,kCAKC;AAED,gCAEC;AAED,4CAGC;AAsED,kEAuDC;AAED,4BAiBC;AA1VD,yDAA2E;AAC3E,uCAAiE;AAEjE,6BAA6B;AAC7B,MAAM,eAAe,GAAG,IAAI,CAAA;AAEf,QAAA,WAAW,GAAG,IAAI,MAAM,CAAC,oCAAoC,CAAC,CAAA;AAC9D,QAAA,UAAU,GAAG,IAAI,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AI;aAClC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { parseNumber, formatNumber, ParsedNumber } from 'libphonenumber-js'\nimport {format as formatDate, parse as parseDate} from 'date-fns'\n\n// TODO: move this to env.js?\nconst DEFAULT_COUNTRY = 'BE'\n\nexport const nihiiRegExp = new RegExp('^(\\\\d{1})(\\\\d{5})(\\\\d{2})(\\\\d{3})$')\nexport const ssinRegExp = new RegExp('^(\\\\d{2})(\\\\d{2})(\\\\d{2})(\\\\d{3})(\\\\d{2})$')\nexport const ibanRegExp = new RegExp('^(\\\\d{4})(\\\\d{4})(\\\\d{4})(\\\\d{4})$')\n\nconst patterns = {\n IBAN: (iban: string) => /^BE\\d{14}$/.test(iban) && isValidIBAN(iban),\n IBANBE: (iban: string) => /^BE\\d{14}$/.test(iban) && isValidIBAN(iban),\n}\n\n//http://ht5ifv.serprest.pt/extensions/tools/IBAN/\nexport function isValidIBAN(iban: string) {\n //This function check if the checksum if correct\n iban = iban.replace(/^(.{4})(.*)$/, '$2$1') //Move the first 4 chars from left to the right\n const fun = (e: string) => (e.charCodeAt(0) - 'A'.charCodeAt(0) + 10).toString()\n iban = iban.replace(/[A-Z]/g, fun) //Convert A-Z to 10-25\n let $sum = 0\n let $ei = 1 //First exponent\n for (let $i = iban.length - 1; $i >= 0; $i--) {\n $sum += $ei * parseInt(iban.charAt($i), 10) //multiply the digit by it's exponent\n $ei = ($ei * 10) % 97 //compute next base 10 exponent in modulus 97\n }\n return $sum % 97 === 1\n}\n\nexport function ibanValidate(iban: string) {\n if (iban.startsWith('BE')) {\n return patterns.IBANBE(iban)\n } else {\n return patterns.IBAN(iban)\n }\n}\n\nexport function ibanFormat(iban: string): string {\n return iban.replace(ibanRegExp, '$1 $2 $3 $4')\n}\n\nexport function nihiiFormat(nihii: string): string {\n return nihii.replace(nihiiRegExp, '$1 $2 $3 $4')\n}\n\nexport function nihiiValidate(nihii: string): boolean {\n return !!nihii.match(nihiiRegExp)\n}\n\nexport function ssinFormat(ssin: string): string {\n return ssin.replace(ssinRegExp, '$1 $2 $3 $4 $5')\n}\n\nexport function ssinValidate(ssin: string): boolean {\n return !!ssin.match(ssinRegExp)\n}\n\n/* Alternate lib free version\nexport function phoneNumberValidate(phoneNumber: string): boolean {\n return (\n !!phoneNumber.match(/(?:\\+|00)([1-9][0-9]{1-2})([- /.]*([0-9]+))+/) ||\n !!phoneNumber.match(/(0[1-9][0-9]*)([- /.]*([0-9]+))+/)\n )\n}\n\nexport function phoneNumberFormat(phoneNumber: string): string {\n let match = phoneNumber.match(/(?:\\+|00)([1-9][0-9]{1-2})([- /.]*([0-9]+))+/)\n if (match) {\n return `+${match[1]} ${match[2].replace(/[- /.]/g, \" \")}`.replace(/ /g, \" \")\n }\n match = phoneNumber.match(/0([1-9][0-9]*)([- /.]*([0-9]+))+/)\n if (match) {\n return `+32 ${match[1]} ${match[2].replace(/[- /.]/g, \" \")}`.replace(/ /g, \" \")\n }\n return phoneNumber\n}\n*/\n\nexport function phoneNumberFormat(phoneNumber: string): string {\n const parsedPhoneNumber = parseNumber(phoneNumber, DEFAULT_COUNTRY) as ParsedNumber\n if (Object.keys(parsedPhoneNumber).length === 0) {\n // The number is not valid, so we leave the input string as-is.\n return phoneNumber\n }\n return formatNumber(parsedPhoneNumber, 'INTERNATIONAL')\n}\n\n/**\n * Converts a backend date number (e.g., patient birth date) into a Date object.\n * @param dateNumber a YYYYMMDD date number from the backend\n * @return a Date object\n * @throws Error if it is impossible to create a date from the number, other if dateNumber is negative.\n * @see #dateEncode\n * @see #timeDecode\n */\nexport function dateDecode(dateNumber: number): Date | undefined {\n if (!dateNumber) {\n return undefined\n }\n\n if (dateNumber < 0) {\n throw new Error(\"We don't decode negative dates. Please make sure you have valid data.\")\n }\n const dateNumberStr: string = dateNumber.toString().padStart(8, '19700101')\n if (dateNumberStr.length > 8) {\n if (dateNumberStr.endsWith('000000')) {\n return dateNumber ? parseDate(dateNumberStr.slice(0, 8), 'yyyyMMdd', new Date()) : undefined\n }\n\n throw Error(\"Decoded date is over year 9999. We can't format it properly.\")\n }\n return dateNumber ? parseDate(dateNumberStr, 'yyyyMMdd', new Date()) : undefined\n}\n\n/**\n * Converts a backend time number (e.g., health element openingDate) into a Date object.\n * @param timeNumber a YYYYMMDD date number from the backend\n * @return a Date object\n * @see #timeEncode\n * @see #dateDecode\n */\nexport function timeDecode(timeNumber: number): Date | undefined {\n return timeNumber ? parseDate(timeNumber.toString(), 'yyyyMMddHHmmss', new Date()) : undefined\n}\n\n/**\n * Encodes a Date object into a backend date number (e.g., patient birth date).\n * @param date a Date object\n * @return a YYYYMMDD date number for the backend\n * @see #dateDecode\n * @see #timeEncode\n */\nexport function dateEncode(date: Date): number | undefined {\n const dateStr = formatDate(date, 'yyyyMMdd').padStart(8, '19700101')\n // date is null if the field is not set\n return date ? Number(dateStr) : undefined\n}\n\n/**\n * Encodes a Date object into a backend time number (e.g., health element openingDate).\n * @param date a Date object\n * @return a YYYYMMDDHHmmss date number for the backend\n * @see #timeDecode\n * @see #dateEncode\n */\nexport function timeEncode(date: Date): number | undefined {\n return date ? Number(formatDate(date, 'yyyyMMddHHmmss')) : undefined\n}\n\n/**\n * Formats a value and a physical unit into text.\n * @param value the numerical or string value to encode\n * @param unit the unit represented as a string (an empty string is also supported)\n */\nexport function unit(value: number | string, unit: string | null): string {\n unit = unit || ''\n let separator: string\n if (!unit || unit.startsWith('°')) {\n separator = ''\n } else {\n // including '%'\n separator = '\\xa0'\n }\n return value + separator + unit\n}\n\n/**\n * 0.1 + 0.2 = 0.30000000000000004. Use this function to be better at maths.\n * @param a number\n * @return the rounded number, two after the comma\n */\nexport function amount(value: number): number {\n return Number((value || 0).toFixed(2))\n}\n\n/**\n * A simple formatter to keep the logic across the app.\n * Input: 2.1 ; Output: 2.10€\n */\nexport function money(value: number): string {\n return [(value || 0).toFixed(2), '€'].join('')\n}\n\n/**\n * Transform a dictionary to a url params.\n * From { key1: value1, key2: value2, ... } returns key1=value1&key2=value2&...=...\n */\nexport function toUrlParams(params: { [key: string]: string }): string {\n return Object.entries(params)\n .map(([key, value]) => (value ? key + '=' + value : undefined))\n .filter(Boolean)\n .join('&')\n}\n\nexport function personName(person: { firstName?: string; lastName?: string }): string {\n return `${person.firstName || ''} ${person.lastName || ''}`.trim()\n}\n\nexport function personNameAbbrev(person: { firstName?: string; lastName?: string }): string {\n const firstName = person.firstName ? person.firstName[0] + '.' : undefined\n return personName({...person, firstName})\n}\n\n// Moment.js → date-fns format token mapping. Listed longest-first so the\n// matcher consumes the longest valid moment token at each position.\nconst MOMENT_TO_DATE_FNS_TOKENS: ReadonlyArray<readonly [string, string]> = [\n // Year\n ['YYYY', 'yyyy'],\n ['YY', 'yy'],\n ['Y', 'y'],\n // Month\n ['MMMM', 'MMMM'],\n ['MMM', 'MMM'],\n ['Mo', 'Mo'],\n ['MM', 'MM'],\n ['M', 'M'],\n // Quarter\n ['Qo', 'Qo'],\n ['Q', 'Q'],\n // Day of year (moment DDD/DDDD/DDDo → date-fns D/DDD/Do, additional tokens)\n ['DDDDo', 'Do'],\n ['DDDD', 'DDD'],\n ['DDDo', 'Do'],\n ['DDD', 'D'],\n // Day of month\n ['Do', 'do'],\n ['DD', 'dd'],\n ['D', 'd'],\n // Day of week\n ['dddd', 'EEEE'],\n ['ddd', 'EEE'],\n ['dd', 'EEEEEE'],\n ['do', 'eo'],\n ['d', 'e'],\n ['E', 'i'],\n // Week of year\n ['ww', 'ww'],\n ['wo', 'wo'],\n ['w', 'w'],\n ['WW', 'II'],\n ['Wo', 'Io'],\n ['W', 'I'],\n // Hour\n ['HH', 'HH'],\n ['H', 'H'],\n ['hh', 'hh'],\n ['h', 'h'],\n ['kk', 'kk'],\n ['k', 'k'],\n // AM/PM\n ['A', 'a'],\n ['a', 'aaa'],\n // Minute\n ['mm', 'mm'],\n ['m', 'm'],\n // Second\n ['ss', 'ss'],\n ['s', 's'],\n // Fractional seconds\n ['SSSS', 'SSSS'],\n ['SSS', 'SSS'],\n ['SS', 'SS'],\n ['S', 'S'],\n // Timezone offset\n ['ZZ', 'xx'],\n ['Z', 'xxx'],\n // Unix timestamp\n ['X', 't'],\n ['x', 'T'],\n]\n\nexport function momentFormatToDateFnsFormat(format: string): string {\n const parts: string[] = []\n let literalBuffer = ''\n\n const flushLiteral = () => {\n if (literalBuffer.length > 0) {\n parts.push(\"'\" + literalBuffer.replace(/'/g, \"''\") + \"'\")\n literalBuffer = ''\n }\n }\n\n let i = 0\n while (i < format.length) {\n const c = format[i]\n\n // Moment bracketed literal: [text] → date-fns 'text'\n if (c === '[') {\n const end = format.indexOf(']', i)\n if (end === -1) {\n literalBuffer += format.substring(i + 1)\n i = format.length\n continue\n }\n literalBuffer += format.substring(i + 1, end)\n i = end + 1\n continue\n }\n\n // Match the longest moment token starting at the current position.\n let matched: readonly [string, string] | undefined\n for (const token of MOMENT_TO_DATE_FNS_TOKENS) {\n if (format.startsWith(token[0], i)) {\n matched = token\n break\n }\n }\n if (matched) {\n flushLiteral()\n parts.push(matched[1])\n i += matched[0].length\n continue\n }\n\n // Non-token character: alphabetic chars must be escaped as literals,\n // otherwise date-fns would interpret them as its own tokens.\n if (/[A-Za-z]/.test(c)) {\n literalBuffer += c\n } else {\n flushLiteral()\n parts.push(c)\n }\n i++\n }\n flushLiteral()\n return parts.join('')\n}\n\nexport function toMoment(epochOrLongCalendar: number): { format: (format: string) => string } | null {\n if (!epochOrLongCalendar && epochOrLongCalendar !== 0) {\n return null\n }\n const parsed = (epochOrLongCalendar >= 18000101 && epochOrLongCalendar < 25400000) ?\n parseDate('' + epochOrLongCalendar, 'yyyyMMdd', new Date()) :\n (epochOrLongCalendar >= 18000101000000) ?\n parseDate('' + epochOrLongCalendar, 'yyyyMMddHHmmss', new Date()) :\n new Date(epochOrLongCalendar)\n return {\n format: (format: string): string => {\n return formatDate(parsed, momentFormatToDateFnsFormat(format), {\n useAdditionalDayOfYearTokens: true,\n useAdditionalWeekYearTokens: true,\n })\n }\n }\n}\n"]}
|