@icure/api 8.1.2 → 8.1.3
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/IccUserApi.d.ts +2 -0
- package/icc-api/api/IccUserApi.js +21 -0
- package/icc-api/api/IccUserApi.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.js +4 -4
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/package.json +1 -1
- package/test/icc-x-api/confidential-entities-test.js.map +1 -1
|
@@ -20,6 +20,7 @@ import { Unit } from '../model/Unit';
|
|
|
20
20
|
import { User } from '../model/User';
|
|
21
21
|
import { UserGroup } from '../model/UserGroup';
|
|
22
22
|
import { AuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider';
|
|
23
|
+
import { ListOfIds } from '../model/ListOfIds';
|
|
23
24
|
export declare class IccUserApi {
|
|
24
25
|
host: string;
|
|
25
26
|
headers: Array<XHR.Header>;
|
|
@@ -244,4 +245,5 @@ export declare class IccUserApi {
|
|
|
244
245
|
modifyUserInGroup(groupId: string, body?: User): Promise<User>;
|
|
245
246
|
enable2fa(userId: string, secret: string): Promise<void>;
|
|
246
247
|
disable2fa(userId: string): Promise<void>;
|
|
248
|
+
getUsers(body?: ListOfIds): Promise<Array<User>>;
|
|
247
249
|
}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.IccUserApi = void 0;
|
|
4
13
|
/**
|
|
@@ -541,6 +550,18 @@ class IccUserApi {
|
|
|
541
550
|
.then(() => { })
|
|
542
551
|
.catch((err) => this.handleError(err));
|
|
543
552
|
}
|
|
553
|
+
getUsers(body) {
|
|
554
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
555
|
+
let _body = null;
|
|
556
|
+
_body = body;
|
|
557
|
+
const _url = this.host + `/user/byIds` + '?ts=' + new Date().getTime();
|
|
558
|
+
let headers = yield this.headers;
|
|
559
|
+
headers = headers.filter((h) => h.header !== 'Content-Type').concat(new XHR_1.XHR.Header('Content-Type', 'application/json'));
|
|
560
|
+
return XHR_1.XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())
|
|
561
|
+
.then((doc) => doc.body.map((it) => new User_1.User(it)))
|
|
562
|
+
.catch((err) => this.handleError(err));
|
|
563
|
+
});
|
|
564
|
+
}
|
|
544
565
|
}
|
|
545
566
|
exports.IccUserApi = IccUserApi;
|
|
546
567
|
//# sourceMappingURL=IccUserApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IccUserApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccUserApi.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,+BAA2B;AAE3B,0DAAsD;AAEtD,kEAA8D;AAE9D,4DAAwD;AACxD,wCAAoC;AACpC,wCAAoC;AACpC,kDAA8C;AAC9C,wFAA8G;AAC9G,qDAAiD;AACjD,kDAA8C;AAE9C,MAAa,UAAU;IAMrB,YACE,IAAY,EACZ,OAAY,EACZ,sBAA+C,EAC/C,SAAyE;QAEzE,IAAI,CAAC,IAAI,GAAG,IAAA,+BAAc,EAAC,IAAI,CAAC,CAAA;QAChC,IAAI,CAAC,OAAO,GAAG,MAA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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,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,CAAC;aAC3H,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;aACd,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC;CACF;AAxlBD,gCAwlBC","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 { AbstractFilterUser } from '../model/AbstractFilterUser'\nimport { DocIdentifier } from '../model/DocIdentifier'\nimport { FilterChainUser } from '../model/FilterChainUser'\nimport { PaginatedListUser } from '../model/PaginatedListUser'\nimport { PropertyStub } from '../model/PropertyStub'\nimport { TokenWithGroup } from '../model/TokenWithGroup'\nimport { Unit } from '../model/Unit'\nimport { User } from '../model/User'\nimport { UserGroup } from '../model/UserGroup'\nimport { AuthenticationProvider, NoAuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider'\nimport { iccRestApiPath } from './IccRestApiPath'\nimport { ListOfIds } from '../model/ListOfIds'\n\nexport class IccUserApi {\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 = 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 * UserDto gets returned.\n * @summary Assign a healthcare party ID to current user\n * @param healthcarePartyId\n */\n assignHealthcareParty(healthcarePartyId: string): Promise<User> {\n let _body = null\n\n const _url = this.host + `/user/current/hcparty/${encodeURIComponent(String(healthcarePartyId))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\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 Check token validity\n * @param userId\n * @param token\n */\n checkTokenValidity(userId: string, token: string): Promise<boolean> {\n let _body = null\n\n const _url = this.host + `/user/token/${encodeURIComponent(String(userId))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n token && (headers = headers.concat(new XHR.Header('token', token)))\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Create a user. HealthcareParty ID should be set. Email or Login have to be set. If login hasn't been set, Email will be used for Login instead.\n * @summary Create a user\n * @param body\n */\n createUser(body?: User): Promise<User> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user` + '?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 User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Create a user. HealthcareParty ID should be set. Email has to be set and the Login has to be null. On server-side, Email will be used for Login.\n * @summary Create a user\n * @param body\n * @param groupId\n */\n createUserInGroup(groupId: string, body?: User): Promise<User> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user/inGroup/${encodeURIComponent(String(groupId))}` + '?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 User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Creates a new admin user in the group of the current user.\n * @param body the user to create.\n * @return a promise that will resolve to the created user.\n */\n createAdminUser(body?: User): Promise<User> {\n const _url = this.host + `/user/admin` + '?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 User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Creates a new admin user in a group of the current user.\n * @param body the user to create.\n * @param groupId the id of the group where to create the user.\n * @return a promise that will resolve to the created user.\n */\n createAdminUserInGroup(groupId: string, body?: User): Promise<User> {\n const _url = this.host + `/user/admin/inGroup/${encodeURIComponent(String(groupId))}` + '?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 User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Delete a User based on his/her ID. The return value is an array containing the ID of deleted user.\n * @summary Delete a User based on his/her ID.\n * @param userId\n */\n deleteUser(userId: string): Promise<DocIdentifier> {\n let _body = null\n\n const _url = this.host + `/user/${encodeURIComponent(String(userId))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('DELETE', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new DocIdentifier(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Delete a User based on his/her ID. The return value is an array containing the ID of deleted user.\n * @summary Delete a User based on his/her ID.\n * @param groupId\n * @param userId\n */\n deleteUserInGroup(groupId: string, userId: string): Promise<Unit> {\n let _body = null\n\n const _url =\n this.host + `/user/inGroup/${encodeURIComponent(String(groupId))}/${encodeURIComponent(String(userId))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('DELETE', _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 * @param password\n */\n encodePassword(password: string): Promise<string> {\n let _body = null\n\n const _url = this.host + `/user/encodePassword` + '?ts=' + new Date().getTime()\n let headers = this.headers\n password && (headers = headers.concat(new XHR.Header('password', password)))\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of users along with next start keys and Document ID. If the nextStartKey is Null it means that this is the last page.\n * @summary Filter users for the current user (HcParty)\n * @param body\n * @param startDocumentId A User document ID\n * @param limit Number of rows\n */\n filterUsersBy(startDocumentId?: string, limit?: number, body?: FilterChainUser): Promise<PaginatedListUser> {\n let _body = null\n _body = body\n\n const _url =\n this.host +\n `/user/filter` +\n '?ts=' +\n new Date().getTime() +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '')\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 PaginatedListUser(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of users along with next start keys and Document ID. If the nextStartKey is Null it means that this is the last page.\n * @summary Filter users for the current user (HcParty) for a provided groupId\n * @param body\n * @param groupId\n * @param startDocumentId A User document ID\n * @param limit Number of rows\n */\n filterUsersInGroupBy(groupId: string, startDocumentId?: string, limit?: number, body?: FilterChainUser): Promise<PaginatedListUser> {\n let _body = null\n _body = body\n\n const _url =\n this.host +\n `/user/filter/inGroup/${encodeURIComponent(String(groupId))}` +\n '?ts=' +\n new Date().getTime() +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '')\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 PaginatedListUser(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Get the list of users by healthcare party id\n * @param id\n */\n findByHcpartyId(id: string): Promise<Array<string>> {\n let _body = null\n\n const _url = this.host + `/user/byHealthcarePartyId/${encodeURIComponent(String(id))}` + '?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) => JSON.parse(JSON.stringify(it))))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Get the list of users by patient id\n * @param id\n */\n findByPatientId(id: string): Promise<Array<string>> {\n let _body = null\n\n const _url = this.host + `/user/byPatientId/${encodeURIComponent(String(id))}` + '?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) => JSON.parse(JSON.stringify(it))))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Get current user.\n * @summary Get presently logged-in user.\n */\n getCurrentUser(): Promise<User> {\n let _body = null\n\n const _url = this.host + `/user/current` + '?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) => new User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Get current user.\n * @summary Get presently logged-in user.\n */\n getMatchingUsers(): Promise<Array<UserGroup>> {\n let _body = null\n\n const _url = this.host + `/user/matches` + '?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 UserGroup(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Request a new temporary token for authentication\n * @param userId\n * @param key The token key. Only one instance of a token with a defined key can exist at the same time\n * @param tokenValidity The token validity in seconds\n * @param token\n */\n getToken(userId: string, key: string, tokenValidity?: number, token?: string): Promise<string> {\n let _body = null\n\n const _url =\n this.host +\n `/user/token/${encodeURIComponent(String(userId))}/${encodeURIComponent(String(key))}` +\n '?ts=' +\n new Date().getTime() +\n (tokenValidity ? '&tokenValidity=' + encodeURIComponent(String(tokenValidity)) : '')\n let headers = this.headers\n token && (headers = headers.concat(new XHR.Header('token', token)))\n return XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Require a new temporary token for authentication inside all groups\n * @param userIdentifier\n * @param key The token key. Only one instance of a token with a defined key can exist at the same time\n * @param token\n * @param tokenValidity The token validity in seconds\n */\n getTokenInAllGroups(userIdentifier: string, key: string, token?: string, tokenValidity?: number): Promise<Array<TokenWithGroup>> {\n let _body = null\n\n const _url =\n this.host +\n `/user/inAllGroups/token/${encodeURIComponent(String(userIdentifier))}/${encodeURIComponent(String(key))}` +\n '?ts=' +\n new Date().getTime() +\n (tokenValidity ? '&tokenValidity=' + encodeURIComponent(String(tokenValidity)) : '')\n let headers = this.headers\n token && (headers = headers.concat(new XHR.Header('token', token)))\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 TokenWithGroup(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Require a new temporary token for authentication inside provided group\n * @param groupId\n * @param userId\n * @param key The token key. Only one instance of a token with a defined key can exist at the same time\n * @param token\n * @param tokenValidity The token validity in seconds\n */\n getTokenInGroup(groupId: string, userId: string, key: string, token?: string, tokenValidity?: number): Promise<string> {\n let _body = null\n\n const _url =\n this.host +\n `/user/inGroup/${encodeURIComponent(String(groupId))}/token/${encodeURIComponent(String(userId))}/${encodeURIComponent(String(key))}` +\n '?ts=' +\n new Date().getTime() +\n (tokenValidity ? '&tokenValidity=' + encodeURIComponent(String(tokenValidity)) : '')\n let headers = this.headers\n token && (headers = headers.concat(new XHR.Header('token', token)))\n return XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * General information about the user\n * @summary Get a user by his ID\n * @param userId\n */\n getUser(userId: string): Promise<User> {\n let _body = null\n\n const _url = this.host + `/user/${encodeURIComponent(String(userId))}` + '?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) => new User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Sets the roles of a user to the ones passed as parameter.\n *\n * @param userId the Id of the user to update.\n * @param roleIds the ids of the roles to add to the user.\n */\n setRoles(userId: string, roleIds: string[]): Promise<User> {\n const _body = new ListOfIds({ ids: roleIds })\n\n const _url = this.host + `/user/${encodeURIComponent(userId)}/roles/set?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) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Sets the roles of a user in a group to the ones passed as parameter.\n *\n * @param userId the Id of the user to update.\n * @param groupId the Id of the group the user belongs to.\n * @param roleIds the ids of the roles to add to the user.\n */\n setRolesInGroup(userId: string, groupId: string, roleIds: string[]): Promise<User> {\n const _body = new ListOfIds({ ids: roleIds })\n\n const _url = this.host + `/user/${encodeURIComponent(userId)}/inGroup/${encodeURIComponent(groupId)}/roles/set?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) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Reset the roles of a user to the default ones for their type.\n *\n * @param userId the Id of the user to update.\n */\n resetRoles(userId: string): Promise<User> {\n const _url = this.host + `/user/${encodeURIComponent(userId)}/roles/reset?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, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Reset the roles of a user in a group to the default ones for their type.\n *\n * @param userId the Id of the user to update.\n * @param groupId the Id of the group the user belongs to.\n */\n resetRolesInGroup(userId: string, groupId: string): Promise<User> {\n const _url = this.host + `/user/${encodeURIComponent(userId)}/inGroup/${encodeURIComponent(groupId)}/roles/reset?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, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * General information about the user\n * @summary Get a user by his Email/Login\n * @param email\n */\n getUserByEmail(email: string): Promise<User> {\n let _body = null\n\n const _url = this.host + `/user/byEmail/${encodeURIComponent(String(email))}` + '?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) => new User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Get a user by his phone number.\n * @param phoneNumber\n * @return a promise that resolves to the specified user.\n */\n getUserByPhoneNumber(phoneNumber: string): Promise<User> {\n let _body = null\n\n const _url = this.host + `/user/byPhoneNumber/${encodeURIComponent(String(phoneNumber))}` + '?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) => new User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of users.\n * @summary List users with(out) pagination\n * @param startKey An user email\n * @param startDocumentId An user document ID\n * @param limit Number of rows\n * @param skipPatients Filter out patient users\n */\n listUsers(startKey?: string, startDocumentId?: string, limit?: number, skipPatients?: boolean): Promise<PaginatedListUser> {\n let _body = null\n\n const _url =\n this.host +\n `/user` +\n '?ts=' +\n new Date().getTime() +\n (startKey ? '&startKey=' + encodeURIComponent(String(startKey)) : '') +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '') +\n (skipPatients !== undefined ? '&skipPatients=' + encodeURIComponent(String(skipPatients)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListUser(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of users.\n * @summary List users with pagination\n * @param groupId\n * @param startKey An user login\n * @param startDocumentId An user document ID\n * @param limit Number of rows\n */\n listUsersInGroup(groupId: string, startKey?: string, startDocumentId?: string, limit?: number): Promise<PaginatedListUser> {\n let _body = null\n\n const _url =\n this.host +\n `/user/inGroup/${encodeURIComponent(String(groupId))}` +\n '?ts=' +\n new Date().getTime() +\n (startKey ? '&startKey=' + encodeURIComponent(String(startKey)) : '') +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListUser(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Get ids of healthcare party matching the provided filter for the current user (HcParty)\n * @param body\n */\n matchUsersBy(body?: AbstractFilterUser): Promise<Array<string>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user/match` + '?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 * Modify a User properties based on his/her ID. The return value is the modified user.\n * @summary Modify a User property\n * @param body\n * @param userId\n */\n modifyProperties(userId: string, body?: Array<PropertyStub>): Promise<User> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user/${encodeURIComponent(String(userId))}/properties` + '?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 * No particular return value. It's just a message.\n * @summary Modify a user.\n * @param body\n */\n modifyUser(body?: User): Promise<User> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user` + '?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 * No particular return value. It's just a message.\n * @summary Modify a user.\n * @param body\n * @param groupId\n */\n modifyUserInGroup(groupId: string, body?: User): Promise<User> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user/inGroup/${encodeURIComponent(String(groupId))}` + '?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 enable2fa(userId: string, secret: string): Promise<void> {\n let _body = { secret }\n\n const _url = this.host + `/user/${encodeURIComponent(String(userId))}/2fa` + '?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(() => {})\n .catch((err) => this.handleError(err))\n }\n\n disable2fa(userId: string): Promise<void> {\n const _url = this.host + `/user/${encodeURIComponent(String(userId))}/2fa` + '?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('DELETE', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then(() => {})\n .catch((err) => this.handleError(err))\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IccUserApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccUserApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,+BAA2B;AAE3B,0DAAsD;AAEtD,kEAA8D;AAE9D,4DAAwD;AACxD,wCAAoC;AACpC,wCAAoC;AACpC,kDAA8C;AAC9C,wFAA8G;AAC9G,qDAAiD;AACjD,kDAA8C;AAE9C,MAAa,UAAU;IAMrB,YACE,IAAY,EACZ,OAAY,EACZ,sBAA+C,EAC/C,SAAyE;QAEzE,IAAI,CAAC,IAAI,GAAG,IAAA,+BAAc,EAAC,IAAI,CAAC,CAAA;QAChC,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,C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,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC;IAEK,QAAQ,CAAC,IAAgB;;YAC7B,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,GAAG,IAAI,CAAA;YAEZ,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,aAAa,GAAG,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;YACtE,IAAI,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAA;YAChC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,cAAc,CAAC,CAAC,MAAM,CAAC,IAAI,SAAG,CAAC,MAAM,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC,CAAA;YACvH,OAAO,SAAG,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,CAAC;iBAC1H,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAE,GAAG,CAAC,IAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,WAAI,CAAC,EAAE,CAAC,CAAC,CAAC;iBAClE,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;QAC1C,CAAC;KAAA;CACF;AApmBD,gCAomBC","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 { AbstractFilterUser } from '../model/AbstractFilterUser'\nimport { DocIdentifier } from '../model/DocIdentifier'\nimport { FilterChainUser } from '../model/FilterChainUser'\nimport { PaginatedListUser } from '../model/PaginatedListUser'\nimport { PropertyStub } from '../model/PropertyStub'\nimport { TokenWithGroup } from '../model/TokenWithGroup'\nimport { Unit } from '../model/Unit'\nimport { User } from '../model/User'\nimport { UserGroup } from '../model/UserGroup'\nimport { AuthenticationProvider, NoAuthenticationProvider } from '../../icc-x-api/auth/AuthenticationProvider'\nimport { iccRestApiPath } from './IccRestApiPath'\nimport { ListOfIds } from '../model/ListOfIds'\n\nexport class IccUserApi {\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 = 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 * UserDto gets returned.\n * @summary Assign a healthcare party ID to current user\n * @param healthcarePartyId\n */\n assignHealthcareParty(healthcarePartyId: string): Promise<User> {\n let _body = null\n\n const _url = this.host + `/user/current/hcparty/${encodeURIComponent(String(healthcarePartyId))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\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 Check token validity\n * @param userId\n * @param token\n */\n checkTokenValidity(userId: string, token: string): Promise<boolean> {\n let _body = null\n\n const _url = this.host + `/user/token/${encodeURIComponent(String(userId))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n token && (headers = headers.concat(new XHR.Header('token', token)))\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Create a user. HealthcareParty ID should be set. Email or Login have to be set. If login hasn't been set, Email will be used for Login instead.\n * @summary Create a user\n * @param body\n */\n createUser(body?: User): Promise<User> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user` + '?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 User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Create a user. HealthcareParty ID should be set. Email has to be set and the Login has to be null. On server-side, Email will be used for Login.\n * @summary Create a user\n * @param body\n * @param groupId\n */\n createUserInGroup(groupId: string, body?: User): Promise<User> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user/inGroup/${encodeURIComponent(String(groupId))}` + '?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 User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Creates a new admin user in the group of the current user.\n * @param body the user to create.\n * @return a promise that will resolve to the created user.\n */\n createAdminUser(body?: User): Promise<User> {\n const _url = this.host + `/user/admin` + '?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 User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Creates a new admin user in a group of the current user.\n * @param body the user to create.\n * @param groupId the id of the group where to create the user.\n * @return a promise that will resolve to the created user.\n */\n createAdminUserInGroup(groupId: string, body?: User): Promise<User> {\n const _url = this.host + `/user/admin/inGroup/${encodeURIComponent(String(groupId))}` + '?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 User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Delete a User based on his/her ID. The return value is an array containing the ID of deleted user.\n * @summary Delete a User based on his/her ID.\n * @param userId\n */\n deleteUser(userId: string): Promise<DocIdentifier> {\n let _body = null\n\n const _url = this.host + `/user/${encodeURIComponent(String(userId))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('DELETE', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new DocIdentifier(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Delete a User based on his/her ID. The return value is an array containing the ID of deleted user.\n * @summary Delete a User based on his/her ID.\n * @param groupId\n * @param userId\n */\n deleteUserInGroup(groupId: string, userId: string): Promise<Unit> {\n let _body = null\n\n const _url =\n this.host + `/user/inGroup/${encodeURIComponent(String(groupId))}/${encodeURIComponent(String(userId))}` + '?ts=' + new Date().getTime()\n let headers = this.headers\n return XHR.sendCommand('DELETE', _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 * @param password\n */\n encodePassword(password: string): Promise<string> {\n let _body = null\n\n const _url = this.host + `/user/encodePassword` + '?ts=' + new Date().getTime()\n let headers = this.headers\n password && (headers = headers.concat(new XHR.Header('password', password)))\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of users along with next start keys and Document ID. If the nextStartKey is Null it means that this is the last page.\n * @summary Filter users for the current user (HcParty)\n * @param body\n * @param startDocumentId A User document ID\n * @param limit Number of rows\n */\n filterUsersBy(startDocumentId?: string, limit?: number, body?: FilterChainUser): Promise<PaginatedListUser> {\n let _body = null\n _body = body\n\n const _url =\n this.host +\n `/user/filter` +\n '?ts=' +\n new Date().getTime() +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '')\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 PaginatedListUser(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of users along with next start keys and Document ID. If the nextStartKey is Null it means that this is the last page.\n * @summary Filter users for the current user (HcParty) for a provided groupId\n * @param body\n * @param groupId\n * @param startDocumentId A User document ID\n * @param limit Number of rows\n */\n filterUsersInGroupBy(groupId: string, startDocumentId?: string, limit?: number, body?: FilterChainUser): Promise<PaginatedListUser> {\n let _body = null\n _body = body\n\n const _url =\n this.host +\n `/user/filter/inGroup/${encodeURIComponent(String(groupId))}` +\n '?ts=' +\n new Date().getTime() +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '')\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 PaginatedListUser(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Get the list of users by healthcare party id\n * @param id\n */\n findByHcpartyId(id: string): Promise<Array<string>> {\n let _body = null\n\n const _url = this.host + `/user/byHealthcarePartyId/${encodeURIComponent(String(id))}` + '?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) => JSON.parse(JSON.stringify(it))))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Get the list of users by patient id\n * @param id\n */\n findByPatientId(id: string): Promise<Array<string>> {\n let _body = null\n\n const _url = this.host + `/user/byPatientId/${encodeURIComponent(String(id))}` + '?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) => JSON.parse(JSON.stringify(it))))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Get current user.\n * @summary Get presently logged-in user.\n */\n getCurrentUser(): Promise<User> {\n let _body = null\n\n const _url = this.host + `/user/current` + '?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) => new User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Get current user.\n * @summary Get presently logged-in user.\n */\n getMatchingUsers(): Promise<Array<UserGroup>> {\n let _body = null\n\n const _url = this.host + `/user/matches` + '?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 UserGroup(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Request a new temporary token for authentication\n * @param userId\n * @param key The token key. Only one instance of a token with a defined key can exist at the same time\n * @param tokenValidity The token validity in seconds\n * @param token\n */\n getToken(userId: string, key: string, tokenValidity?: number, token?: string): Promise<string> {\n let _body = null\n\n const _url =\n this.host +\n `/user/token/${encodeURIComponent(String(userId))}/${encodeURIComponent(String(key))}` +\n '?ts=' +\n new Date().getTime() +\n (tokenValidity ? '&tokenValidity=' + encodeURIComponent(String(tokenValidity)) : '')\n let headers = this.headers\n token && (headers = headers.concat(new XHR.Header('token', token)))\n return XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Require a new temporary token for authentication inside all groups\n * @param userIdentifier\n * @param key The token key. Only one instance of a token with a defined key can exist at the same time\n * @param token\n * @param tokenValidity The token validity in seconds\n */\n getTokenInAllGroups(userIdentifier: string, key: string, token?: string, tokenValidity?: number): Promise<Array<TokenWithGroup>> {\n let _body = null\n\n const _url =\n this.host +\n `/user/inAllGroups/token/${encodeURIComponent(String(userIdentifier))}/${encodeURIComponent(String(key))}` +\n '?ts=' +\n new Date().getTime() +\n (tokenValidity ? '&tokenValidity=' + encodeURIComponent(String(tokenValidity)) : '')\n let headers = this.headers\n token && (headers = headers.concat(new XHR.Header('token', token)))\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 TokenWithGroup(it)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Require a new temporary token for authentication inside provided group\n * @param groupId\n * @param userId\n * @param key The token key. Only one instance of a token with a defined key can exist at the same time\n * @param token\n * @param tokenValidity The token validity in seconds\n */\n getTokenInGroup(groupId: string, userId: string, key: string, token?: string, tokenValidity?: number): Promise<string> {\n let _body = null\n\n const _url =\n this.host +\n `/user/inGroup/${encodeURIComponent(String(groupId))}/token/${encodeURIComponent(String(userId))}/${encodeURIComponent(String(key))}` +\n '?ts=' +\n new Date().getTime() +\n (tokenValidity ? '&tokenValidity=' + encodeURIComponent(String(tokenValidity)) : '')\n let headers = this.headers\n token && (headers = headers.concat(new XHR.Header('token', token)))\n return XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * General information about the user\n * @summary Get a user by his ID\n * @param userId\n */\n getUser(userId: string): Promise<User> {\n let _body = null\n\n const _url = this.host + `/user/${encodeURIComponent(String(userId))}` + '?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) => new User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Sets the roles of a user to the ones passed as parameter.\n *\n * @param userId the Id of the user to update.\n * @param roleIds the ids of the roles to add to the user.\n */\n setRoles(userId: string, roleIds: string[]): Promise<User> {\n const _body = new ListOfIds({ ids: roleIds })\n\n const _url = this.host + `/user/${encodeURIComponent(userId)}/roles/set?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) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Sets the roles of a user in a group to the ones passed as parameter.\n *\n * @param userId the Id of the user to update.\n * @param groupId the Id of the group the user belongs to.\n * @param roleIds the ids of the roles to add to the user.\n */\n setRolesInGroup(userId: string, groupId: string, roleIds: string[]): Promise<User> {\n const _body = new ListOfIds({ ids: roleIds })\n\n const _url = this.host + `/user/${encodeURIComponent(userId)}/inGroup/${encodeURIComponent(groupId)}/roles/set?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) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Reset the roles of a user to the default ones for their type.\n *\n * @param userId the Id of the user to update.\n */\n resetRoles(userId: string): Promise<User> {\n const _url = this.host + `/user/${encodeURIComponent(userId)}/roles/reset?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, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Reset the roles of a user in a group to the default ones for their type.\n *\n * @param userId the Id of the user to update.\n * @param groupId the Id of the group the user belongs to.\n */\n resetRolesInGroup(userId: string, groupId: string): Promise<User> {\n const _url = this.host + `/user/${encodeURIComponent(userId)}/inGroup/${encodeURIComponent(groupId)}/roles/reset?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, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * General information about the user\n * @summary Get a user by his Email/Login\n * @param email\n */\n getUserByEmail(email: string): Promise<User> {\n let _body = null\n\n const _url = this.host + `/user/byEmail/${encodeURIComponent(String(email))}` + '?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) => new User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * @summary Get a user by his phone number.\n * @param phoneNumber\n * @return a promise that resolves to the specified user.\n */\n getUserByPhoneNumber(phoneNumber: string): Promise<User> {\n let _body = null\n\n const _url = this.host + `/user/byPhoneNumber/${encodeURIComponent(String(phoneNumber))}` + '?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) => new User(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of users.\n * @summary List users with(out) pagination\n * @param startKey An user email\n * @param startDocumentId An user document ID\n * @param limit Number of rows\n * @param skipPatients Filter out patient users\n */\n listUsers(startKey?: string, startDocumentId?: string, limit?: number, skipPatients?: boolean): Promise<PaginatedListUser> {\n let _body = null\n\n const _url =\n this.host +\n `/user` +\n '?ts=' +\n new Date().getTime() +\n (startKey ? '&startKey=' + encodeURIComponent(String(startKey)) : '') +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '') +\n (skipPatients !== undefined ? '&skipPatients=' + encodeURIComponent(String(skipPatients)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListUser(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n * Returns a list of users.\n * @summary List users with pagination\n * @param groupId\n * @param startKey An user login\n * @param startDocumentId An user document ID\n * @param limit Number of rows\n */\n listUsersInGroup(groupId: string, startKey?: string, startDocumentId?: string, limit?: number): Promise<PaginatedListUser> {\n let _body = null\n\n const _url =\n this.host +\n `/user/inGroup/${encodeURIComponent(String(groupId))}` +\n '?ts=' +\n new Date().getTime() +\n (startKey ? '&startKey=' + encodeURIComponent(String(startKey)) : '') +\n (startDocumentId ? '&startDocumentId=' + encodeURIComponent(String(startDocumentId)) : '') +\n (limit ? '&limit=' + encodeURIComponent(String(limit)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then((doc) => new PaginatedListUser(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Get ids of healthcare party matching the provided filter for the current user (HcParty)\n * @param body\n */\n matchUsersBy(body?: AbstractFilterUser): Promise<Array<string>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user/match` + '?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 * Modify a User properties based on his/her ID. The return value is the modified user.\n * @summary Modify a User property\n * @param body\n * @param userId\n */\n modifyProperties(userId: string, body?: Array<PropertyStub>): Promise<User> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user/${encodeURIComponent(String(userId))}/properties` + '?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 * No particular return value. It's just a message.\n * @summary Modify a user.\n * @param body\n */\n modifyUser(body?: User): Promise<User> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user` + '?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 * No particular return value. It's just a message.\n * @summary Modify a user.\n * @param body\n * @param groupId\n */\n modifyUserInGroup(groupId: string, body?: User): Promise<User> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user/inGroup/${encodeURIComponent(String(groupId))}` + '?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 enable2fa(userId: string, secret: string): Promise<void> {\n let _body = { secret }\n\n const _url = this.host + `/user/${encodeURIComponent(String(userId))}/2fa` + '?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(() => {})\n .catch((err) => this.handleError(err))\n }\n\n disable2fa(userId: string): Promise<void> {\n const _url = this.host + `/user/${encodeURIComponent(String(userId))}/2fa` + '?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('DELETE', _url, headers, null, this.fetchImpl, undefined, this.authenticationProvider.getAuthService())\n .then(() => {})\n .catch((err) => this.handleError(err))\n }\n\n async getUsers(body?: ListOfIds): Promise<Array<User>> {\n let _body = null\n _body = body\n\n const _url = this.host + `/user/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 User(it)))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
|
|
@@ -48,15 +48,15 @@ class IccAccesslogXApi extends icc_api_1.IccAccesslogApi {
|
|
|
48
48
|
* @return a new instance of access log.
|
|
49
49
|
*/
|
|
50
50
|
newInstance(user, patient, h, options = {}) {
|
|
51
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
52
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
53
|
const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
54
|
-
const accessLog = Object.assign(Object.assign({}, (h !== null && h !== void 0 ? h : {})), { _type: 'org.taktik.icure.entities.AccessLog', id: (_a = h === null || h === void 0 ? void 0 : h.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = h === null || h === void 0 ? void 0 : h.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = h === null || h === void 0 ? void 0 : h.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), date: (_d = h === null || h === void 0 ? void 0 : h.date) !== null && _d !== void 0 ? _d : new Date().getTime(), responsible: (_e = h === null || h === void 0 ? void 0 : h.responsible) !== null && _e !== void 0 ? _e : (this.autofillAuthor ? dataOwnerId : undefined), author: (_f = h === null || h === void 0 ? void 0 : h.author) !== null && _f !== void 0 ? _f : (this.autofillAuthor ? user.id : undefined), codes: (_g = h === null || h === void 0 ? void 0 : h.codes) !== null && _g !== void 0 ? _g : [], tags: (_h = h === null || h === void 0 ? void 0 : h.tags) !== null && _h !== void 0 ? _h : [], user: (_j = h === null || h === void 0 ? void 0 : h.user) !== null && _j !== void 0 ? _j : user.id,
|
|
54
|
+
const accessLog = Object.assign(Object.assign({}, (h !== null && h !== void 0 ? h : {})), { _type: 'org.taktik.icure.entities.AccessLog', id: (_a = h === null || h === void 0 ? void 0 : h.id) !== null && _a !== void 0 ? _a : this.crypto.primitives.randomUuid(), created: (_b = h === null || h === void 0 ? void 0 : h.created) !== null && _b !== void 0 ? _b : new Date().getTime(), modified: (_c = h === null || h === void 0 ? void 0 : h.modified) !== null && _c !== void 0 ? _c : new Date().getTime(), date: (_d = h === null || h === void 0 ? void 0 : h.date) !== null && _d !== void 0 ? _d : new Date().getTime(), responsible: (_e = h === null || h === void 0 ? void 0 : h.responsible) !== null && _e !== void 0 ? _e : (this.autofillAuthor ? dataOwnerId : undefined), author: (_f = h === null || h === void 0 ? void 0 : h.author) !== null && _f !== void 0 ? _f : (this.autofillAuthor ? user.id : undefined), codes: (_g = h === null || h === void 0 ? void 0 : h.codes) !== null && _g !== void 0 ? _g : [], tags: (_h = h === null || h === void 0 ? void 0 : h.tags) !== null && _h !== void 0 ? _h : [], user: (_j = h === null || h === void 0 ? void 0 : h.user) !== null && _j !== void 0 ? _j : user.id, accessType: (_k = h === null || h === void 0 ? void 0 : h.accessType) !== null && _k !== void 0 ? _k : 'USER_ACCESS' });
|
|
55
55
|
const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
56
56
|
if (ownerId !== (yield this.dataOwnerApi.getCurrentDataOwnerId()))
|
|
57
57
|
throw new Error('Can only initialise entities as current data owner.');
|
|
58
|
-
const sfk = yield this.crypto.xapi.resolveSecretIdUseOptions({ entity: patient, type: utils_1.EntityWithDelegationTypeName.Patient }, (
|
|
59
|
-
const extraDelegations = Object.assign(Object.assign({}, Object.fromEntries([...((
|
|
58
|
+
const sfk = yield this.crypto.xapi.resolveSecretIdUseOptions({ entity: patient, type: utils_1.EntityWithDelegationTypeName.Patient }, (_l = options.sfkOption) !== null && _l !== void 0 ? _l : SecretIdUseOption_1.SecretIdUseOption.UseAnySharedWithParent);
|
|
59
|
+
const extraDelegations = Object.assign(Object.assign({}, Object.fromEntries([...((_o = (_m = user.autoDelegations) === null || _m === void 0 ? void 0 : _m.all) !== null && _o !== void 0 ? _o : []), ...((_q = (_p = user.autoDelegations) === null || _p === void 0 ? void 0 : _p.administrativeData) !== null && _q !== void 0 ? _q : [])].map((x) => [x, AccessLevelEnum.WRITE]))), ((_r = options.additionalDelegates) !== null && _r !== void 0 ? _r : {}));
|
|
60
60
|
return new models_1.AccessLog(yield this.crypto.xapi
|
|
61
61
|
.entityWithInitialisedEncryptedMetadata(accessLog, utils_1.EntityWithDelegationTypeName.AccessLog, patient.id, sfk, true, extraDelegations)
|
|
62
62
|
.then((x) => x.updatedEntity));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icc-accesslog-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-accesslog-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA4C;AAG5C,oDAAsF;AACtF,4BAA2B;AAE3B,0EAAgG;AAChG,wEAAoE;AAKpE,mCAAqG;AAErG,kEAA8D;AAC9D,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAOzD,MAAa,gBAAiB,SAAQ,yBAAe;IAKnD,IAAI,OAAO;QACT,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,2BAA2B,CAAC,CAAC,EAAE,oCAA4B,CAAC,SAAS,CAAC,CAAC,CAAA;IAC/I,CAAC;IAED,YACE,IAAY,EACZ,OAAkC,EAClC,MAAqB,EACrB,YAA8B,EACb,cAAuB,EACxC,WAAW,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,EACpC,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;QATtC,mBAAc,GAAd,cAAc,CAAS;QAUxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,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c-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport * as models from '../icc-api/model/models'\nimport { AccessLog, ListOfIds, PaginatedListAccessLog } from '../icc-api/model/models'\nimport * as _ from 'lodash'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport { ShareResult } from './utils/ShareResult'\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedFieldsManifest, EntityWithDelegationTypeName, parseEncryptedFields } from './utils'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\n\nexport interface AccessLogWithPatientId extends AccessLog {\n patientId: string\n}\n\nexport class IccAccesslogXApi extends IccAccesslogApi implements EncryptedEntityXApi<models.AccessLog> {\n private readonly encryptedFields: EncryptedFieldsManifest\n crypto: IccCryptoXApi\n dataOwnerApi: IccDataOwnerXApi\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.AccessLog))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\n private readonly autofillAuthor: boolean,\n cryptedKeys = ['detail', 'objectId'],\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.crypto = crypto\n this.dataOwnerApi = dataOwnerApi\n this.encryptedFields = parseEncryptedFields(cryptedKeys, 'AccessLog.')\n }\n\n /**\n * Creates a new instance of access log with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this access log refers to.\n * @param h initialised data for the access log. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with\n * auto-delegations, in such case the access level specified here will be used.\n * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the access log. The default value will be a\n * secret id of patient known by the topmost parent in the current data owner hierarchy.\n * @return a new instance of access log.\n */\n async newInstance(\n user: models.User,\n patient: models.Patient,\n h: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n } = {}\n ) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n const accessLog = {\n ...(h ?? {}),\n _type: 'org.taktik.icure.entities.AccessLog',\n id: h?.id ?? this.crypto.primitives.randomUuid(),\n created: h?.created ?? new Date().getTime(),\n modified: h?.modified ?? new Date().getTime(),\n date: h?.date ?? new Date().getTime(),\n responsible: h?.responsible ?? (this.autofillAuthor ? dataOwnerId : undefined),\n author: h?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: h?.codes ?? [],\n tags: h?.tags ?? [],\n user: h?.user ?? user.id,\n patientId: h?.patientId ?? patient.id,\n accessType: h?.accessType ?? 'USER_ACCESS',\n }\n\n const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (ownerId !== (await this.dataOwnerApi.getCurrentDataOwnerId())) throw new Error('Can only initialise entities as current data owner.')\n const sfk = await this.crypto.xapi.resolveSecretIdUseOptions(\n { entity: patient, type: EntityWithDelegationTypeName.Patient },\n options.sfkOption ?? SecretIdUseOption.UseAnySharedWithParent\n )\n const extraDelegations = {\n ...Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.administrativeData ?? [])].map((x) => [x, AccessLevelEnum.WRITE])\n ),\n ...(options.additionalDelegates ?? {}),\n }\n return new AccessLog(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(accessLog, EntityWithDelegationTypeName.AccessLog, patient.id, sfk, true, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * 1. Check whether there is a delegation with 'hcpartyId' or not.\n * 2. 'fetchHcParty[hcpartyId][1]': is encrypted AES exchange key by RSA public key of him.\n * 3. Obtain the AES exchange key, by decrypting the previous step value with hcparty private key\n * 3.1. KeyPair should be fetch from cache (in jwk)\n * 3.2. if it doesn't exist in the cache, it has to be loaded from Browser Local store, and then import it to WebCrypto\n * 4. Obtain the array of delegations which are delegated to his ID (hcpartyId) in this patient\n * 5. Decrypt and collect all keys (secretForeignKeys) within delegations of previous step (with obtained AES key of step 4)\n * 6. Do the REST call to get all access logs with (allSecretForeignKeysDelimitedByComma, hcpartyId)\n *\n * After these painful steps, you have the access logs of the patient.\n *\n * @deprecated use {@link findIdsBy} instead\n * @param hcpartyId\n * @param patient (Promise)\n * @param usingPost\n */\n async findBy(hcpartyId: string, patient: models.Patient, usingPost: boolean = false): Promise<models.AccessLog[]> {\n const extractedKeys = await this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }, hcpartyId)\n const topmostParentId = (await this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0]\n return extractedKeys && extractedKeys.length > 0\n ? usingPost\n ? this.findByHCPartyPatientSecretFKeysArray(hcpartyId!, _.uniq(extractedKeys))\n : this.findByHCPartyPatientSecretFKeys(hcpartyId!, _.uniq(extractedKeys).join(','))\n : Promise.resolve([])\n }\n\n /**\n * Same as `findBy` but it will only return the ids of the access logs. It can also filter the access logs where AccessLog.date is between\n * startDate and endDate in ascending or descending order by that field. (default: ascending).\n */\n async findIdsBy(hcpartyId: string, patient: models.Patient, startDate?: number, endDate?: number, descending?: boolean): Promise<string[]> {\n const extractedKeys = await this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }, hcpartyId)\n return extractedKeys && extractedKeys.length > 0\n ? this.findAccessLogIdsByDataOwnerPatientDate(hcpartyId, _.uniq(extractedKeys), startDate, endDate, descending)\n : Promise.resolve([])\n }\n\n /**\n * @deprecated use {@link findAccessLogIdsByDataOwnerPatientDate} instead\n */\n async findByHCPartyPatientSecretFKeys(hcPartyId: string, secretFKeys: string): Promise<AccessLog[]> {\n const accessLogs = await super.findAccessLogsByHCPartyPatientForeignKeys(hcPartyId, secretFKeys)\n return await this.decrypt(hcPartyId, accessLogs)\n }\n\n /**\n * @deprecated use {@link findAccessLogIdsByDataOwnerPatientDate} instead\n */\n findByHCPartyPatientSecretFKeysArray(hcPartyId: string, secretFKeys: string[]): Promise<Array<AccessLog> | any> {\n return super.findAccessLogsByHCPartyPatientForeignKeysUsingPost(hcPartyId, secretFKeys).then((accesslogs) => this.decrypt(hcPartyId, accesslogs))\n }\n\n async decrypt(hcpId: string, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n return (await this.crypto.xapi.tryDecryptEntities(accessLogs, EntityWithDelegationTypeName.AccessLog, (json) => new AccessLog(json))).map(\n ({ entity }) => entity\n )\n }\n\n encrypt(user: models.User, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n const owner = this.dataOwnerApi.getDataOwnerIdOf(user)\n return this.encryptAs(owner, accessLogs)\n }\n\n private async encryptAs(dataOwner: string, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n return this.crypto.xapi.tryEncryptEntities(\n accessLogs,\n EntityWithDelegationTypeName.AccessLog,\n this.encryptedFields,\n false,\n false,\n (json) => new AccessLog(json)\n )\n }\n\n createAccessLog(body?: models.AccessLog): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n createAccessLogWithUser(user: models.User, body?: models.AccessLog): Promise<models.AccessLog | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((als) => super.createAccessLog(als[0]))\n .then((accessLog) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [accessLog]))\n .then((als) => als[0])\n : Promise.resolve()\n }\n\n getAccessLog(accessLogId: string): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n getAccessLogWithUser(user: models.User, accessLogId: string): Promise<models.AccessLog | any> {\n return super\n .getAccessLog(accessLogId)\n .then((accessLog) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [accessLog]))\n .then((als) => als[0])\n }\n\n async getAccessLogs(ids: ListOfIds): Promise<AccessLog[]> {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n getAccessLogsWithUser(user: models.User, ids: ListOfIds): Promise<AccessLog[]> {\n return super.getAccessLogs(ids).then((accessLogs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLogs))\n }\n\n listAccessLogs(fromEpoch?: number, toEpoch?: number, startKey?: number, startDocumentId?: string, limit?: number): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n listAccessLogsWithUser(\n user: models.User,\n fromEpoch?: number,\n toEpoch?: number,\n startKey?: number,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): Promise<PaginatedListAccessLog> {\n return super\n .listAccessLogs(fromEpoch, toEpoch, startKey, startDocumentId, limit, descending)\n .then((accessLog) =>\n this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLog.rows!).then((dr) => Object.assign(accessLog, { rows: dr }))\n )\n }\n\n modifyAccessLog(body?: models.AccessLog): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n async modifyAccessLogWithUser(user: models.User, body?: models.AccessLog): Promise<models.AccessLog | null> {\n return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, _.cloneDeep(body)) : null\n }\n\n private async modifyAs(owner: string, body: models.AccessLog): Promise<models.AccessLog> {\n return this.encryptAs(owner, [_.cloneDeep(body)])\n .then((als) => super.modifyAccessLog(als[0]))\n .then((accessLog) => this.decrypt(owner, [accessLog]))\n .then((als) => als[0])\n }\n\n findByUserAfterDate(\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n findByUserAfterDateWithUser(\n user: models.User,\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): Promise<models.AccessLog | any> {\n return super\n .findByUserAfterDate(userId, accessType, startDate, startKey, startDocumentId, limit, descending)\n .then((accessLog) =>\n this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLog.rows!).then((dr) => Object.assign(accessLog, { rows: dr }))\n )\n }\n\n async findLatestAccessLogsOfPatientsWithUser(user: models.User, userId: string, limit = 100, startDate?: number): Promise<models.AccessLog[]> {\n let foundAccessLogs: AccessLogWithPatientId[] = [],\n nextKeyPair: models.PaginatedDocumentKeyIdPairObject | undefined = undefined\n const numberRequestedAccessLogs = 100\n const MAX_WHILE_ITERATIONS = 5\n\n for (let currentIteration = 0; foundAccessLogs.length < limit && currentIteration < MAX_WHILE_ITERATIONS; currentIteration++) {\n const currentLimit = limit - foundAccessLogs.length\n const { rows: logs, nextKeyPair: newNextKeyPair }: models.PaginatedListAccessLog = (await super.findByUserAfterDate(\n userId,\n 'USER_ACCESS',\n startDate,\n nextKeyPair && JSON.stringify(nextKeyPair.startKey!),\n nextKeyPair && nextKeyPair.startKeyDocId!,\n numberRequestedAccessLogs,\n true\n )) as models.PaginatedListAccessLog\n const logsWithPatientId: AccessLogWithPatientId[] = await this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, logs as AccessLog[]).then(\n (decryptedLogs) =>\n Promise.all(\n _.map(decryptedLogs, (decryptedLog) => {\n return this.crypto.xapi\n .owningEntityIdsOf({ entity: decryptedLog, type: EntityWithDelegationTypeName.AccessLog }, user.healthcarePartyId as string)\n .then(\n (keys) =>\n ({\n ...decryptedLog,\n patientId: _.head(keys),\n } as AccessLogWithPatientId)\n )\n })\n )\n )\n\n const uniqueLogs: AccessLogWithPatientId[] = _.chain(logsWithPatientId)\n .reject((log) => _.some(foundAccessLogs, ({ patientId }) => patientId === log.patientId))\n .uniqBy((log: AccessLogWithPatientId) => log.patientId)\n .value()\n .slice(0, currentLimit)\n\n foundAccessLogs = [...foundAccessLogs, ...uniqueLogs]\n\n if ((logs || []).length < numberRequestedAccessLogs) {\n break\n } else if (newNextKeyPair) {\n nextKeyPair = newNextKeyPair\n } else {\n break\n }\n }\n\n return foundAccessLogs\n }\n\n /**\n * @param accessLog an access log\n * @return the id of the patient that the access log refers to, retrieved from the encrypted metadata (not from the decrypted entity body). Normally\n * there should only be one element in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(accessLog: AccessLog): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: accessLog, type: EntityWithDelegationTypeName.AccessLog }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given access log\n */\n async hasWriteAccess(accessLog: AccessLog): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: accessLog, type: EntityWithDelegationTypeName.AccessLog })\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param delegateId the id of the data owner which will be granted access to the access log.\n * @param accessLog the access log to share.\n * @param options optional parameters to customize the sharing behaviour:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWith(\n delegateId: string,\n accessLog: AccessLog,\n options: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<AccessLog> {\n return this.shareWithMany(accessLog, { [delegateId]: options })\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param accessLog the access log to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWithMany(\n accessLog: AccessLog,\n delegates: {\n [delegateId: string]: {\n shareSecretId?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<AccessLog> {\n return (await this.tryShareWithMany(accessLog, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param accessLog the access log to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return a promise which will contain the result of the operation: the updated entity if the operation was successful or details of the error if\n * the operation failed.\n */\n async tryShareWithMany(\n accessLog: AccessLog,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<AccessLog>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(accessLog, EntityWithDelegationTypeName.AccessLog)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyAs(self, entityWithEncryptionKey) : accessLog\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.AccessLog,\n },\n Object.fromEntries(\n Object.entries(delegates).map(([delegateId, options]) => [\n delegateId,\n {\n requestedPermissions: options.requestedPermissions,\n shareEncryptionKeys: options.shareEncryptionKey,\n shareOwningEntityIds: options.sharePatientId,\n shareSecretIds: options.shareSecretIds,\n },\n ])\n ),\n (x) => this.bulkShareAccessLogs(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: AccessLog\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.AccessLog })\n }\n\n getEncryptionKeysOf(entity: AccessLog): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.AccessLog }, undefined)\n }\n\n createDelegationDeAnonymizationMetadata(entity: AccessLog, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo(\n { entity, type: EntityWithDelegationTypeName.AccessLog },\n delegates\n )\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"icc-accesslog-x-api.js","sourceRoot":"","sources":["../../icc-x-api/icc-accesslog-x-api.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA4C;AAG5C,oDAAsF;AACtF,4BAA2B;AAE3B,0EAAgG;AAChG,wEAAoE;AAKpE,mCAAqG;AAErG,kEAA8D;AAC9D,IAAO,eAAe,GAAG,mCAAgB,CAAC,eAAe,CAAA;AAOzD,MAAa,gBAAiB,SAAQ,yBAAe;IAKnD,IAAI,OAAO;QACT,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,2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C,SAAS,EAAE,CAAC,CAAA;IACnI,CAAC;IAED,mBAAmB,CAAC,MAAiB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,SAAS,EAAE,EAAE,SAAS,CAAC,CAAA;IAC/G,CAAC;IAED,uCAAuC,CAAC,MAAiB,EAAE,SAAmB;QAC5E,OAAO,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,iCAAiC,CAC7E,EAAE,MAAM,EAAE,IAAI,EAAE,oCAA4B,CAAC,SAAS,EAAE,EACxD,SAAS,CACV,CAAA;IACH,CAAC;CACF;AArcD,4CAqcC","sourcesContent":["import { IccAccesslogApi } from '../icc-api'\nimport { IccCryptoXApi } from './icc-crypto-x-api'\nimport * as models from '../icc-api/model/models'\nimport { AccessLog, ListOfIds, PaginatedListAccessLog } from '../icc-api/model/models'\nimport * as _ from 'lodash'\nimport { IccDataOwnerXApi } from './icc-data-owner-x-api'\nimport { AuthenticationProvider, NoAuthenticationProvider } from './auth/AuthenticationProvider'\nimport { SecureDelegation } from '../icc-api/model/SecureDelegation'\nimport { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour'\nimport { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest'\nimport { ShareResult } from './utils/ShareResult'\nimport { XHR } from '../icc-api/api/XHR'\nimport { EncryptedFieldsManifest, EntityWithDelegationTypeName, parseEncryptedFields } from './utils'\nimport { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi'\nimport { SecretIdUseOption } from './crypto/SecretIdUseOption'\nimport AccessLevelEnum = SecureDelegation.AccessLevelEnum\nimport RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum\n\nexport interface AccessLogWithPatientId extends AccessLog {\n patientId: string\n}\n\nexport class IccAccesslogXApi extends IccAccesslogApi implements EncryptedEntityXApi<models.AccessLog> {\n private readonly encryptedFields: EncryptedFieldsManifest\n crypto: IccCryptoXApi\n dataOwnerApi: IccDataOwnerXApi\n\n get headers(): Promise<Array<XHR.Header>> {\n return super.headers.then((h) => this.crypto.accessControlKeysHeaders.addAccessControlKeysHeaders(h, EntityWithDelegationTypeName.AccessLog))\n }\n\n constructor(\n host: string,\n headers: { [key: string]: string },\n crypto: IccCryptoXApi,\n dataOwnerApi: IccDataOwnerXApi,\n private readonly autofillAuthor: boolean,\n cryptedKeys = ['detail', 'objectId'],\n authenticationProvider: AuthenticationProvider = new NoAuthenticationProvider(),\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ) {\n super(host, headers, authenticationProvider, fetchImpl)\n this.crypto = crypto\n this.dataOwnerApi = dataOwnerApi\n this.encryptedFields = parseEncryptedFields(cryptedKeys, 'AccessLog.')\n }\n\n /**\n * Creates a new instance of access log with initialised encryption metadata (not in the database).\n * @param user the current user.\n * @param patient the patient this access log refers to.\n * @param h initialised data for the access log. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify\n * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.\n * @param options optional parameters:\n * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the\n * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with\n * auto-delegations, in such case the access level specified here will be used.\n * - preferredSfk: secret id of the patient to use as the secret foreign key to use for the access log. The default value will be a\n * secret id of patient known by the topmost parent in the current data owner hierarchy.\n * @return a new instance of access log.\n */\n async newInstance(\n user: models.User,\n patient: models.Patient,\n h: any,\n options: {\n additionalDelegates?: { [dataOwnerId: string]: AccessLevelEnum }\n sfkOption?: SecretIdUseOption\n } = {}\n ) {\n const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n const accessLog = {\n ...(h ?? {}),\n _type: 'org.taktik.icure.entities.AccessLog',\n id: h?.id ?? this.crypto.primitives.randomUuid(),\n created: h?.created ?? new Date().getTime(),\n modified: h?.modified ?? new Date().getTime(),\n date: h?.date ?? new Date().getTime(),\n responsible: h?.responsible ?? (this.autofillAuthor ? dataOwnerId : undefined),\n author: h?.author ?? (this.autofillAuthor ? user.id : undefined),\n codes: h?.codes ?? [],\n tags: h?.tags ?? [],\n user: h?.user ?? user.id,\n accessType: h?.accessType ?? 'USER_ACCESS',\n }\n\n const ownerId = this.dataOwnerApi.getDataOwnerIdOf(user)\n if (ownerId !== (await this.dataOwnerApi.getCurrentDataOwnerId())) throw new Error('Can only initialise entities as current data owner.')\n const sfk = await this.crypto.xapi.resolveSecretIdUseOptions(\n { entity: patient, type: EntityWithDelegationTypeName.Patient },\n options.sfkOption ?? SecretIdUseOption.UseAnySharedWithParent\n )\n const extraDelegations = {\n ...Object.fromEntries(\n [...(user.autoDelegations?.all ?? []), ...(user.autoDelegations?.administrativeData ?? [])].map((x) => [x, AccessLevelEnum.WRITE])\n ),\n ...(options.additionalDelegates ?? {}),\n }\n return new AccessLog(\n await this.crypto.xapi\n .entityWithInitialisedEncryptedMetadata(accessLog, EntityWithDelegationTypeName.AccessLog, patient.id, sfk, true, extraDelegations)\n .then((x) => x.updatedEntity)\n )\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * 1. Check whether there is a delegation with 'hcpartyId' or not.\n * 2. 'fetchHcParty[hcpartyId][1]': is encrypted AES exchange key by RSA public key of him.\n * 3. Obtain the AES exchange key, by decrypting the previous step value with hcparty private key\n * 3.1. KeyPair should be fetch from cache (in jwk)\n * 3.2. if it doesn't exist in the cache, it has to be loaded from Browser Local store, and then import it to WebCrypto\n * 4. Obtain the array of delegations which are delegated to his ID (hcpartyId) in this patient\n * 5. Decrypt and collect all keys (secretForeignKeys) within delegations of previous step (with obtained AES key of step 4)\n * 6. Do the REST call to get all access logs with (allSecretForeignKeysDelimitedByComma, hcpartyId)\n *\n * After these painful steps, you have the access logs of the patient.\n *\n * @deprecated use {@link findIdsBy} instead\n * @param hcpartyId\n * @param patient (Promise)\n * @param usingPost\n */\n async findBy(hcpartyId: string, patient: models.Patient, usingPost: boolean = false): Promise<models.AccessLog[]> {\n const extractedKeys = await this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }, hcpartyId)\n const topmostParentId = (await this.dataOwnerApi.getCurrentDataOwnerHierarchyIds())[0]\n return extractedKeys && extractedKeys.length > 0\n ? usingPost\n ? this.findByHCPartyPatientSecretFKeysArray(hcpartyId!, _.uniq(extractedKeys))\n : this.findByHCPartyPatientSecretFKeys(hcpartyId!, _.uniq(extractedKeys).join(','))\n : Promise.resolve([])\n }\n\n /**\n * Same as `findBy` but it will only return the ids of the access logs. It can also filter the access logs where AccessLog.date is between\n * startDate and endDate in ascending or descending order by that field. (default: ascending).\n */\n async findIdsBy(hcpartyId: string, patient: models.Patient, startDate?: number, endDate?: number, descending?: boolean): Promise<string[]> {\n const extractedKeys = await this.crypto.xapi.secretIdsOf({ entity: patient, type: EntityWithDelegationTypeName.Patient }, hcpartyId)\n return extractedKeys && extractedKeys.length > 0\n ? this.findAccessLogIdsByDataOwnerPatientDate(hcpartyId, _.uniq(extractedKeys), startDate, endDate, descending)\n : Promise.resolve([])\n }\n\n /**\n * @deprecated use {@link findAccessLogIdsByDataOwnerPatientDate} instead\n */\n async findByHCPartyPatientSecretFKeys(hcPartyId: string, secretFKeys: string): Promise<AccessLog[]> {\n const accessLogs = await super.findAccessLogsByHCPartyPatientForeignKeys(hcPartyId, secretFKeys)\n return await this.decrypt(hcPartyId, accessLogs)\n }\n\n /**\n * @deprecated use {@link findAccessLogIdsByDataOwnerPatientDate} instead\n */\n findByHCPartyPatientSecretFKeysArray(hcPartyId: string, secretFKeys: string[]): Promise<Array<AccessLog> | any> {\n return super.findAccessLogsByHCPartyPatientForeignKeysUsingPost(hcPartyId, secretFKeys).then((accesslogs) => this.decrypt(hcPartyId, accesslogs))\n }\n\n async decrypt(hcpId: string, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n return (await this.crypto.xapi.tryDecryptEntities(accessLogs, EntityWithDelegationTypeName.AccessLog, (json) => new AccessLog(json))).map(\n ({ entity }) => entity\n )\n }\n\n encrypt(user: models.User, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n const owner = this.dataOwnerApi.getDataOwnerIdOf(user)\n return this.encryptAs(owner, accessLogs)\n }\n\n private async encryptAs(dataOwner: string, accessLogs: Array<models.AccessLog>): Promise<Array<models.AccessLog>> {\n return this.crypto.xapi.tryEncryptEntities(\n accessLogs,\n EntityWithDelegationTypeName.AccessLog,\n this.encryptedFields,\n false,\n false,\n (json) => new AccessLog(json)\n )\n }\n\n createAccessLog(body?: models.AccessLog): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n createAccessLogWithUser(user: models.User, body?: models.AccessLog): Promise<models.AccessLog | any> {\n return body\n ? this.encrypt(user, [_.cloneDeep(body)])\n .then((als) => super.createAccessLog(als[0]))\n .then((accessLog) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [accessLog]))\n .then((als) => als[0])\n : Promise.resolve()\n }\n\n getAccessLog(accessLogId: string): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n getAccessLogWithUser(user: models.User, accessLogId: string): Promise<models.AccessLog | any> {\n return super\n .getAccessLog(accessLogId)\n .then((accessLog) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, [accessLog]))\n .then((als) => als[0])\n }\n\n async getAccessLogs(ids: ListOfIds): Promise<AccessLog[]> {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n getAccessLogsWithUser(user: models.User, ids: ListOfIds): Promise<AccessLog[]> {\n return super.getAccessLogs(ids).then((accessLogs) => this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLogs))\n }\n\n listAccessLogs(fromEpoch?: number, toEpoch?: number, startKey?: number, startDocumentId?: string, limit?: number): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n listAccessLogsWithUser(\n user: models.User,\n fromEpoch?: number,\n toEpoch?: number,\n startKey?: number,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): Promise<PaginatedListAccessLog> {\n return super\n .listAccessLogs(fromEpoch, toEpoch, startKey, startDocumentId, limit, descending)\n .then((accessLog) =>\n this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLog.rows!).then((dr) => Object.assign(accessLog, { rows: dr }))\n )\n }\n\n modifyAccessLog(body?: models.AccessLog): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n async modifyAccessLogWithUser(user: models.User, body?: models.AccessLog): Promise<models.AccessLog | null> {\n return body ? this.modifyAs(this.dataOwnerApi.getDataOwnerIdOf(user)!, _.cloneDeep(body)) : null\n }\n\n private async modifyAs(owner: string, body: models.AccessLog): Promise<models.AccessLog> {\n return this.encryptAs(owner, [_.cloneDeep(body)])\n .then((als) => super.modifyAccessLog(als[0]))\n .then((accessLog) => this.decrypt(owner, [accessLog]))\n .then((als) => als[0])\n }\n\n findByUserAfterDate(\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): never {\n throw new Error('Cannot call a method that returns access logs without providing a user for de/encryption')\n }\n\n findByUserAfterDateWithUser(\n user: models.User,\n userId: string,\n accessType?: string,\n startDate?: number,\n startKey?: string,\n startDocumentId?: string,\n limit?: number,\n descending?: boolean\n ): Promise<models.AccessLog | any> {\n return super\n .findByUserAfterDate(userId, accessType, startDate, startKey, startDocumentId, limit, descending)\n .then((accessLog) =>\n this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, accessLog.rows!).then((dr) => Object.assign(accessLog, { rows: dr }))\n )\n }\n\n async findLatestAccessLogsOfPatientsWithUser(user: models.User, userId: string, limit = 100, startDate?: number): Promise<models.AccessLog[]> {\n let foundAccessLogs: AccessLogWithPatientId[] = [],\n nextKeyPair: models.PaginatedDocumentKeyIdPairObject | undefined = undefined\n const numberRequestedAccessLogs = 100\n const MAX_WHILE_ITERATIONS = 5\n\n for (let currentIteration = 0; foundAccessLogs.length < limit && currentIteration < MAX_WHILE_ITERATIONS; currentIteration++) {\n const currentLimit = limit - foundAccessLogs.length\n const { rows: logs, nextKeyPair: newNextKeyPair }: models.PaginatedListAccessLog = (await super.findByUserAfterDate(\n userId,\n 'USER_ACCESS',\n startDate,\n nextKeyPair && JSON.stringify(nextKeyPair.startKey!),\n nextKeyPair && nextKeyPair.startKeyDocId!,\n numberRequestedAccessLogs,\n true\n )) as models.PaginatedListAccessLog\n const logsWithPatientId: AccessLogWithPatientId[] = await this.decrypt(this.dataOwnerApi.getDataOwnerIdOf(user)!, logs as AccessLog[]).then(\n (decryptedLogs) =>\n Promise.all(\n _.map(decryptedLogs, (decryptedLog) => {\n return this.crypto.xapi\n .owningEntityIdsOf({ entity: decryptedLog, type: EntityWithDelegationTypeName.AccessLog }, user.healthcarePartyId as string)\n .then(\n (keys) =>\n ({\n ...decryptedLog,\n patientId: _.head(keys),\n } as AccessLogWithPatientId)\n )\n })\n )\n )\n\n const uniqueLogs: AccessLogWithPatientId[] = _.chain(logsWithPatientId)\n .reject((log) => _.some(foundAccessLogs, ({ patientId }) => patientId === log.patientId))\n .uniqBy((log: AccessLogWithPatientId) => log.patientId)\n .value()\n .slice(0, currentLimit)\n\n foundAccessLogs = [...foundAccessLogs, ...uniqueLogs]\n\n if ((logs || []).length < numberRequestedAccessLogs) {\n break\n } else if (newNextKeyPair) {\n nextKeyPair = newNextKeyPair\n } else {\n break\n }\n }\n\n return foundAccessLogs\n }\n\n /**\n * @param accessLog an access log\n * @return the id of the patient that the access log refers to, retrieved from the encrypted metadata (not from the decrypted entity body). Normally\n * there should only be one element in the returned array, but in case of entity merges there could be multiple values.\n */\n async decryptPatientIdOf(accessLog: AccessLog): Promise<string[]> {\n return this.crypto.xapi.owningEntityIdsOf({ entity: accessLog, type: EntityWithDelegationTypeName.AccessLog }, undefined)\n }\n\n /**\n * @return if the logged data owner has write access to the content of the given access log\n */\n async hasWriteAccess(accessLog: AccessLog): Promise<boolean> {\n return this.crypto.xapi.hasWriteAccess({ entity: accessLog, type: EntityWithDelegationTypeName.AccessLog })\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param delegateId the id of the data owner which will be granted access to the access log.\n * @param accessLog the access log to share.\n * @param options optional parameters to customize the sharing behaviour:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWith(\n delegateId: string,\n accessLog: AccessLog,\n options: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n } = {}\n ): Promise<AccessLog> {\n return this.shareWithMany(accessLog, { [delegateId]: options })\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param accessLog the access log to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return the updated entity\n */\n async shareWithMany(\n accessLog: AccessLog,\n delegates: {\n [delegateId: string]: {\n shareSecretId?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<AccessLog> {\n return (await this.tryShareWithMany(accessLog, delegates)).updatedEntityOrThrow\n }\n\n /**\n * Share an existing access log with other data owners, allowing them to access the non-encrypted data of the access log and optionally also the\n * encrypted content, with read-only or read-write permissions.\n * @param accessLog the access log to share.\n * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:\n * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared\n * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted\n * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - sharePatientId: specifies if the id of the patient that this access log refers to should be shared with the delegate. Normally this would\n * be the same as objectId, but it is encrypted separately from it allowing you to give access to the patient id without giving access to the other\n * encrypted data of the access log (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).\n * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.\n * @return a promise which will contain the result of the operation: the updated entity if the operation was successful or details of the error if\n * the operation failed.\n */\n async tryShareWithMany(\n accessLog: AccessLog,\n delegates: {\n [delegateId: string]: {\n shareSecretIds?: string[]\n requestedPermissions?: RequestedPermissionEnum\n shareEncryptionKey?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n sharePatientId?: ShareMetadataBehaviour // Defaults to ShareMetadataBehaviour.IF_AVAILABLE\n }\n }\n ): Promise<ShareResult<AccessLog>> {\n const self = await this.dataOwnerApi.getCurrentDataOwnerId()\n // All entities should have an encryption key.\n const entityWithEncryptionKey = await this.crypto.xapi.ensureEncryptionKeysInitialised(accessLog, EntityWithDelegationTypeName.AccessLog)\n const updatedEntity = entityWithEncryptionKey ? await this.modifyAs(self, entityWithEncryptionKey) : accessLog\n return this.crypto.xapi\n .simpleShareOrUpdateEncryptedEntityMetadata(\n {\n entity: updatedEntity,\n type: EntityWithDelegationTypeName.AccessLog,\n },\n Object.fromEntries(\n Object.entries(delegates).map(([delegateId, options]) => [\n delegateId,\n {\n requestedPermissions: options.requestedPermissions,\n shareEncryptionKeys: options.shareEncryptionKey,\n shareOwningEntityIds: options.sharePatientId,\n shareSecretIds: options.shareSecretIds,\n },\n ])\n ),\n (x) => this.bulkShareAccessLogs(x)\n )\n .then((r) => r.mapSuccessAsync((e) => this.decrypt(self, [e]).then((es) => es[0])))\n }\n\n getDataOwnersWithAccessTo(\n entity: AccessLog\n ): Promise<{ permissionsByDataOwnerId: { [p: string]: AccessLevelEnum }; hasUnknownAnonymousDataOwners: boolean }> {\n return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName.AccessLog })\n }\n\n getEncryptionKeysOf(entity: AccessLog): Promise<string[]> {\n return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName.AccessLog }, undefined)\n }\n\n createDelegationDeAnonymizationMetadata(entity: AccessLog, delegates: string[]): Promise<void> {\n return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo(\n { entity, type: EntityWithDelegationTypeName.AccessLog },\n delegates\n )\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confidential-entities-test.js","sourceRoot":"","sources":["../../../test/icc-x-api/confidential-entities-test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,oDAAoH;AACpH,mDAAmE;AACnE,+BAA6B;AAC7B,4BAAyB;AAEzB,+CAA8D;AAC9D,gFAA4E;AAC5E,IAAO,kBAAkB,GAAG,qCAAiB,CAAC,kBAAkB,CAAA;AAChE,IAAO,sBAAsB,GAAG,qCAAiB,CAAC,sBAAsB,CAAA;AACxE,mCAAmC;AACnC,IAAO,kBAAkB,GAAG,qCAAiB,CAAC,kBAAkB,CAAA;AAChE,IAAO,sBAAsB,GAAG,qCAAiB,CAAC,sBAAsB,CAAA;AACxE,IAAO,OAAO,GAAG,qCAAiB,CAAC,OAAO,CAAA;AAE1C,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAA;AAEtB,IAAI,GAAa,CAAA;AAEjB,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,MAAM,CAAC;;YACL,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACpB,MAAM,WAAW,GAAG,MAAM,IAAA,sCAAyB,GAAE,CAAA;YACrD,GAAG,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,IAAA,uBAAe,GAAE,CAAC,CAAA;QACpD,CAAC;KAAA,CAAC,CAAA;IAEF,EAAE,CAAC,6GAA6G,EAAE,GAAS,EAAE;QAC3H,+DAA+D;QAC/D,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,mCAAsB,EAAC,GAAI,CAAC,CAAA;QAErI,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,E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,CAAA;QACD,IAAA,aAAM,EAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACtE,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { createHcpHierarchyApis, getEnvironmentInitializer, isLiteTest, setLocalStorage } from '../utils/test_utils'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\nimport { expect } from 'chai'\nimport 'isomorphic-fetch'\nimport { SecureDelegation } from '../../icc-api/model/SecureDelegation'\nimport { EntityWithDelegationTypeName } from '../../icc-x-api'\nimport { SecretIdUseOption } from '../../icc-x-api/crypto/SecretIdUseOption'\nimport UseAnyConfidential = SecretIdUseOption.UseAnyConfidential\nimport UseAnySharedWithParent = SecretIdUseOption.UseAnySharedWithParent\nimport { randomUUID } from 'crypto'\nimport UseAllConfidential = SecretIdUseOption.UseAllConfidential\nimport UseAllSharedWithParent = SecretIdUseOption.UseAllSharedWithParent\nimport UseNone = SecretIdUseOption.UseNone\n\nsetLocalStorage(fetch)\n\nvar env: TestVars\n\ndescribe('test confidential helement', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n it('confidential entity should be accessible only to user, non confidential should be accessible also to parent', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n const modifiedPatient = (await childApi.patientApi.initConfidentialSecretId(pat, childUser))!\n\n const patientSecretIdsForParent = await parentApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n const patientSecretIdsForChild = await childApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n expect(patientSecretIdsForParent).to.have.length(1)\n expect(patientSecretIdsForChild).to.have.length(2)\n expect(patientSecretIdsForChild).to.contain(patientSecretIdsForParent[0])\n expect(patientSecretIdsForChild[0]).to.not.eq(patientSecretIdsForChild[1])\n\n const confidentialHe = await childApi.healthcareElementApi.createHealthElementWithUser(\n childUser,\n await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n )\n expect(confidentialHe.descr).to.eq('Confidential info')\n const nonConfidentialHe = await childApi.healthcareElementApi.createHealthElementWithUser(\n childUser,\n await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Non confidential info' },\n { sfkOption: UseAnySharedWithParent }\n )\n )\n expect(nonConfidentialHe.descr).to.eq('Non confidential info')\n\n const retrievedHesAsUser = await childApi.healthcareElementApi.findBy(childUser.healthcarePartyId!, modifiedPatient)\n expect(retrievedHesAsUser.length).to.equal(2, 'Child should see confidential and non-confidential data created by him')\n expect(retrievedHesAsUser.map((he) => he.id)).to.have.members([confidentialHe.id, nonConfidentialHe.id])\n const retrievedConfidential = retrievedHesAsUser.find((he) => he.id === confidentialHe.id)\n const retrievedNonConfidential = retrievedHesAsUser.find((he) => he.id === nonConfidentialHe.id)\n expect(retrievedConfidential).to.deep.eq(confidentialHe)\n expect(retrievedNonConfidential).to.deep.eq(nonConfidentialHe)\n\n const retrievedHesAsParent = await parentApi.healthcareElementApi.findBy(parentUser.healthcarePartyId!, modifiedPatient)\n expect(retrievedHesAsParent.length).to.equal(1, 'Parent should not see confidential data, but only non-confidential data created by child')\n expect(retrievedHesAsParent[0]).to.deep.eq(nonConfidentialHe)\n let failedToRetrieve = false\n try {\n await parentApi.healthcareElementApi.getHealthElementWithUser(parentUser, confidentialHe.id!)\n } catch (e) {\n console.log(e)\n failedToRetrieve = true\n }\n if (!isLiteTest()) {\n expect(failedToRetrieve).to.equal(true, 'Parent should fail to retrieve confidential data')\n }\n // Even if in some way I could get the contact I should not be able to decrypt it\n expect(\n await parentApi.cryptoApi.xapi.encryptionKeysOf({ entity: confidentialHe!, type: EntityWithDelegationTypeName.HealthElement }, undefined)\n ).to.have.length(0)\n })\n\n it('creation of confidential data should fail if no confidential secret id is available for patient', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.createPatientWithUser(\n childUser,\n await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n )\n let failed = false\n try {\n await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n } catch {\n failed = true\n }\n expect(failed).to.equal(true, 'Creation of confidential data should fail if no confidential secret id is available for patient')\n })\n\n it('creation of non-confidential data should fail if no secret id is available for parent', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!, false)\n\n const pat = await childApi.patientApi.createPatientWithUser(\n childUser,\n await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n )\n let failed = false\n try {\n await childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: UseAnySharedWithParent })\n } catch {\n failed = true\n }\n expect(failed).to.equal(true, 'Creation of confidential data should fail if no non-confidential secret id is available for patient')\n })\n\n it('confidential or non-confidential is irrelevant if api is initialised without parent key initialisation: data created by user is only accessible to him', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!, false, true)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n\n const confidentialHe = await childApi.healthcareElementApi.createHealthElementWithUser(\n childUser,\n await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n )\n expect(confidentialHe.descr).to.eq('Confidential info')\n const nonConfidentialHe = await childApi.healthcareElementApi.createHealthElementWithUser(\n childUser,\n await childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Non confidential info' }, { sfkOption: UseAnySharedWithParent })\n )\n expect(nonConfidentialHe.descr).to.eq('Non confidential info')\n\n const retrievedHesAsUser = await childApi.healthcareElementApi.findBy(childUser.healthcarePartyId!, pat)\n expect(retrievedHesAsUser.length).to.equal(2, 'Child should see confidential and non-confidential data created by him')\n expect(retrievedHesAsUser.map((he) => he.id)).to.have.members([confidentialHe.id, nonConfidentialHe.id])\n const retrievedConfidential = retrievedHesAsUser.find((he) => he.id === confidentialHe.id)\n const retrievedNonConfidential = retrievedHesAsUser.find((he) => he.id === nonConfidentialHe.id)\n expect(retrievedConfidential).to.deep.eq(confidentialHe)\n expect(retrievedNonConfidential).to.deep.eq(nonConfidentialHe)\n\n await parentApi.patientApi.decryptSecretIdsOf(pat)\n })\n\n it('sfk confidential option should use one or all secret ids as requested', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n let modifiedPatient = (await childApi.patientApi.initConfidentialSecretId(pat, childUser))!\n modifiedPatient = await childApi.patientApi.shareWith(childUser.healthcarePartyId!, modifiedPatient, [randomUUID()])\n modifiedPatient = await childApi.patientApi.shareWith(parentUser.healthcarePartyId!, modifiedPatient, [randomUUID()])\n\n const patientSecretIdsForParent = await parentApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n const patientSecretIdsForChild = await childApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n expect(patientSecretIdsForParent).to.have.length(2)\n expect(patientSecretIdsForChild).to.have.length(4)\n const confidentialSecretIds = patientSecretIdsForChild.filter((x) => !patientSecretIdsForParent.includes(x))\n const nonConfidentialSecretIds = patientSecretIdsForParent\n expect(confidentialSecretIds).to.have.length(2)\n expect(await childApi.patientApi.decryptConfidentialSecretIdsOf(modifiedPatient)).to.have.members(confidentialSecretIds)\n expect(await childApi.patientApi.decryptNonConfidentialSecretIdsOf(modifiedPatient)).to.have.members(nonConfidentialSecretIds)\n const anyConfidentialHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n expect(anyConfidentialHe.secretForeignKeys).to.have.length(1)\n expect(confidentialSecretIds).to.include(anyConfidentialHe.secretForeignKeys![0])\n const allConfidentialHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAllConfidential, ignoreAutoDelegations: true }\n )\n expect(allConfidentialHe.secretForeignKeys).to.have.members(confidentialSecretIds)\n const anyNonConfidentialHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAnySharedWithParent }\n )\n expect(anyNonConfidentialHe.secretForeignKeys).to.have.length(1)\n expect(nonConfidentialSecretIds).to.include(anyNonConfidentialHe.secretForeignKeys![0])\n const allNonConfidentialHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAllSharedWithParent }\n )\n expect(allNonConfidentialHe.secretForeignKeys).to.have.members(nonConfidentialSecretIds)\n })\n\n it('Should allow creation of half-links by using no sfk', async () => {\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n const halfLinkedHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: UseNone, ignoreAutoDelegations: true }\n )\n expect(halfLinkedHe.secretForeignKeys).to.have.length(0)\n const decryptedPatientId = await childApi.healthcareElementApi.decryptPatientIdOf(halfLinkedHe)\n expect(decryptedPatientId).to.have.length(1)\n expect(decryptedPatientId[0]).to.equal(pat.id)\n })\n\n it('Should allow creation of links using the provided sfks', async () => {\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n const modifiedPatient = (await childApi.patientApi.initConfidentialSecretId(pat, childUser))!\n const secretIds = await childApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n expect(secretIds).to.have.length(2)\n const halfLinkedHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: new SecretIdUseOption.Use([]), ignoreAutoDelegations: true }\n )\n expect(halfLinkedHe.secretForeignKeys).to.have.length(0)\n const linkedHeSfk0 = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: new SecretIdUseOption.Use([secretIds[0]]), ignoreAutoDelegations: true }\n )\n expect(linkedHeSfk0.secretForeignKeys).to.have.members([secretIds[0]])\n const linkedHeSfk1 = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: new SecretIdUseOption.Use([secretIds[1]]), ignoreAutoDelegations: true }\n )\n expect(linkedHeSfk1.secretForeignKeys).to.have.members([secretIds[1]])\n const linkedHeSfkBoth = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: new SecretIdUseOption.Use(secretIds), ignoreAutoDelegations: true }\n )\n expect(linkedHeSfkBoth.secretForeignKeys).to.have.members(secretIds)\n })\n})\n"]}
|
|
1
|
+
{"version":3,"file":"confidential-entities-test.js","sourceRoot":"","sources":["../../../test/icc-x-api/confidential-entities-test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,oDAAoH;AACpH,mDAAmE;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Content":["import { createHcpHierarchyApis, getEnvironmentInitializer, isLiteTest, setLocalStorage } from '../utils/test_utils'\nimport { getEnvVariables, TestVars } from '@icure/test-setup/types'\nimport { expect } from 'chai'\nimport 'isomorphic-fetch'\nimport { EntityWithDelegationTypeName } from '../../icc-x-api'\nimport { SecretIdUseOption } from '../../icc-x-api/crypto/SecretIdUseOption'\nimport UseAnyConfidential = SecretIdUseOption.UseAnyConfidential\nimport UseAnySharedWithParent = SecretIdUseOption.UseAnySharedWithParent\nimport { randomUUID } from 'crypto'\nimport UseAllConfidential = SecretIdUseOption.UseAllConfidential\nimport UseAllSharedWithParent = SecretIdUseOption.UseAllSharedWithParent\nimport UseNone = SecretIdUseOption.UseNone\n\nsetLocalStorage(fetch)\n\nvar env: TestVars\n\ndescribe('test confidential helement', () => {\n before(async function () {\n this.timeout(600000)\n const initializer = await getEnvironmentInitializer()\n env = await initializer.execute(getEnvVariables())\n })\n\n it('confidential entity should be accessible only to user, non confidential should be accessible also to parent', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n const modifiedPatient = (await childApi.patientApi.initConfidentialSecretId(pat, childUser))!\n\n const patientSecretIdsForParent = await parentApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n const patientSecretIdsForChild = await childApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n expect(patientSecretIdsForParent).to.have.length(1)\n expect(patientSecretIdsForChild).to.have.length(2)\n expect(patientSecretIdsForChild).to.contain(patientSecretIdsForParent[0])\n expect(patientSecretIdsForChild[0]).to.not.eq(patientSecretIdsForChild[1])\n\n const confidentialHe = await childApi.healthcareElementApi.createHealthElementWithUser(\n childUser,\n await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n )\n expect(confidentialHe.descr).to.eq('Confidential info')\n const nonConfidentialHe = await childApi.healthcareElementApi.createHealthElementWithUser(\n childUser,\n await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Non confidential info' },\n { sfkOption: UseAnySharedWithParent }\n )\n )\n expect(nonConfidentialHe.descr).to.eq('Non confidential info')\n\n const retrievedHesAsUser = await childApi.healthcareElementApi.findBy(childUser.healthcarePartyId!, modifiedPatient)\n expect(retrievedHesAsUser.length).to.equal(2, 'Child should see confidential and non-confidential data created by him')\n expect(retrievedHesAsUser.map((he) => he.id)).to.have.members([confidentialHe.id, nonConfidentialHe.id])\n const retrievedConfidential = retrievedHesAsUser.find((he) => he.id === confidentialHe.id)\n const retrievedNonConfidential = retrievedHesAsUser.find((he) => he.id === nonConfidentialHe.id)\n expect(retrievedConfidential).to.deep.eq(confidentialHe)\n expect(retrievedNonConfidential).to.deep.eq(nonConfidentialHe)\n\n const retrievedHesAsParent = await parentApi.healthcareElementApi.findBy(parentUser.healthcarePartyId!, modifiedPatient)\n expect(retrievedHesAsParent.length).to.equal(1, 'Parent should not see confidential data, but only non-confidential data created by child')\n expect(retrievedHesAsParent[0]).to.deep.eq(nonConfidentialHe)\n let failedToRetrieve = false\n try {\n await parentApi.healthcareElementApi.getHealthElementWithUser(parentUser, confidentialHe.id!)\n } catch (e) {\n console.log(e)\n failedToRetrieve = true\n }\n if (!isLiteTest()) {\n expect(failedToRetrieve).to.equal(true, 'Parent should fail to retrieve confidential data')\n }\n // Even if in some way I could get the contact I should not be able to decrypt it\n expect(\n await parentApi.cryptoApi.xapi.encryptionKeysOf({ entity: confidentialHe!, type: EntityWithDelegationTypeName.HealthElement }, undefined)\n ).to.have.length(0)\n })\n\n it('creation of confidential data should fail if no confidential secret id is available for patient', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.createPatientWithUser(\n childUser,\n await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n )\n let failed = false\n try {\n await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n } catch {\n failed = true\n }\n expect(failed).to.equal(true, 'Creation of confidential data should fail if no confidential secret id is available for patient')\n })\n\n it('creation of non-confidential data should fail if no secret id is available for parent', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!, false)\n\n const pat = await childApi.patientApi.createPatientWithUser(\n childUser,\n await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n )\n let failed = false\n try {\n await childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: UseAnySharedWithParent })\n } catch {\n failed = true\n }\n expect(failed).to.equal(true, 'Creation of confidential data should fail if no non-confidential secret id is available for patient')\n })\n\n it('confidential or non-confidential is irrelevant if api is initialised without parent key initialisation: data created by user is only accessible to him', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!, false, true)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n\n const confidentialHe = await childApi.healthcareElementApi.createHealthElementWithUser(\n childUser,\n await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n )\n expect(confidentialHe.descr).to.eq('Confidential info')\n const nonConfidentialHe = await childApi.healthcareElementApi.createHealthElementWithUser(\n childUser,\n await childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Non confidential info' }, { sfkOption: UseAnySharedWithParent })\n )\n expect(nonConfidentialHe.descr).to.eq('Non confidential info')\n\n const retrievedHesAsUser = await childApi.healthcareElementApi.findBy(childUser.healthcarePartyId!, pat)\n expect(retrievedHesAsUser.length).to.equal(2, 'Child should see confidential and non-confidential data created by him')\n expect(retrievedHesAsUser.map((he) => he.id)).to.have.members([confidentialHe.id, nonConfidentialHe.id])\n const retrievedConfidential = retrievedHesAsUser.find((he) => he.id === confidentialHe.id)\n const retrievedNonConfidential = retrievedHesAsUser.find((he) => he.id === nonConfidentialHe.id)\n expect(retrievedConfidential).to.deep.eq(confidentialHe)\n expect(retrievedNonConfidential).to.deep.eq(nonConfidentialHe)\n\n await parentApi.patientApi.decryptSecretIdsOf(pat)\n })\n\n it('sfk confidential option should use one or all secret ids as requested', async () => {\n // Use only the top of the hierarchy for simplicity of the test\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n let modifiedPatient = (await childApi.patientApi.initConfidentialSecretId(pat, childUser))!\n modifiedPatient = await childApi.patientApi.shareWith(childUser.healthcarePartyId!, modifiedPatient, [randomUUID()])\n modifiedPatient = await childApi.patientApi.shareWith(parentUser.healthcarePartyId!, modifiedPatient, [randomUUID()])\n\n const patientSecretIdsForParent = await parentApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n const patientSecretIdsForChild = await childApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n expect(patientSecretIdsForParent).to.have.length(2)\n expect(patientSecretIdsForChild).to.have.length(4)\n const confidentialSecretIds = patientSecretIdsForChild.filter((x) => !patientSecretIdsForParent.includes(x))\n const nonConfidentialSecretIds = patientSecretIdsForParent\n expect(confidentialSecretIds).to.have.length(2)\n expect(await childApi.patientApi.decryptConfidentialSecretIdsOf(modifiedPatient)).to.have.members(confidentialSecretIds)\n expect(await childApi.patientApi.decryptNonConfidentialSecretIdsOf(modifiedPatient)).to.have.members(nonConfidentialSecretIds)\n const anyConfidentialHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAnyConfidential, ignoreAutoDelegations: true }\n )\n expect(anyConfidentialHe.secretForeignKeys).to.have.length(1)\n expect(confidentialSecretIds).to.include(anyConfidentialHe.secretForeignKeys![0])\n const allConfidentialHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAllConfidential, ignoreAutoDelegations: true }\n )\n expect(allConfidentialHe.secretForeignKeys).to.have.members(confidentialSecretIds)\n const anyNonConfidentialHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAnySharedWithParent }\n )\n expect(anyNonConfidentialHe.secretForeignKeys).to.have.length(1)\n expect(nonConfidentialSecretIds).to.include(anyNonConfidentialHe.secretForeignKeys![0])\n const allNonConfidentialHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n modifiedPatient,\n { descr: 'Confidential info' },\n { sfkOption: UseAllSharedWithParent }\n )\n expect(allNonConfidentialHe.secretForeignKeys).to.have.members(nonConfidentialSecretIds)\n })\n\n it('Should allow creation of half-links by using no sfk', async () => {\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n const halfLinkedHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: UseNone, ignoreAutoDelegations: true }\n )\n expect(halfLinkedHe.secretForeignKeys).to.have.length(0)\n const decryptedPatientId = await childApi.healthcareElementApi.decryptPatientIdOf(halfLinkedHe)\n expect(decryptedPatientId).to.have.length(1)\n expect(decryptedPatientId[0]).to.equal(pat.id)\n })\n\n it('Should allow creation of links using the provided sfks', async () => {\n const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = await createHcpHierarchyApis(env!)\n\n const pat = await childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' })\n const modifiedPatient = (await childApi.patientApi.initConfidentialSecretId(pat, childUser))!\n const secretIds = await childApi.patientApi.decryptSecretIdsOf(modifiedPatient)\n expect(secretIds).to.have.length(2)\n const halfLinkedHe = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: new SecretIdUseOption.Use([]), ignoreAutoDelegations: true }\n )\n expect(halfLinkedHe.secretForeignKeys).to.have.length(0)\n const linkedHeSfk0 = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: new SecretIdUseOption.Use([secretIds[0]]), ignoreAutoDelegations: true }\n )\n expect(linkedHeSfk0.secretForeignKeys).to.have.members([secretIds[0]])\n const linkedHeSfk1 = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: new SecretIdUseOption.Use([secretIds[1]]), ignoreAutoDelegations: true }\n )\n expect(linkedHeSfk1.secretForeignKeys).to.have.members([secretIds[1]])\n const linkedHeSfkBoth = await childApi.healthcareElementApi.newInstance(\n childUser,\n pat,\n { descr: 'Confidential info' },\n { sfkOption: new SecretIdUseOption.Use(secretIds), ignoreAutoDelegations: true }\n )\n expect(linkedHeSfkBoth.secretForeignKeys).to.have.members(secretIds)\n })\n})\n"]}
|