@icure/api 6.4.2 → 6.4.4
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/IccAuthApi.d.ts +19 -0
- package/icc-api/api/IccAuthApi.js +46 -1
- package/icc-api/api/IccAuthApi.js.map +1 -1
- package/icc-api/api/IccBesamv2Api.d.ts +6 -0
- package/icc-api/api/IccBesamv2Api.js +13 -0
- package/icc-api/api/IccBesamv2Api.js.map +1 -1
- package/icc-api/api/IccGroupApi.d.ts +6 -0
- package/icc-api/api/IccGroupApi.js +13 -0
- package/icc-api/api/IccGroupApi.js.map +1 -1
- package/icc-api/index.d.ts +0 -1
- package/icc-api/index.js +0 -1
- package/icc-api/index.js.map +1 -1
- package/icc-api/model/AuthenticationToken.d.ts +1 -0
- package/icc-api/model/AuthenticationToken.js.map +1 -1
- package/icc-api/model/CalendarItem.d.ts +1 -0
- package/icc-api/model/CalendarItem.js.map +1 -1
- package/icc-api/model/FlatRateTarification.d.ts +4 -1
- package/icc-api/model/FlatRateTarification.js +3 -0
- package/icc-api/model/FlatRateTarification.js.map +1 -1
- package/icc-api/model/ModelHelper.js +5 -4
- package/icc-api/model/ModelHelper.js.map +1 -1
- package/icc-api/model/UserGroup.d.ts +1 -0
- package/icc-api/model/UserGroup.js.map +1 -1
- package/icc-api/model/models.d.ts +2 -2
- package/icc-x-api/auth/AuthenticationProvider.d.ts +34 -2
- package/icc-x-api/auth/AuthenticationProvider.js +28 -6
- package/icc-x-api/auth/AuthenticationProvider.js.map +1 -1
- package/icc-x-api/auth/EnsembleAuthService.d.ts +6 -2
- package/icc-x-api/auth/EnsembleAuthService.js +9 -0
- package/icc-x-api/auth/EnsembleAuthService.js.map +1 -1
- package/icc-x-api/auth/JwtAuthService.d.ts +6 -5
- package/icc-x-api/auth/JwtAuthService.js +11 -23
- package/icc-x-api/auth/JwtAuthService.js.map +1 -1
- package/icc-x-api/auth/JwtBridgedAuthService.d.ts +26 -0
- package/icc-x-api/auth/JwtBridgedAuthService.js +129 -0
- package/icc-x-api/auth/JwtBridgedAuthService.js.map +1 -0
- package/icc-x-api/crypto/AES.js +3 -3
- package/icc-x-api/crypto/AES.js.map +1 -1
- package/icc-x-api/filters/ServiceByHcPartyTagCodeDateFilter.d.ts +1 -0
- package/icc-x-api/filters/ServiceByHcPartyTagCodeDateFilter.js.map +1 -1
- package/icc-x-api/filters/filters.d.ts +1 -1
- package/icc-x-api/icc-bekmehr-x-api.d.ts +1 -1
- package/icc-x-api/icc-crypto-x-api.d.ts +4 -6
- package/icc-x-api/icc-crypto-x-api.js +74 -75
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.js +1 -1
- package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
- package/icc-x-api/index.d.ts +7 -2
- package/icc-x-api/index.js +6 -4
- package/icc-x-api/index.js.map +1 -1
- package/icc-x-api/utils/asn1-packer.d.ts +1 -1
- package/icc-x-api/utils/asn1-parser.d.ts +1 -1
- package/icc-x-api/utils/net-utils.d.ts +2 -2
- package/package.json +1 -1
- package/icc-api/api/IccBemikronoApi.d.ts +0 -81
- package/icc-api/api/IccBemikronoApi.js +0 -162
- package/icc-api/api/IccBemikronoApi.js.map +0 -1
|
@@ -127,7 +127,7 @@ class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi_1.IccMaintenanceTaskA
|
|
|
127
127
|
.then((sfks) => {
|
|
128
128
|
const keys = this.crypto.filterAndFixValidEntityEncryptionKeyStrings(sfks.extractedKeys);
|
|
129
129
|
if (!keys.length)
|
|
130
|
-
throw new Error('No valid keys found for
|
|
130
|
+
throw new Error('No valid keys found for maintenance task encryption');
|
|
131
131
|
return this.crypto.AES.importKey('raw', (0, utils_1.hex2ua)(keys[0]));
|
|
132
132
|
})
|
|
133
133
|
.then((key) => (0, utils_1.crypt)(m, (obj) => this.crypto.AES.encrypt(key, (0, utils_1.utf8_2ua)(JSON.stringify(obj, (k, v) =>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AG,EAAE;wBACH,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;wBAC1C,OAAO,CAAC,EAAE,CAAC,CAAA;oBACb,CAAC,CACF,CACF,CACJ,CAAA;iBACF;qBAAM;oBACL,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;iBAC3B;YACH,CAAC,CAAC,CAAA;SAAA,CACH,CACF,CAAA;IACH,CAAC;CACF;AA1OD,wDA0OC","sourcesContent":["import { IccMaintenanceTaskApi } from '../icc-api/api/IccMaintenanceTaskApi'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport * as models from '../icc-api/model/models'\nimport * as _ from 'lodash'\nimport { a2b, b2a, string2ua } from '../icc-api/model/ModelHelper'\nimport { hex2ua, ua2utf8, utf8_2ua, crypt } from './utils'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { DocIdentifier } from '../icc-api/model/models'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\n\nexport class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi {\n crypto: IccCryptoXApi\n hcPartyApi: IccHcpartyXApi\n dataOwnerApi: IccDataOwnerXApi\n\n private readonly encryptedKeys: Array<string>\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n hcPartyApi: IccHcpartyXApi,\n dataOwnerApi: IccDataOwnerXApi,\n encryptedKeys: Array<string> = [],\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.crypto = crypto\n this.hcPartyApi = hcPartyApi\n this.dataOwnerApi = dataOwnerApi\n this.encryptedKeys = encryptedKeys\n }\n\n newInstance(user: models.User, m: any, delegates: string[] = []) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user)\n const maintenanceTask = _.assign(\n {\n id: this.crypto.randomUuid(),\n _type: 'org.taktik.icure.entities.MaintenanceTask',\n created: new Date().getTime(),\n modified: new Date().getTime(),\n responsible: dataOwnerId,\n author: user.id,\n },\n m || {}\n )\n\n return this.initDelegations(user, maintenanceTask, delegates).then((task) => this.initEncryptionKeys(user, task, delegates))\n }\n\n initDelegations(user: models.User, maintenanceTask: models.MaintenanceTask, delegates: string[] = []): Promise<models.MaintenanceTask> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user)\n return this.crypto.initObjectDelegations(maintenanceTask, null, dataOwnerId!, null).then((initData) => {\n _.extend(maintenanceTask, { delegations: initData.delegations })\n\n let promise = Promise.resolve(maintenanceTask)\n _.uniq(delegates.concat(user.autoDelegations ? user.autoDelegations.all || [] : [])).forEach(\n (delegateId) =>\n (promise = promise\n .then((patient) => this.crypto.extendedDelegationsAndCryptedForeignKeys(patient, null, dataOwnerId!, delegateId, initData.secretId))\n .then((extraData) => _.extend(maintenanceTask, { delegations: extraData.delegations }))\n .catch((e) => {\n console.log(e)\n return maintenanceTask\n }))\n )\n return promise\n })\n }\n\n initEncryptionKeys(user: models.User, maintenanceTask: models.MaintenanceTask, delegates: string[] = []): Promise<models.MaintenanceTask> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user)\n return this.crypto.initEncryptionKeys(maintenanceTask, dataOwnerId!).then((eks) => {\n let promise = Promise.resolve(\n _.extend(maintenanceTask, {\n encryptionKeys: eks.encryptionKeys,\n })\n )\n _.uniq(delegates.concat(user.autoDelegations ? user.autoDelegations.all || [] : [])).forEach(\n (delegateId) =>\n (promise = promise.then((patient) =>\n this.crypto\n .appendEncryptionKeys(patient, dataOwnerId!, delegateId, eks.secretId)\n .then((extraEks) => {\n return _.extend(extraEks.modifiedObject, {\n encryptionKeys: extraEks.encryptionKeys,\n })\n })\n .catch((e) => {\n console.log(e.message)\n return patient\n })\n ))\n )\n return promise\n })\n }\n\n createMaintenanceTask(body?: models.MaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n createMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((tasks) => super.createMaintenanceTask(tasks[0]))\n .then((mt) => this.decrypt(user, [mt]))\n .then((tasks) => tasks[0])\n : Promise.resolve(null)\n }\n\n filterMaintenanceTasksBy(startDocumentId?: string, limit?: number, body?: models.FilterChainMaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n deleteMaintenanceTask(_maintenanceTaskIds: string): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n deleteMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<Array<DocIdentifier>> | never {\n return super.getMaintenanceTask(maintenanceTaskId).then((mt) => {\n return this.dataOwnerApi.hasAccessTo(user, mt.delegations ?? {}).then((hasAccess) => {\n if (hasAccess) return super.deleteMaintenanceTask(maintenanceTaskId)\n else throw new Error('User does not have a delegation for this maintenanceTask')\n })\n })\n }\n\n filterMaintenanceTasksByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainMaintenanceTask\n ): Promise<models.PaginatedListMaintenanceTask | any> {\n return super\n .filterMaintenanceTasksBy(startDocumentId, limit, body)\n .then((pl) => this.decrypt(user, pl.rows!).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n getMaintenanceTask(maintenanceTaskId: string): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n getMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<models.MaintenanceTask | any> {\n return super\n .getMaintenanceTask(maintenanceTaskId)\n .then((mt) => this.decrypt(user, [mt]))\n .then((mts) => mts[0])\n }\n\n modifyMaintenanceTask(body?: models.MaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n modifyMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((encTasks) => super.modifyMaintenanceTask(encTasks[0]))\n .then((mt) => this.decrypt(user, [mt]))\n .then((mts) => mts[0])\n : Promise.resolve(null)\n }\n\n encrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user)\n\n return Promise.all(\n maintenanceTasks.map((m) =>\n (m.encryptionKeys && Object.keys(m.encryptionKeys).some((k) => !!m.encryptionKeys![k].length)\n ? Promise.resolve(m)\n : this.initEncryptionKeys(user, m)\n )\n .then((m: models.MaintenanceTask) => this.crypto.extractKeysFromDelegationsForHcpHierarchy(dataOwnerId!, m.id!, m.encryptionKeys!))\n .then((sfks: { extractedKeys: Array<string>; hcpartyId: string }) => {\n const keys = this.crypto.filterAndFixValidEntityEncryptionKeyStrings(sfks.extractedKeys)\n if (!keys.length) throw new Error('No valid keys found for calendar item encryption')\n return this.crypto.AES.importKey('raw', hex2ua(keys[0]))\n })\n .then((key: CryptoKey) =>\n crypt(\n m,\n (obj: { [key: string]: string }) =>\n this.crypto.AES.encrypt(\n key,\n utf8_2ua(\n JSON.stringify(obj, (k, v) => {\n return v instanceof ArrayBuffer || v instanceof Uint8Array\n ? b2a(new Uint8Array(v).reduce((d, b) => d + String.fromCharCode(b), ''))\n : v\n })\n )\n ),\n this.encryptedKeys\n )\n )\n )\n )\n }\n\n decrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user)\n\n return Promise.all(\n maintenanceTasks.map((mT) =>\n this.crypto.extractKeysFromDelegationsForHcpHierarchy(dataOwnerId, mT.id!, mT.encryptionKeys ?? {}).then(({ extractedKeys: sfks }) => {\n sfks = this.crypto.filterAndFixValidEntityEncryptionKeyStrings(sfks)\n if (!sfks || !sfks.length) {\n console.log('Cannot decrypt maintenanceTask', mT.id)\n return Promise.resolve(mT)\n }\n if (mT.encryptedSelf) {\n return this.crypto.AES.importKey('raw', hex2ua(sfks[0])).then(\n (key) =>\n new Promise((resolve: (value: any) => any) =>\n this.crypto.AES.decrypt(key, string2ua(a2b(mT.encryptedSelf!))).then(\n (dec) => {\n let jsonContent\n try {\n jsonContent = dec && ua2utf8(dec)\n jsonContent && _.assign(mT, JSON.parse(jsonContent))\n } catch (e) {\n console.log('Cannot parse mTask', mT.id, jsonContent || '<- Invalid encoding')\n }\n resolve(mT)\n },\n () => {\n console.log('Cannot decrypt mTask', mT.id)\n resolve(mT)\n }\n )\n )\n )\n } else {\n return Promise.resolve(mT)\n }\n })\n )\n )\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"icc-maintenance-task-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-maintenance-task-x-api.ts"],"names":[],"mappings":";;;AAAA,gFAA4E;AAG5E,4BAA2B;AAC3B,8DAAkE;AAClE,mCAA0D;AAI1D,0EAAgG;AAEhG,MAAa,sBAAuB,SAAQ,6CAAqB;IAO/D,YACE,IAAY,EACZ,OAAkC,EAClC,MAAqB,EACrB,UAA0B,EAC1B,YAA8B,EAC9B,gBAA+B,EAAE,EACjC,yBAAiD,IAAI,iDAAwB,EAAE,EAC/E,YAA2E,OAAO,MAAM,KAAK,WAAW;QACtG,CAAC,CAAC,MAAM,CAAC,KAAK;QACd,CAAC,CAAC,OAAO,IAAI,KAAK,WAAW;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,KAAK;QAET,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAA;QACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QAC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M,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,IAAA,uBAAS,EAAC,IAAA,iBAAG,EAAC,EAAE,CAAC,aAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAClE,CAAC,GAAG,EAAE,EAAE;wBACN,IAAI,WAAW,CAAA;wBACf,IAAI;4BACF,WAAW,GAAG,GAAG,IAAI,IAAA,eAAO,EAAC,GAAG,CAAC,CAAA;4BACjC,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;yBACrD;wBAAC,OAAO,CAAC,EAAE;4BACV,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,IAAI,qBAAqB,CAAC,CAAA;yBAC/E;wBACD,OAAO,CAAC,EAAE,CAAC,CAAA;oBACb,CAAC,EACD,GAAG,EAAE;wBACH,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;wBAC1C,OAAO,CAAC,EAAE,CAAC,CAAA;oBACb,CAAC,CACF,CACF,CACJ,CAAA;iBACF;qBAAM;oBACL,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;iBAC3B;YACH,CAAC,CAAC,CAAA;SAAA,CACH,CACF,CAAA;IACH,CAAC;CACF;AA1OD,wDA0OC","sourcesContent":["import { IccMaintenanceTaskApi } from '../icc-api/api/IccMaintenanceTaskApi'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport * as models from '../icc-api/model/models'\nimport * as _ from 'lodash'\nimport { a2b, b2a, string2ua } from '../icc-api/model/ModelHelper'\nimport { hex2ua, ua2utf8, utf8_2ua, crypt } from './utils'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { DocIdentifier } from '../icc-api/model/models'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\n\nexport class IccMaintenanceTaskXApi extends IccMaintenanceTaskApi {\n crypto: IccCryptoXApi\n hcPartyApi: IccHcpartyXApi\n dataOwnerApi: IccDataOwnerXApi\n\n private readonly encryptedKeys: Array<string>\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n hcPartyApi: IccHcpartyXApi,\n dataOwnerApi: IccDataOwnerXApi,\n encryptedKeys: Array<string> = [],\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.crypto = crypto\n this.hcPartyApi = hcPartyApi\n this.dataOwnerApi = dataOwnerApi\n this.encryptedKeys = encryptedKeys\n }\n\n newInstance(user: models.User, m: any, delegates: string[] = []) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user)\n const maintenanceTask = _.assign(\n {\n id: this.crypto.randomUuid(),\n _type: 'org.taktik.icure.entities.MaintenanceTask',\n created: new Date().getTime(),\n modified: new Date().getTime(),\n responsible: dataOwnerId,\n author: user.id,\n },\n m || {}\n )\n\n return this.initDelegations(user, maintenanceTask, delegates).then((task) => this.initEncryptionKeys(user, task, delegates))\n }\n\n initDelegations(user: models.User, maintenanceTask: models.MaintenanceTask, delegates: string[] = []): Promise<models.MaintenanceTask> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user)\n return this.crypto.initObjectDelegations(maintenanceTask, null, dataOwnerId!, null).then((initData) => {\n _.extend(maintenanceTask, { delegations: initData.delegations })\n\n let promise = Promise.resolve(maintenanceTask)\n _.uniq(delegates.concat(user.autoDelegations ? user.autoDelegations.all || [] : [])).forEach(\n (delegateId) =>\n (promise = promise\n .then((patient) => this.crypto.extendedDelegationsAndCryptedForeignKeys(patient, null, dataOwnerId!, delegateId, initData.secretId))\n .then((extraData) => _.extend(maintenanceTask, { delegations: extraData.delegations }))\n .catch((e) => {\n console.log(e)\n return maintenanceTask\n }))\n )\n return promise\n })\n }\n\n initEncryptionKeys(user: models.User, maintenanceTask: models.MaintenanceTask, delegates: string[] = []): Promise<models.MaintenanceTask> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user)\n return this.crypto.initEncryptionKeys(maintenanceTask, dataOwnerId!).then((eks) => {\n let promise = Promise.resolve(\n _.extend(maintenanceTask, {\n encryptionKeys: eks.encryptionKeys,\n })\n )\n _.uniq(delegates.concat(user.autoDelegations ? user.autoDelegations.all || [] : [])).forEach(\n (delegateId) =>\n (promise = promise.then((patient) =>\n this.crypto\n .appendEncryptionKeys(patient, dataOwnerId!, delegateId, eks.secretId)\n .then((extraEks) => {\n return _.extend(extraEks.modifiedObject, {\n encryptionKeys: extraEks.encryptionKeys,\n })\n })\n .catch((e) => {\n console.log(e.message)\n return patient\n })\n ))\n )\n return promise\n })\n }\n\n createMaintenanceTask(body?: models.MaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n createMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((tasks) => super.createMaintenanceTask(tasks[0]))\n .then((mt) => this.decrypt(user, [mt]))\n .then((tasks) => tasks[0])\n : Promise.resolve(null)\n }\n\n filterMaintenanceTasksBy(startDocumentId?: string, limit?: number, body?: models.FilterChainMaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n deleteMaintenanceTask(_maintenanceTaskIds: string): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n deleteMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<Array<DocIdentifier>> | never {\n return super.getMaintenanceTask(maintenanceTaskId).then((mt) => {\n return this.dataOwnerApi.hasAccessTo(user, mt.delegations ?? {}).then((hasAccess) => {\n if (hasAccess) return super.deleteMaintenanceTask(maintenanceTaskId)\n else throw new Error('User does not have a delegation for this maintenanceTask')\n })\n })\n }\n\n filterMaintenanceTasksByWithUser(\n user: models.User,\n startDocumentId?: string,\n limit?: number,\n body?: models.FilterChainMaintenanceTask\n ): Promise<models.PaginatedListMaintenanceTask | any> {\n return super\n .filterMaintenanceTasksBy(startDocumentId, limit, body)\n .then((pl) => this.decrypt(user, pl.rows!).then((dr) => Object.assign(pl, { rows: dr })))\n }\n\n getMaintenanceTask(maintenanceTaskId: string): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n getMaintenanceTaskWithUser(user: models.User, maintenanceTaskId: string): Promise<models.MaintenanceTask | any> {\n return super\n .getMaintenanceTask(maintenanceTaskId)\n .then((mt) => this.decrypt(user, [mt]))\n .then((mts) => mts[0])\n }\n\n modifyMaintenanceTask(body?: models.MaintenanceTask): never {\n throw new Error('Cannot call a method that returns maintenance tasks without providing a user for de/encryption')\n }\n\n modifyMaintenanceTaskWithUser(user: models.User, body?: models.MaintenanceTask): Promise<models.MaintenanceTask | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((encTasks) => super.modifyMaintenanceTask(encTasks[0]))\n .then((mt) => this.decrypt(user, [mt]))\n .then((mts) => mts[0])\n : Promise.resolve(null)\n }\n\n encrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user)\n\n return Promise.all(\n maintenanceTasks.map((m) =>\n (m.encryptionKeys && Object.keys(m.encryptionKeys).some((k) => !!m.encryptionKeys![k].length)\n ? Promise.resolve(m)\n : this.initEncryptionKeys(user, m)\n )\n .then((m: models.MaintenanceTask) => this.crypto.extractKeysFromDelegationsForHcpHierarchy(dataOwnerId!, m.id!, m.encryptionKeys!))\n .then((sfks: { extractedKeys: Array<string>; hcpartyId: string }) => {\n const keys = this.crypto.filterAndFixValidEntityEncryptionKeyStrings(sfks.extractedKeys)\n if (!keys.length) throw new Error('No valid keys found for maintenance task encryption')\n return this.crypto.AES.importKey('raw', hex2ua(keys[0]))\n })\n .then((key: CryptoKey) =>\n crypt(\n m,\n (obj: { [key: string]: string }) =>\n this.crypto.AES.encrypt(\n key,\n utf8_2ua(\n JSON.stringify(obj, (k, v) => {\n return v instanceof ArrayBuffer || v instanceof Uint8Array\n ? b2a(new Uint8Array(v).reduce((d, b) => d + String.fromCharCode(b), ''))\n : v\n })\n )\n ),\n this.encryptedKeys\n )\n )\n )\n )\n }\n\n decrypt(user: models.User, maintenanceTasks: Array<models.MaintenanceTask>): Promise<Array<models.MaintenanceTask>> {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerOf(user)\n\n return Promise.all(\n maintenanceTasks.map((mT) =>\n this.crypto.extractKeysFromDelegationsForHcpHierarchy(dataOwnerId, mT.id!, mT.encryptionKeys ?? {}).then(({ extractedKeys: sfks }) => {\n sfks = this.crypto.filterAndFixValidEntityEncryptionKeyStrings(sfks)\n if (!sfks || !sfks.length) {\n console.log('Cannot decrypt maintenanceTask', mT.id)\n return Promise.resolve(mT)\n }\n if (mT.encryptedSelf) {\n return this.crypto.AES.importKey('raw', hex2ua(sfks[0])).then(\n (key) =>\n new Promise((resolve: (value: any) => any) =>\n this.crypto.AES.decrypt(key, string2ua(a2b(mT.encryptedSelf!))).then(\n (dec) => {\n let jsonContent\n try {\n jsonContent = dec && ua2utf8(dec)\n jsonContent && _.assign(mT, JSON.parse(jsonContent))\n } catch (e) {\n console.log('Cannot parse mTask', mT.id, jsonContent || '<- Invalid encoding')\n }\n resolve(mT)\n },\n () => {\n console.log('Cannot decrypt mTask', mT.id)\n resolve(mT)\n }\n )\n )\n )\n } else {\n return Promise.resolve(mT)\n }\n })\n )\n )\n }\n}\n"]}
|
package/icc-x-api/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { IccMessageXApi } from './icc-message-x-api';
|
|
|
14
14
|
import { IccReceiptXApi } from './icc-receipt-x-api';
|
|
15
15
|
import { IccAccesslogXApi } from './icc-accesslog-x-api';
|
|
16
16
|
import { IccTimeTableXApi } from './icc-time-table-x-api';
|
|
17
|
-
import { IccDeviceApi } from '../icc-api
|
|
17
|
+
import { IccDeviceApi } from '../icc-api';
|
|
18
18
|
import { IccCodeXApi } from './icc-code-x-api';
|
|
19
19
|
import { IccMaintenanceTaskXApi } from './icc-maintenance-task-x-api';
|
|
20
20
|
import { IccDataOwnerXApi } from './icc-data-owner-x-api';
|
|
@@ -72,4 +72,9 @@ export interface Apis {
|
|
|
72
72
|
maintenanceTaskApi: IccMaintenanceTaskXApi;
|
|
73
73
|
dataOwnerApi: IccDataOwnerXApi;
|
|
74
74
|
}
|
|
75
|
-
export declare const Api: (host: string, username: string, password: string, crypto?: Crypto, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, forceBasic?: boolean, autoLogin?: boolean, storage?: StorageFacade<string>, keyStorage?: KeyStorageFacade
|
|
75
|
+
export declare const Api: (host: string, username: string, password: string, crypto?: Crypto, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, forceBasic?: boolean, autoLogin?: boolean, storage?: StorageFacade<string>, keyStorage?: KeyStorageFacade, icureTokens?: {
|
|
76
|
+
token: string;
|
|
77
|
+
refreshToken: string;
|
|
78
|
+
}, thirdPartyTokens?: {
|
|
79
|
+
[thirdParty: string]: string;
|
|
80
|
+
}) => Promise<Apis>;
|
package/icc-x-api/index.js
CHANGED
|
@@ -40,7 +40,7 @@ const icc_message_x_api_1 = require("./icc-message-x-api");
|
|
|
40
40
|
const icc_receipt_x_api_1 = require("./icc-receipt-x-api");
|
|
41
41
|
const icc_accesslog_x_api_1 = require("./icc-accesslog-x-api");
|
|
42
42
|
const icc_time_table_x_api_1 = require("./icc-time-table-x-api");
|
|
43
|
-
const
|
|
43
|
+
const icc_api_2 = require("../icc-api");
|
|
44
44
|
const icc_code_x_api_1 = require("./icc-code-x-api");
|
|
45
45
|
const icc_maintenance_task_x_api_1 = require("./icc-maintenance-task-x-api");
|
|
46
46
|
const icc_data_owner_x_api_1 = require("./icc-data-owner-x-api");
|
|
@@ -75,7 +75,7 @@ const Api = function (host, username, password, crypto = typeof window !== 'unde
|
|
|
75
75
|
? window.fetch
|
|
76
76
|
: typeof self !== 'undefined'
|
|
77
77
|
? self.fetch
|
|
78
|
-
: fetch, forceBasic = false, autoLogin = false, storage, keyStorage) {
|
|
78
|
+
: fetch, forceBasic = false, autoLogin = false, storage, keyStorage, icureTokens, thirdPartyTokens = {}) {
|
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
const _storage = storage || new LocalStorageImpl_1.LocalStorageImpl();
|
|
81
81
|
const _keyStorage = keyStorage || new KeyStorageImpl_1.KeyStorageImpl(_storage);
|
|
@@ -83,7 +83,9 @@ const Api = function (host, username, password, crypto = typeof window !== 'unde
|
|
|
83
83
|
const headers = {};
|
|
84
84
|
const authenticationProvider = forceBasic
|
|
85
85
|
? new AuthenticationProvider_1.BasicAuthenticationProvider(username, password)
|
|
86
|
-
:
|
|
86
|
+
: icureTokens
|
|
87
|
+
? new AuthenticationProvider_1.JwtAuthenticationProvider(new icc_api_1.IccAuthApi(host, headers, new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl), undefined, undefined, icureTokens)
|
|
88
|
+
: new AuthenticationProvider_1.EnsembleAuthenticationProvider(new icc_api_1.IccAuthApi(host, headers, new AuthenticationProvider_1.NoAuthenticationProvider(), fetchImpl), username, password, 3600, thirdPartyTokens);
|
|
87
89
|
// Here I instantiate a separate instance of the AuthApi that can call also login-protected methods (logout)
|
|
88
90
|
const authApi = new icc_api_1.IccAuthApi(host, headers, authenticationProvider, fetchImpl);
|
|
89
91
|
const codeApi = new icc_code_x_api_1.IccCodeXApi(host, headers, authenticationProvider, fetchImpl);
|
|
@@ -91,7 +93,7 @@ const Api = function (host, username, password, crypto = typeof window !== 'unde
|
|
|
91
93
|
const userApi = new icc_user_x_api_1.IccUserXApi(host, headers, authenticationProvider, fetchImpl);
|
|
92
94
|
const permissionApi = new icc_api_1.IccPermissionApi(host, headers, authenticationProvider, fetchImpl);
|
|
93
95
|
const healthcarePartyApi = new icc_hcparty_x_api_1.IccHcpartyXApi(host, headers, authenticationProvider, fetchImpl);
|
|
94
|
-
const deviceApi = new
|
|
96
|
+
const deviceApi = new icc_api_2.IccDeviceApi(host, headers, authenticationProvider, fetchImpl);
|
|
95
97
|
const cryptoApi = new icc_crypto_x_api_1.IccCryptoXApi(host, headers, healthcarePartyApi, new icc_api_1.IccPatientApi(host, headers, authenticationProvider, fetchImpl), deviceApi, crypto, _storage, _keyStorage);
|
|
96
98
|
const dataOwnerApi = new icc_data_owner_x_api_1.IccDataOwnerXApi(cryptoApi, new icc_api_1.IccPatientApi(host, headers, authenticationProvider, fetchImpl));
|
|
97
99
|
const accessLogApi = new icc_accesslog_x_api_1.IccAccesslogXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl);
|
package/icc-x-api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../icc-x-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAUmB;AACnB,qDAA8C;AAC9C,yDAAkD;AAClD,2DAAoD;AACpD,2DAAoD;AACpD,6DAAsD;AACtD,2DAAoD;AACpD,qDAA8C;AAC9C,6DAAsD;AACtD,yEAAkE;AAClE,uEAA+D;AAC/D,2DAAoD;AACpD,2DAAoD;AACpD,2DAAoD;AACpD,+DAAwD;AACxD,iEAAyD;AACzD,8DAA0D;AAC1D,qDAA8C;AAC9C,6EAAqE;AACrE,iEAAyD;AACzD,mCAA+B;AAG/B,iEAA6D;AAC7D,6DAAyD;AACzD,0EAAqI;AAErI,wDAAqC;AACrC,sDAAmC;AACnC,4DAAyC;AACzC,6DAA0C;AAC1C,mDAAgC;AAChC,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,CAAC,EAAE;oBACV,OAAO,CAAC,KAAK,CAAC,yEAAyE,EAAE,CAAC,CAAC,CAAA;iBAC5F;aACF;SACF;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;SACnC;QAED,OAAO;YACL,SAAS;YACT,OAAO;YACP,OAAO;YACP,mBAAmB;YACnB,kBAAkB;YAClB,OAAO;YACP,aAAa;YACb,UAAU;YACV,kBAAkB;YAClB,SAAS;YACT,YAAY;YACZ,UAAU;YACV,oBAAoB;YACpB,WAAW;YACX,OAAO;YACP,UAAU;YACV,YAAY;YACZ,UAAU;YACV,kBAAkB;YAClB,UAAU;YACV,SAAS;YACT,eAAe;YACf,iBAAiB;YACjB,YAAY;YACZ,QAAQ;YACR,kBAAkB;YAClB,YAAY;SACb,CAAA;IACH,CAAC;CAAA,CAAA;AAxIY,QAAA,GAAG,OAwIf","sourcesContent":["import {\n IccAgendaApi,\n IccAuthApi,\n IccCalendarItemTypeApi,\n IccEntityrefApi,\n IccGroupApi,\n IccInsuranceApi,\n IccMedicallocationApi,\n IccPatientApi,\n IccPermissionApi,\n} from '../icc-api'\nimport { IccUserXApi } from './icc-user-x-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport { IccContactXApi } from './icc-contact-x-api'\nimport { IccInvoiceXApi } from './icc-invoice-x-api'\nimport { IccDocumentXApi } from './icc-document-x-api'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { IccFormXApi } from './icc-form-x-api'\nimport { IccHelementXApi } from './icc-helement-x-api'\nimport { IccClassificationXApi } from './icc-classification-x-api'\nimport { IccCalendarItemXApi } from './icc-calendar-item-x-api'\nimport { IccPatientXApi } from './icc-patient-x-api'\nimport { IccMessageXApi } from './icc-message-x-api'\nimport { IccReceiptXApi } from './icc-receipt-x-api'\nimport { IccAccesslogXApi } from './icc-accesslog-x-api'\nimport { IccTimeTableXApi } from './icc-time-table-x-api'\nimport { IccDeviceApi } from '../icc-api/api/IccDeviceApi'\nimport { IccCodeXApi } from './icc-code-x-api'\nimport { IccMaintenanceTaskXApi } from './icc-maintenance-task-x-api'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { retry } from './utils'\nimport { StorageFacade } from './storage/StorageFacade'\nimport { KeyStorageFacade } from './storage/KeyStorageFacade'\nimport { LocalStorageImpl } from './storage/LocalStorageImpl'\nimport { KeyStorageImpl } from './storage/KeyStorageImpl'\nimport { BasicAuthenticationProvider, EnsembleAuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\n\nexport * from './icc-accesslog-x-api'\nexport * from './icc-bekmehr-x-api'\nexport * from './icc-calendar-item-x-api'\nexport * from './icc-classification-x-api'\nexport * from './icc-code-x-api'\nexport * from './icc-contact-x-api'\nexport * from './icc-crypto-x-api'\nexport * from './icc-doctemplate-x-api'\nexport * from './icc-document-x-api'\nexport * from './icc-form-x-api'\nexport * from './icc-hcparty-x-api'\nexport * from './icc-helement-x-api'\nexport * from './icc-invoice-x-api'\nexport * from './icc-message-x-api'\nexport * from './icc-patient-x-api'\nexport * from './icc-user-x-api'\nexport * from './icc-time-table-x-api'\nexport * from './icc-receipt-x-api'\nexport * from './utils'\nexport { KeyStorageFacade } from './storage/KeyStorageFacade'\nexport { LocalStorageImpl } from './storage/LocalStorageImpl'\nexport { StorageFacade } from './storage/StorageFacade'\nexport { KeyStorageImpl } from './storage/KeyStorageImpl'\n\nexport interface Apis {\n authApi: IccAuthApi\n codeApi: IccCodeXApi\n calendarItemTypeApi: IccCalendarItemTypeApi\n medicalLocationApi: IccMedicallocationApi\n entityReferenceApi: IccEntityrefApi\n userApi: IccUserXApi\n permissionApi: IccPermissionApi\n healthcarePartyApi: IccHcpartyXApi\n deviceApi: IccDeviceApi\n cryptoApi: IccCryptoXApi\n accessLogApi: IccAccesslogXApi\n agendaApi: IccAgendaApi\n contactApi: IccContactXApi\n formApi: IccFormXApi\n groupApi: IccGroupApi\n invoiceApi: IccInvoiceXApi\n insuranceApi: IccInsuranceApi\n documentApi: IccDocumentXApi\n healthcareElementApi: IccHelementXApi\n classificationApi: IccClassificationXApi\n calendarItemApi: IccCalendarItemXApi\n receiptApi: IccReceiptXApi\n timetableApi: IccTimeTableXApi\n patientApi: IccPatientXApi\n messageApi: IccMessageXApi\n maintenanceTaskApi: IccMaintenanceTaskXApi\n dataOwnerApi: IccDataOwnerXApi\n}\n\nexport const Api = async function (\n host: string,\n username: string,\n password: string,\n crypto: Crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : ({} as Crypto),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n forceBasic = false,\n autoLogin = false,\n storage?: StorageFacade<string>,\n keyStorage?: KeyStorageFacade\n): Promise<Apis> {\n const _storage = storage || new LocalStorageImpl()\n const _keyStorage = keyStorage || new KeyStorageImpl(_storage)\n\n // The AuthenticationProvider needs a AuthApi without authentication because it will only call methods without authentication\n const headers = {}\n const authenticationProvider = forceBasic\n ? new BasicAuthenticationProvider(username, password)\n : new EnsembleAuthenticationProvider(new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl), username, password)\n\n // Here I instantiate a separate instance of the AuthApi that can call also login-protected methods (logout)\n const authApi = new IccAuthApi(host, headers, authenticationProvider, fetchImpl)\n const codeApi = new IccCodeXApi(host, headers, authenticationProvider, fetchImpl)\n const entityReferenceApi = new IccEntityrefApi(host, headers, authenticationProvider, fetchImpl)\n const userApi = new IccUserXApi(host, headers, authenticationProvider, fetchImpl)\n const permissionApi = new IccPermissionApi(host, headers, authenticationProvider, fetchImpl)\n const healthcarePartyApi = new IccHcpartyXApi(host, headers, authenticationProvider, fetchImpl)\n const deviceApi = new IccDeviceApi(host, headers, authenticationProvider, fetchImpl)\n const cryptoApi = new IccCryptoXApi(\n host,\n headers,\n healthcarePartyApi,\n new IccPatientApi(host, headers, authenticationProvider, fetchImpl),\n deviceApi,\n crypto,\n _storage,\n _keyStorage\n )\n const dataOwnerApi = new IccDataOwnerXApi(cryptoApi, new IccPatientApi(host, headers, authenticationProvider, fetchImpl))\n const accessLogApi = new IccAccesslogXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const agendaApi = new IccAgendaApi(host, headers, authenticationProvider, fetchImpl)\n const contactApi = new IccContactXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const formApi = new IccFormXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const groupApi = new IccGroupApi(host, headers, authenticationProvider)\n const medicalLocationApi = new IccMedicallocationApi(host, headers, authenticationProvider)\n const calendarItemTypeApi = new IccCalendarItemTypeApi(host, headers, authenticationProvider)\n const invoiceApi = new IccInvoiceXApi(host, headers, cryptoApi, entityReferenceApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const insuranceApi = new IccInsuranceApi(host, headers, authenticationProvider, fetchImpl)\n const documentApi = new IccDocumentXApi(host, headers, cryptoApi, authApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const healthcareElementApi = new IccHelementXApi(host, headers, cryptoApi, dataOwnerApi, ['descr', 'note'], authenticationProvider, fetchImpl)\n const classificationApi = new IccClassificationXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const calendarItemApi = new IccCalendarItemXApi(\n host,\n headers,\n cryptoApi,\n dataOwnerApi,\n ['details', 'title', 'patientId'],\n authenticationProvider,\n fetchImpl\n )\n const receiptApi = new IccReceiptXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const timetableApi = new IccTimeTableXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const patientApi = new IccPatientXApi(\n host,\n headers,\n cryptoApi,\n contactApi,\n formApi,\n healthcareElementApi,\n invoiceApi,\n documentApi,\n healthcarePartyApi,\n classificationApi,\n dataOwnerApi,\n calendarItemApi,\n ['note'],\n authenticationProvider,\n fetchImpl\n )\n const messageApi = new IccMessageXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const maintenanceTaskApi = new IccMaintenanceTaskXApi(\n host,\n headers,\n cryptoApi,\n healthcarePartyApi,\n dataOwnerApi,\n ['properties'],\n authenticationProvider,\n fetchImpl\n )\n\n if (autoLogin) {\n if (username != undefined && password != undefined) {\n try {\n await retry(() => authApi.login({ username, password }), 3, 1000, 1.5)\n } catch (e) {\n console.error('Incorrect user and password used to instantiate Api, or network problem', e)\n }\n }\n } else {\n console.info('Auto login skipped')\n }\n\n return {\n cryptoApi,\n authApi,\n codeApi,\n calendarItemTypeApi,\n medicalLocationApi,\n userApi,\n permissionApi,\n patientApi,\n healthcarePartyApi,\n deviceApi,\n accessLogApi,\n contactApi,\n healthcareElementApi,\n documentApi,\n formApi,\n invoiceApi,\n insuranceApi,\n messageApi,\n entityReferenceApi,\n receiptApi,\n agendaApi,\n calendarItemApi,\n classificationApi,\n timetableApi,\n groupApi,\n maintenanceTaskApi,\n dataOwnerApi,\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../icc-x-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAWmB;AACnB,qDAA8C;AAC9C,yDAAkD;AAClD,2DAAoD;AACpD,2DAAoD;AACpD,6DAAsD;AACtD,2DAAoD;AACpD,qDAA8C;AAC9C,6DAAsD;AACtD,yEAAkE;AAClE,uEAA+D;AAC/D,2DAAoD;AACpD,2DAAoD;AACpD,2DAAoD;AACpD,+DAAwD;AACxD,iEAAyD;AACzD,wCAAyC;AACzC,qDAA8C;AAC9C,6EAAqE;AACrE,iEAAyD;AACzD,mCAA+B;AAG/B,iEAA6D;AAC7D,6DAAyD;AACzD,0EAKsC;AAEtC,wDAAqC;AACrC,sDAAmC;AACnC,4DAAyC;AACzC,6DAA0C;AAC1C,mDAAgC;AAChC,sDAAmC;AACnC,qDAAkC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S,IAAI,QAAQ,IAAI,SAAS,EAAE;gBAClD,IAAI;oBACF,MAAM,IAAA,aAAK,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;iBACvE;gBAAC,OAAO,CAAC,EAAE;oBACV,OAAO,CAAC,KAAK,CAAC,yEAAyE,EAAE,CAAC,CAAC,CAAA;iBAC5F;aACF;SACF;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;SACnC;QAED,OAAO;YACL,SAAS;YACT,OAAO;YACP,OAAO;YACP,mBAAmB;YACnB,kBAAkB;YAClB,OAAO;YACP,aAAa;YACb,UAAU;YACV,kBAAkB;YAClB,SAAS;YACT,YAAY;YACZ,UAAU;YACV,oBAAoB;YACpB,WAAW;YACX,OAAO;YACP,UAAU;YACV,YAAY;YACZ,UAAU;YACV,kBAAkB;YAClB,UAAU;YACV,SAAS;YACT,eAAe;YACf,iBAAiB;YACjB,YAAY;YACZ,QAAQ;YACR,kBAAkB;YAClB,YAAY;SACb,CAAA;IACH,CAAC;CAAA,CAAA;AAlJY,QAAA,GAAG,OAkJf","sourcesContent":["import {\n IccAgendaApi,\n IccAuthApi,\n IccCalendarItemTypeApi,\n IccEntityrefApi,\n IccGroupApi,\n IccInsuranceApi,\n IccMedicallocationApi,\n IccPatientApi,\n IccPermissionApi,\n OAuthThirdParty,\n} from '../icc-api'\nimport { IccUserXApi } from './icc-user-x-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport { IccContactXApi } from './icc-contact-x-api'\nimport { IccInvoiceXApi } from './icc-invoice-x-api'\nimport { IccDocumentXApi } from './icc-document-x-api'\nimport { IccHcpartyXApi } from './icc-hcparty-x-api'\nimport { IccFormXApi } from './icc-form-x-api'\nimport { IccHelementXApi } from './icc-helement-x-api'\nimport { IccClassificationXApi } from './icc-classification-x-api'\nimport { IccCalendarItemXApi } from './icc-calendar-item-x-api'\nimport { IccPatientXApi } from './icc-patient-x-api'\nimport { IccMessageXApi } from './icc-message-x-api'\nimport { IccReceiptXApi } from './icc-receipt-x-api'\nimport { IccAccesslogXApi } from './icc-accesslog-x-api'\nimport { IccTimeTableXApi } from './icc-time-table-x-api'\nimport { IccDeviceApi } from '../icc-api'\nimport { IccCodeXApi } from './icc-code-x-api'\nimport { IccMaintenanceTaskXApi } from './icc-maintenance-task-x-api'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { retry } from './utils'\nimport { StorageFacade } from './storage/StorageFacade'\nimport { KeyStorageFacade } from './storage/KeyStorageFacade'\nimport { LocalStorageImpl } from './storage/LocalStorageImpl'\nimport { KeyStorageImpl } from './storage/KeyStorageImpl'\nimport {\n BasicAuthenticationProvider,\n EnsembleAuthenticationProvider,\n JwtAuthenticationProvider,\n NoAuthenticationProvider,\n} from './auth/AuthenticationProvider'\n\nexport * from './icc-accesslog-x-api'\nexport * from './icc-bekmehr-x-api'\nexport * from './icc-calendar-item-x-api'\nexport * from './icc-classification-x-api'\nexport * from './icc-code-x-api'\nexport * from './icc-contact-x-api'\nexport * from './icc-crypto-x-api'\nexport * from './icc-doctemplate-x-api'\nexport * from './icc-document-x-api'\nexport * from './icc-form-x-api'\nexport * from './icc-hcparty-x-api'\nexport * from './icc-helement-x-api'\nexport * from './icc-invoice-x-api'\nexport * from './icc-message-x-api'\nexport * from './icc-patient-x-api'\nexport * from './icc-user-x-api'\nexport * from './icc-time-table-x-api'\nexport * from './icc-receipt-x-api'\nexport * from './utils'\nexport { KeyStorageFacade } from './storage/KeyStorageFacade'\nexport { LocalStorageImpl } from './storage/LocalStorageImpl'\nexport { StorageFacade } from './storage/StorageFacade'\nexport { KeyStorageImpl } from './storage/KeyStorageImpl'\n\nexport interface Apis {\n authApi: IccAuthApi\n codeApi: IccCodeXApi\n calendarItemTypeApi: IccCalendarItemTypeApi\n medicalLocationApi: IccMedicallocationApi\n entityReferenceApi: IccEntityrefApi\n userApi: IccUserXApi\n permissionApi: IccPermissionApi\n healthcarePartyApi: IccHcpartyXApi\n deviceApi: IccDeviceApi\n cryptoApi: IccCryptoXApi\n accessLogApi: IccAccesslogXApi\n agendaApi: IccAgendaApi\n contactApi: IccContactXApi\n formApi: IccFormXApi\n groupApi: IccGroupApi\n invoiceApi: IccInvoiceXApi\n insuranceApi: IccInsuranceApi\n documentApi: IccDocumentXApi\n healthcareElementApi: IccHelementXApi\n classificationApi: IccClassificationXApi\n calendarItemApi: IccCalendarItemXApi\n receiptApi: IccReceiptXApi\n timetableApi: IccTimeTableXApi\n patientApi: IccPatientXApi\n messageApi: IccMessageXApi\n maintenanceTaskApi: IccMaintenanceTaskXApi\n dataOwnerApi: IccDataOwnerXApi\n}\n\nexport const Api = async function (\n host: string,\n username: string,\n password: string,\n crypto: Crypto = typeof window !== 'undefined' ? window.crypto : typeof self !== 'undefined' ? self.crypto : ({} as Crypto),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n forceBasic = false,\n autoLogin = false,\n storage?: StorageFacade<string>,\n keyStorage?: KeyStorageFacade,\n icureTokens?: { token: string; refreshToken: string },\n thirdPartyTokens: { [thirdParty: string]: string } = {}\n): Promise<Apis> {\n const _storage = storage || new LocalStorageImpl()\n const _keyStorage = keyStorage || new KeyStorageImpl(_storage)\n\n // The AuthenticationProvider needs a AuthApi without authentication because it will only call methods without authentication\n const headers = {}\n const authenticationProvider = forceBasic\n ? new BasicAuthenticationProvider(username, password)\n : icureTokens\n ? new JwtAuthenticationProvider(new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl), undefined, undefined, icureTokens)\n : new EnsembleAuthenticationProvider(\n new IccAuthApi(host, headers, new NoAuthenticationProvider(), fetchImpl),\n username,\n password,\n 3600,\n thirdPartyTokens\n )\n\n // Here I instantiate a separate instance of the AuthApi that can call also login-protected methods (logout)\n const authApi = new IccAuthApi(host, headers, authenticationProvider, fetchImpl)\n const codeApi = new IccCodeXApi(host, headers, authenticationProvider, fetchImpl)\n const entityReferenceApi = new IccEntityrefApi(host, headers, authenticationProvider, fetchImpl)\n const userApi = new IccUserXApi(host, headers, authenticationProvider, fetchImpl)\n const permissionApi = new IccPermissionApi(host, headers, authenticationProvider, fetchImpl)\n const healthcarePartyApi = new IccHcpartyXApi(host, headers, authenticationProvider, fetchImpl)\n const deviceApi = new IccDeviceApi(host, headers, authenticationProvider, fetchImpl)\n const cryptoApi = new IccCryptoXApi(\n host,\n headers,\n healthcarePartyApi,\n new IccPatientApi(host, headers, authenticationProvider, fetchImpl),\n deviceApi,\n crypto,\n _storage,\n _keyStorage\n )\n const dataOwnerApi = new IccDataOwnerXApi(cryptoApi, new IccPatientApi(host, headers, authenticationProvider, fetchImpl))\n const accessLogApi = new IccAccesslogXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const agendaApi = new IccAgendaApi(host, headers, authenticationProvider, fetchImpl)\n const contactApi = new IccContactXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const formApi = new IccFormXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const groupApi = new IccGroupApi(host, headers, authenticationProvider)\n const medicalLocationApi = new IccMedicallocationApi(host, headers, authenticationProvider)\n const calendarItemTypeApi = new IccCalendarItemTypeApi(host, headers, authenticationProvider)\n const invoiceApi = new IccInvoiceXApi(host, headers, cryptoApi, entityReferenceApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const insuranceApi = new IccInsuranceApi(host, headers, authenticationProvider, fetchImpl)\n const documentApi = new IccDocumentXApi(host, headers, cryptoApi, authApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const healthcareElementApi = new IccHelementXApi(host, headers, cryptoApi, dataOwnerApi, ['descr', 'note'], authenticationProvider, fetchImpl)\n const classificationApi = new IccClassificationXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const calendarItemApi = new IccCalendarItemXApi(\n host,\n headers,\n cryptoApi,\n dataOwnerApi,\n ['details', 'title', 'patientId'],\n authenticationProvider,\n fetchImpl\n )\n const receiptApi = new IccReceiptXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const timetableApi = new IccTimeTableXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const patientApi = new IccPatientXApi(\n host,\n headers,\n cryptoApi,\n contactApi,\n formApi,\n healthcareElementApi,\n invoiceApi,\n documentApi,\n healthcarePartyApi,\n classificationApi,\n dataOwnerApi,\n calendarItemApi,\n ['note'],\n authenticationProvider,\n fetchImpl\n )\n const messageApi = new IccMessageXApi(host, headers, cryptoApi, dataOwnerApi, authenticationProvider, fetchImpl)\n const maintenanceTaskApi = new IccMaintenanceTaskXApi(\n host,\n headers,\n cryptoApi,\n healthcarePartyApi,\n dataOwnerApi,\n ['properties'],\n authenticationProvider,\n fetchImpl\n )\n\n if (autoLogin) {\n if (username != undefined && password != undefined) {\n try {\n await retry(() => authApi.login({ username, password }), 3, 1000, 1.5)\n } catch (e) {\n console.error('Incorrect user and password used to instantiate Api, or network problem', e)\n }\n }\n } else {\n console.info('Auto login skipped')\n }\n\n return {\n cryptoApi,\n authApi,\n codeApi,\n calendarItemTypeApi,\n medicalLocationApi,\n userApi,\n permissionApi,\n patientApi,\n healthcarePartyApi,\n deviceApi,\n accessLogApi,\n contactApi,\n healthcareElementApi,\n documentApi,\n formApi,\n invoiceApi,\n insuranceApi,\n messageApi,\n entityReferenceApi,\n receiptApi,\n agendaApi,\n calendarItemApi,\n classificationApi,\n timetableApi,\n groupApi,\n maintenanceTaskApi,\n dataOwnerApi,\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type PaginatorFunction<X> = (key: any, docId: string | null, limit: number | undefined) => Promise<PaginatorResponse<X>>;
|
|
2
|
+
export type PaginatorExecutor<X> = (latestPaginatorFunctionResult: PaginatorResponse<X>, acc: any[], limit: number | undefined) => Promise<PaginatorResponse<X>>;
|
|
3
3
|
export interface PaginatorResponse<X> {
|
|
4
4
|
rows: Array<X>;
|
|
5
5
|
nextKey: any | null | undefined;
|
package/package.json
CHANGED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* iCure Data Stack API Documentation
|
|
3
|
-
* The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.
|
|
4
|
-
*
|
|
5
|
-
* OpenAPI spec version: v1
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This class is auto generated by the swagger code generator program.
|
|
9
|
-
* https://github.com/swagger-api/swagger-codegen.git
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
import { XHR } from './XHR';
|
|
13
|
-
import { Appointment } from '../model/Appointment';
|
|
14
|
-
import { AppointmentImport } from '../model/AppointmentImport';
|
|
15
|
-
import { EmailOrSmsMessage } from '../model/EmailOrSmsMessage';
|
|
16
|
-
import { MikronoAppointmentTypeRest } from '../model/MikronoAppointmentTypeRest';
|
|
17
|
-
import { MikronoCredentials } from '../model/MikronoCredentials';
|
|
18
|
-
import { Unit } from '../model/Unit';
|
|
19
|
-
import { User } from '../model/User';
|
|
20
|
-
import { AuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider';
|
|
21
|
-
export declare class IccBemikronoApi {
|
|
22
|
-
host: string;
|
|
23
|
-
headers: Array<XHR.Header>;
|
|
24
|
-
authenticationProvider: AuthenticationProvider;
|
|
25
|
-
fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
26
|
-
constructor(host: string, headers: any, authenticationProvider?: AuthenticationProvider, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
|
|
27
|
-
setHeaders(h: Array<XHR.Header>): void;
|
|
28
|
-
handleError(e: XHR.XHRError): never;
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
* @summary Get appointments for patient
|
|
32
|
-
* @param calendarDate
|
|
33
|
-
*/
|
|
34
|
-
appointmentsByDate(calendarDate: number): Promise<Array<Appointment>>;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* @summary Get appointments for patient
|
|
38
|
-
* @param patientId
|
|
39
|
-
* @param from
|
|
40
|
-
* @param to
|
|
41
|
-
*/
|
|
42
|
-
appointmentsByPatient(patientId: string, from?: number, to?: number): Promise<Array<Appointment>>;
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* @param body
|
|
46
|
-
*/
|
|
47
|
-
createAppointmentTypes(body?: Array<MikronoAppointmentTypeRest>): Promise<Array<MikronoAppointmentTypeRest>>;
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @summary Create appointments for owner
|
|
51
|
-
* @param body
|
|
52
|
-
*/
|
|
53
|
-
createAppointments(body?: Array<AppointmentImport>): Promise<Array<string>>;
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* @summary Notify of an appointment change
|
|
57
|
-
* @param appointmentId
|
|
58
|
-
* @param action
|
|
59
|
-
*/
|
|
60
|
-
notify(appointmentId: string, action: string): Promise<any | Boolean>;
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* @summary Set credentials for provided user
|
|
64
|
-
* @param body
|
|
65
|
-
* @param userId
|
|
66
|
-
*/
|
|
67
|
-
register(userId: string, body?: MikronoCredentials): Promise<User>;
|
|
68
|
-
/**
|
|
69
|
-
*
|
|
70
|
-
* @summary Send message using mikrono from logged user
|
|
71
|
-
* @param body
|
|
72
|
-
*/
|
|
73
|
-
sendMessage(body?: EmailOrSmsMessage): Promise<Unit>;
|
|
74
|
-
/**
|
|
75
|
-
*
|
|
76
|
-
* @summary Set credentials for provided user
|
|
77
|
-
* @param body
|
|
78
|
-
* @param userId
|
|
79
|
-
*/
|
|
80
|
-
setUserCredentials(userId: string, body?: MikronoCredentials): Promise<User>;
|
|
81
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IccBemikronoApi = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* iCure Data Stack API Documentation
|
|
6
|
-
* The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.
|
|
7
|
-
*
|
|
8
|
-
* OpenAPI spec version: v1
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* NOTE: This class is auto generated by the swagger code generator program.
|
|
12
|
-
* https://github.com/swagger-api/swagger-codegen.git
|
|
13
|
-
* Do not edit the class manually.
|
|
14
|
-
*/
|
|
15
|
-
const XHR_1 = require("./XHR");
|
|
16
|
-
const Appointment_1 = require("../model/Appointment");
|
|
17
|
-
const MikronoAppointmentTypeRest_1 = require("../model/MikronoAppointmentTypeRest");
|
|
18
|
-
const Unit_1 = require("../model/Unit");
|
|
19
|
-
const User_1 = require("../model/User");
|
|
20
|
-
const AuthenticationProvider_1 = require("../../icc-x-api/auth/AuthenticationProvider");
|
|
21
|
-
class IccBemikronoApi {
|
|
22
|
-
constructor(host, headers, authenticationProvider, fetchImpl) {
|
|
23
|
-
this.host = host;
|
|
24
|
-
this.headers = Object.keys(headers).map((k) => new XHR_1.XHR.Header(k, headers[k]));
|
|
25
|
-
this.authenticationProvider = !!authenticationProvider ? authenticationProvider : new AuthenticationProvider_1.NoAuthenticationProvider();
|
|
26
|
-
this.fetchImpl = fetchImpl;
|
|
27
|
-
}
|
|
28
|
-
setHeaders(h) {
|
|
29
|
-
this.headers = h;
|
|
30
|
-
}
|
|
31
|
-
handleError(e) {
|
|
32
|
-
throw e;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
* @summary Get appointments for patient
|
|
37
|
-
* @param calendarDate
|
|
38
|
-
*/
|
|
39
|
-
appointmentsByDate(calendarDate) {
|
|
40
|
-
let _body = null;
|
|
41
|
-
const _url = this.host + `/be_mikrono/appointments/byDate/${encodeURIComponent(String(calendarDate))}` + '?ts=' + new Date().getTime();
|
|
42
|
-
let headers = this.headers;
|
|
43
|
-
return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
|
|
44
|
-
.then((doc) => doc.body.map((it) => new Appointment_1.Appointment(it)))
|
|
45
|
-
.catch((err) => this.handleError(err));
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @summary Get appointments for patient
|
|
50
|
-
* @param patientId
|
|
51
|
-
* @param from
|
|
52
|
-
* @param to
|
|
53
|
-
*/
|
|
54
|
-
appointmentsByPatient(patientId, from, to) {
|
|
55
|
-
let _body = null;
|
|
56
|
-
const _url = this.host +
|
|
57
|
-
`/be_mikrono/appointments/byPatient/${encodeURIComponent(String(patientId))}` +
|
|
58
|
-
'?ts=' +
|
|
59
|
-
new Date().getTime() +
|
|
60
|
-
(from ? '&from=' + encodeURIComponent(String(from)) : '') +
|
|
61
|
-
(to ? '&to=' + encodeURIComponent(String(to)) : '');
|
|
62
|
-
let headers = this.headers;
|
|
63
|
-
return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
|
|
64
|
-
.then((doc) => doc.body.map((it) => new Appointment_1.Appointment(it)))
|
|
65
|
-
.catch((err) => this.handleError(err));
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
*
|
|
69
|
-
* @param body
|
|
70
|
-
*/
|
|
71
|
-
createAppointmentTypes(body) {
|
|
72
|
-
let _body = null;
|
|
73
|
-
_body = body;
|
|
74
|
-
const _url = this.host + `/be_mikrono/appointmentTypes` + '?ts=' + new Date().getTime();
|
|
75
|
-
let headers = this.headers;
|
|
76
|
-
headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
|
|
77
|
-
return XHR_1.XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
|
|
78
|
-
.then((doc) => doc.body.map((it) => new MikronoAppointmentTypeRest_1.MikronoAppointmentTypeRest(it)))
|
|
79
|
-
.catch((err) => this.handleError(err));
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
* @summary Create appointments for owner
|
|
84
|
-
* @param body
|
|
85
|
-
*/
|
|
86
|
-
createAppointments(body) {
|
|
87
|
-
let _body = null;
|
|
88
|
-
_body = body;
|
|
89
|
-
const _url = this.host + `/be_mikrono/appointments` + '?ts=' + new Date().getTime();
|
|
90
|
-
let headers = this.headers;
|
|
91
|
-
headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
|
|
92
|
-
return XHR_1.XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
|
|
93
|
-
.then((doc) => doc.body.map((it) => JSON.parse(JSON.stringify(it))))
|
|
94
|
-
.catch((err) => this.handleError(err));
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
* @summary Notify of an appointment change
|
|
99
|
-
* @param appointmentId
|
|
100
|
-
* @param action
|
|
101
|
-
*/
|
|
102
|
-
notify(appointmentId, action) {
|
|
103
|
-
let _body = null;
|
|
104
|
-
const _url = this.host +
|
|
105
|
-
`/be_mikrono/notify/${encodeURIComponent(String(appointmentId))}/${encodeURIComponent(String(action))}` +
|
|
106
|
-
'?ts=' +
|
|
107
|
-
new Date().getTime();
|
|
108
|
-
let headers = this.headers;
|
|
109
|
-
return XHR_1.XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
|
|
110
|
-
.then((doc) => true)
|
|
111
|
-
.catch((err) => this.handleError(err));
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
*
|
|
115
|
-
* @summary Set credentials for provided user
|
|
116
|
-
* @param body
|
|
117
|
-
* @param userId
|
|
118
|
-
*/
|
|
119
|
-
register(userId, body) {
|
|
120
|
-
let _body = null;
|
|
121
|
-
_body = body;
|
|
122
|
-
const _url = this.host + `/be_mikrono/user/${encodeURIComponent(String(userId))}/register` + '?ts=' + new Date().getTime();
|
|
123
|
-
let headers = this.headers;
|
|
124
|
-
headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
|
|
125
|
-
return XHR_1.XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
|
|
126
|
-
.then((doc) => new User_1.User(doc.body))
|
|
127
|
-
.catch((err) => this.handleError(err));
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
*
|
|
131
|
-
* @summary Send message using mikrono from logged user
|
|
132
|
-
* @param body
|
|
133
|
-
*/
|
|
134
|
-
sendMessage(body) {
|
|
135
|
-
let _body = null;
|
|
136
|
-
_body = body;
|
|
137
|
-
const _url = this.host + `/be_mikrono/sendMessage` + '?ts=' + new Date().getTime();
|
|
138
|
-
let headers = this.headers;
|
|
139
|
-
headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
|
|
140
|
-
return XHR_1.XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
|
|
141
|
-
.then((doc) => new Unit_1.Unit(doc.body))
|
|
142
|
-
.catch((err) => this.handleError(err));
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
*
|
|
146
|
-
* @summary Set credentials for provided user
|
|
147
|
-
* @param body
|
|
148
|
-
* @param userId
|
|
149
|
-
*/
|
|
150
|
-
setUserCredentials(userId, body) {
|
|
151
|
-
let _body = null;
|
|
152
|
-
_body = body;
|
|
153
|
-
const _url = this.host + `/be_mikrono/user/${encodeURIComponent(String(userId))}/credentials` + '?ts=' + new Date().getTime();
|
|
154
|
-
let headers = this.headers;
|
|
155
|
-
headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
|
|
156
|
-
return XHR_1.XHR.sendCommand('PUT', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
|
|
157
|
-
.then((doc) => new User_1.User(doc.body))
|
|
158
|
-
.catch((err) => this.handleError(err));
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
exports.IccBemikronoApi = IccBemikronoApi;
|
|
162
|
-
//# sourceMappingURL=IccBemikronoApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IccBemikronoApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccBemikronoApi.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,+BAA2B;AAC3B,sDAAkD;AAGlD,oFAAgF;AAEhF,wCAAoC;AACpC,wCAAoC;AACpC,wFAA8G;AAE9G,MAAa,eAAe;IAM1B,YACE,IAAY,EACZ,OAAY,EACZ,sBAA+C,EAC/C,SAAyE;QAEzE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,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;QAC7E,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,OAAO,GAAG,CAAC,CAAA;IAClB,CAAC;IAED,WAAW,CAAC,CAAe;QACzB,MAAM,CAAC,CAAA;IACT,CAAC;IAED;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GAAG,oBAAoB,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,GAAG,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;QAC7H,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC1B,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;QACvH,OAAO,SAAG,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,CAAC;aACzH,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,WAAI,CAAC,GAAG,CAAC,IAAY,CAAC,CAAC;aACzC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC;CACF;AAzKD,0CAyKC","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 { Appointment } from '../model/Appointment'\nimport { AppointmentImport } from '../model/AppointmentImport'\nimport { EmailOrSmsMessage } from '../model/EmailOrSmsMessage'\nimport { MikronoAppointmentTypeRest } from '../model/MikronoAppointmentTypeRest'\nimport { MikronoCredentials } from '../model/MikronoCredentials'\nimport { Unit } from '../model/Unit'\nimport { User } from '../model/User'\nimport { AuthenticationProvider, NoAuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider'\n\nexport class IccBemikronoApi {\n host: string\n headers: Array<XHR.Header>\n authenticationProvider: AuthenticationProvider\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n\n constructor(\n host: string,\n headers: any,\n authenticationProvider?: AuthenticationProvider,\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n ) {\n this.host = host\n this.headers = Object.keys(headers).map((k) => new XHR.Header(k, headers[k]))\n this.authenticationProvider = !!authenticationProvider ? authenticationProvider : new NoAuthenticationProvider()\n this.fetchImpl = fetchImpl\n }\n\n setHeaders(h: Array<XHR.Header>) {\n this.headers = h\n }\n\n handleError(e: XHR.XHRError): never {\n throw e\n }\n\n /**\n *\n * @summary Get appointments for patient\n * @param calendarDate\n */\n appointmentsByDate(calendarDate: number): Promise<Array<Appointment>> {\n let _body = null\n\n const _url = this.host + `/be_mikrono/appointments/byDate/${encodeURIComponent(String(calendarDate))}` + '?ts=' + new Date().getTime()\n let headers = 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 Appointment(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Get appointments for patient\n * @param patientId\n * @param from\n * @param to\n */\n appointmentsByPatient(patientId: string, from?: number, to?: number): Promise<Array<Appointment>> {\n let _body = null\n\n const _url =\n this.host +\n `/be_mikrono/appointments/byPatient/${encodeURIComponent(String(patientId))}` +\n '?ts=' +\n new Date().getTime() +\n (from ? '&from=' + encodeURIComponent(String(from)) : '') +\n (to ? '&to=' + encodeURIComponent(String(to)) : '')\n let headers = 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 Appointment(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @param body\n */\n createAppointmentTypes(body?: Array<MikronoAppointmentTypeRest>): Promise<Array<MikronoAppointmentTypeRest>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/be_mikrono/appointmentTypes` + '?ts=' + new Date().getTime()\n let headers = 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 MikronoAppointmentTypeRest(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Create appointments for owner\n * @param body\n */\n createAppointments(body?: Array<AppointmentImport>): Promise<Array<string>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/be_mikrono/appointments` + '?ts=' + new Date().getTime()\n let headers = 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) => JSON.parse(JSON.stringify(it))))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Notify of an appointment change\n * @param appointmentId\n * @param action\n */\n notify(appointmentId: string, action: string): Promise<any | Boolean> {\n let _body = null\n\n const _url =\n this.host +\n `/be_mikrono/notify/${encodeURIComponent(String(appointmentId))}/${encodeURIComponent(String(action))}` +\n '?ts=' +\n new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => true)\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Set credentials for provided user\n * @param body\n * @param userId\n */\n register(userId: string, body?: MikronoCredentials): Promise<User> {\n let _body = null\n _body = body\n\n const _url = this.host + `/be_mikrono/user/${encodeURIComponent(String(userId))}/register` + '?ts=' + new Date().getTime()\n let headers = 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 User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Send message using mikrono from logged user\n * @param body\n */\n sendMessage(body?: EmailOrSmsMessage): Promise<Unit> {\n let _body = null\n _body = body\n\n const _url = this.host + `/be_mikrono/sendMessage` + '?ts=' + new Date().getTime()\n let headers = 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 Unit(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Set credentials for provided user\n * @param body\n * @param userId\n */\n setUserCredentials(userId: string, body?: MikronoCredentials): Promise<User> {\n let _body = null\n _body = body\n\n const _url = this.host + `/be_mikrono/user/${encodeURIComponent(String(userId))}/credentials` + '?ts=' + new Date().getTime()\n let headers = 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 User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
|