@icure/api 8.1.0 → 8.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/icc-api/api/IccBesamv2Api.d.ts +33 -0
- package/icc-api/api/IccBesamv2Api.js +57 -0
- package/icc-api/api/IccBesamv2Api.js.map +1 -1
- package/icc-api/api/IccInvoiceApi.d.ts +8 -0
- package/icc-api/api/IccInvoiceApi.js +19 -0
- package/icc-api/api/IccInvoiceApi.js.map +1 -1
- package/icc-api/model/Content.js +1 -1
- package/icc-api/model/Content.js.map +1 -1
- package/icc-api/model/HealthcareParty.js +1 -1
- package/icc-api/model/HealthcareParty.js.map +1 -1
- package/icc-api/model/Invoice.d.ts +1 -0
- package/icc-api/model/Invoice.js.map +1 -1
- package/icc-api/model/InvoicingCode.d.ts +1 -0
- package/icc-api/model/InvoicingCode.js.map +1 -1
- package/icc-api/model/Patient.js +1 -1
- package/icc-api/model/Patient.js.map +1 -1
- package/icc-api/model/SamV2Update.d.ts +15 -0
- package/icc-api/model/SamV2Update.js +10 -0
- package/icc-api/model/SamV2Update.js.map +1 -0
- package/icc-api/model/SamV2UpdateTaskLogItem.d.ts +6 -0
- package/icc-api/model/SamV2UpdateTaskLogItem.js +10 -0
- package/icc-api/model/SamV2UpdateTaskLogItem.js.map +1 -0
- package/package.json +1 -1
- package/test/icc-x-api/confidential-entities-test.js +16 -1
- package/test/icc-x-api/confidential-entities-test.js.map +1 -1
- package/test/icc-x-api/diocancaro.d.ts +0 -1
- package/test/icc-x-api/diocancaro.js +0 -75
- package/test/icc-x-api/diocancaro.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Patient.js","sourceRoot":"","sources":["../../../icc-api/model/Patient.ts"],"names":[],"mappings":";;;AA0BA;;GAEG;AACH,+CAAuC;AAGvC,MAAa,OAAO;IAClB,YAAY,IAAgB;QAC1B,IAAI,WAAW,GAA8B,EAAE,CAAA;QAC/C,IAAI,CAAC,C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M,EAAE,QAA8B;QACtC,QAAQ,EAAE,WAAiC;QAC3C,OAAO,EAAE,SAA+B;QACxC,SAAS,EAAE,WAAiC;QAC5C,QAAQ,EAAE,UAAgC;QAC1C,SAAS,EAAE,WAAiC;QAC5C,OAAO,EAAE,SAA+B;QACxC,OAAO,EAAE,SAA+B;QACxC,WAAW,EAAE,aAAmC;QAChD,OAAO,EAAE,SAA+B;QACxC,QAAQ,EAAE,UAAgC;QAC1C,KAAK,EAAE,OAA6B;QACpC,QAAQ,EAAE,UAAgC;QAC1C,UAAU,EAAE,YAAkC;KAC/C,CAAA;AACH,CAAC,EA9DgB,OAAO,GAAP,eAAO,KAAP,eAAO,QA8DvB","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 { Address } from './Address'\nimport { CodeStub } from './CodeStub'\nimport { Delegation } from './Delegation'\nimport { EmploymentInfo } from './EmploymentInfo'\nimport { FinancialInstitutionInformation } from './FinancialInstitutionInformation'\nimport { Identifier } from './Identifier'\nimport { Insurability } from './Insurability'\nimport { MedicalHouseContract } from './MedicalHouseContract'\nimport { Partnership } from './Partnership'\nimport { PatientHealthCareParty } from './PatientHealthCareParty'\nimport { PersonName } from './PersonName'\nimport { PropertyStub } from './PropertyStub'\nimport { SchoolingInfo } from './SchoolingInfo'\nimport { Annotation } from './Annotation'\n\n/**\n * This entity is a root level object. It represents a patient It is serialized in JSON and saved in the underlying icure-patient CouchDB database.\n */\nimport { b64_2ab } from './ModelHelper'\nimport { SecurityMetadata } from './SecurityMetadata'\nimport { EntityWithDelegationTypeName } from '../../icc-x-api/utils/EntityWithDelegationTypeName'\nexport class Patient {\n constructor(json: JSON | any) {\n let pictureData: { picture?: ArrayBuffer } = {}\n if (!!json.picture) {\n if (typeof json.picture === 'string') {\n pictureData.picture = b64_2ab(json.picture)\n } else if (json.picture instanceof ArrayBuffer || ArrayBuffer.isView(json.picture)) {\n pictureData.picture = json.picture\n } else {\n throw new Error(`Invalid type for picture: ${typeof json.picture}`)\n }\n }\n Object.assign(this as Patient, json, pictureData)\n }\n\n /**\n * the Id of the patient. We encourage using either a v4 UUID or a HL7 Id.\n */\n id?: string\n /**\n * the revision of the patient in the database, used for conflict management / optimistic locking.\n */\n rev?: string\n identifier?: Array<Identifier>\n /**\n * The timestamp (unix epoch in ms) of creation of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n created?: number\n /**\n * The date (unix epoch in ms) of the latest modification of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n modified?: number\n /**\n * The id of the User that has created this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n author?: string\n /**\n * The id of the HealthcareParty that is responsible for this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n responsible?: string\n /**\n * A tag is an item from a codification system that qualifies an entity as being member of a certain class, whatever the value it might have taken. If the tag qualifies the content of a field, it means that whatever the content of the field, the tag will always apply. For example, the label of a field is qualified using a tag. LOINC is a codification system typically used for tags.\n */\n tags?: Array<CodeStub>\n /**\n * A code is an item from a codification system that qualifies the content of this entity. SNOMED-CT, ICPC-2 or ICD-10 codifications systems can be used for codes\n */\n codes?: Array<CodeStub>\n /**\n * Soft delete (unix epoch in ms) timestamp of the object.\n */\n endOfLife?: number\n /**\n * hard delete (unix epoch in ms) timestamp of the object. Filled automatically when deletePatient is called.\n */\n deletionDate?: number\n /**\n * the firstname (name) of the patient.\n */\n firstName?: string\n /**\n * the lastname (surname) of the patient. This is the official lastname that should be used for official administrative purposes.\n */\n lastName?: string\n /**\n * the list of all names of the patient, also containing the official full name information. Ordered by preference of use. First element is therefore the official name used for the patient in the application\n */\n names?: Array<PersonName>\n /**\n * the name of the company this patient is member of.\n */\n companyName?: string\n /**\n * the list of languages spoken by the patient ordered by fluency (alpha-2 code http://www.loc.gov/standards/iso639-2/ascii_8bits.html).\n */\n languages?: Array<string>\n /**\n * the list of addresses (with address type).\n */\n addresses?: Array<Address>\n /**\n * Mr., Ms., Pr., Dr. ...\n */\n civility?: string\n /**\n * the gender of the patient: male, female, indeterminate, changed, changedToMale, changedToFemale, unknown\n */\n gender?: Patient.GenderEnum\n /**\n * the birth sex of the patient: male, female, indeterminate, unknown\n */\n birthSex?: Patient.BirthSexEnum\n /**\n * The id of the patient this patient has been merged with.\n */\n mergeToPatientId?: string\n /**\n * The ids of the patients that have been merged inside this patient.\n */\n mergedIds?: Array<string>\n /**\n * An alias of the person, nickname, ...\n */\n alias?: string\n /**\n * Is the patient active (boolean).\n */\n active?: boolean\n /**\n * When not active, the reason for deactivation.\n */\n deactivationReason?: Patient.DeactivationReasonEnum\n /**\n * Deactivation date of the patient\n */\n deactivationDate?: number\n /**\n * Social security inscription number.\n */\n ssin?: string\n /**\n * Lastname at birth (can be different of the current name), depending on the country, must be used to design the patient .\n */\n maidenName?: string\n /**\n * Lastname of the spouse for a married woman, depending on the country, can be used to design the patient.\n */\n spouseName?: string\n /**\n * Lastname of the partner, should not be used to design the patient.\n */\n partnerName?: string\n /**\n * any of `single`, `in_couple`, `married`, `separated`, `divorced`, `divorcing`, `widowed`, `widower`, `complicated`, `unknown`, `contract`, `other`.\n */\n personalStatus?: Patient.PersonalStatusEnum\n /**\n * The birthdate encoded as a fuzzy date on 8 positions (YYYYMMDD) MM and/or DD can be set to 00 if unknown (19740000 is a valid date).\n */\n dateOfBirth?: number\n /**\n * The date of death encoded as a fuzzy date on 8 positions (YYYYMMDD) MM and/or DD can be set to 00 if unknown (19740000 is a valid date).\n */\n dateOfDeath?: number\n /**\n * Timestamp of the latest validation of the eID of the person..\n */\n timestampOfLatestEidReading?: number\n /**\n * The place of birth.\n */\n placeOfBirth?: string\n /**\n * The place of death.\n */\n placeOfDeath?: string\n /**\n * Is the patient deceased.\n */\n deceased?: boolean\n /**\n * The level of education (college degree, undergraduate, phd).\n */\n education?: string\n /**\n * The current professional activity.\n */\n profession?: string\n /**\n * A text note (can be confidential, encrypted by default).\n * @deprecated use notes instead with proper tags\n */\n note?: string\n /**\n * An administrative note, not confidential.\n * @deprecated use notes instead with proper tags\n */\n administrativeNote?: string\n /**\n * A list of localized notes.\n */\n notes?: Annotation[]\n /**\n * The nationality of the patient.\n */\n nationality?: string\n /**\n * The race of the patient.\n */\n race?: string\n /**\n * The ethnicity of the patient.\n */\n ethnicity?: string\n /**\n * The id of the user that usually handles this patient.\n */\n preferredUserId?: string\n /**\n * A picture usually saved in JPEG format.\n */\n picture?: ArrayBuffer\n /**\n * An external (from another source) id with no guarantee or requirement for unicity .\n */\n externalId?: string\n /**\n * List of insurance coverages (of class Insurability, see below).\n */\n insurabilities?: Array<Insurability>\n /**\n * List of partners, or persons of contact (of class Partnership, see below).\n */\n partnerships?: Array<Partnership>\n /**\n * Links (usually for therapeutic reasons) between this patient and healthcare parties (of class PatientHealthcareParty).\n */\n patientHealthCareParties?: Array<PatientHealthCareParty>\n /**\n * Financial information (Bank, bank account) used to reimburse the patient.\n */\n financialInstitutionInformation?: Array<FinancialInstitutionInformation>\n /**\n * Contracts between the patient and the healthcare entity.\n */\n medicalHouseContracts?: Array<MedicalHouseContract>\n /**\n * Codified list of professions exercised by this patient.\n */\n patientProfessions?: Array<CodeStub>\n /**\n * Extra parameters\n */\n parameters?: { [key: string]: Array<string> }\n /**\n * Extra properties\n */\n properties?: Array<PropertyStub>\n /**\n * For each couple of HcParties (delegator and delegate), this map contains the exchange AES key. The delegator is always this hcp, the key of the map is the id of the delegate.The AES exchange key is encrypted using RSA twice : once using this hcp public key (index 0 in the Array) and once using the other hcp public key (index 1 in the Array). For a pair of HcParties. Each HcParty always has one AES exchange key for himself.\n */\n hcPartyKeys?: { [key: string]: Array<string> }\n /**\n * Extra AES exchange keys, usually the ones we lost access to at some point. The structure is { publicKey: { delegateId: { myPubKey1: aesExKey_for_this, delegatePubKey1: aesExKey_for_delegate } } }\n */\n aesExchangeKeys?: { [key: string]: { [key: string]: { [key: string]: string } } }\n /**\n * Our private keys encrypted with our public keys. The structure is { publicKey1: { publicKey2: privateKey2_encrypted_with_publicKey1, publicKey3: privateKey3_encrypted_with_publicKey1 } }\n */\n transferKeys?: { [key: string]: { [key: string]: string } }\n /**\n * The privateKeyShamirPartitions are used to share this hcp's private RSA key with a series of other hcParties using Shamir's algorithm. The key of the map is the hcp Id with whom this partition has been shared. The value is \\\"threshold⎮partition in hex\\\" encrypted using the the partition's holder's public RSA key\n */\n privateKeyShamirPartitions?: { [key: string]: string }\n /**\n * The public key of this hcp\n */\n publicKey?: string\n /**\n * The public keys of this actor that are generates using the OAEP Sha-256 standard\n */\n publicKeysForOaepWithSha256?: Array<string>\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find all contacts for a specific patient. These keys are in clear. You can have several to partition the medical document space.\n */\n secretForeignKeys?: Array<string>\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find the patient for a specific contact. These keys are the encrypted id (using the hcParty key for the delegate) that can be found in clear inside the patient. ids encrypted using the hcParty keys.\n */\n cryptedForeignKeys?: { [key: string]: Array<Delegation> }\n /**\n * When a document is created, the responsible generates a cryptographically random master key (never to be used for something else than referencing from other entities). He/she encrypts it using his own AES exchange key and stores it as a delegation. The responsible is thus always in the delegations as well\n */\n delegations?: { [key: string]: Array<Delegation> }\n /**\n * When a document needs to be encrypted, the responsible generates a cryptographically random master key (different from the delegation key, never to appear in clear anywhere in the db. He/she encrypts it using his own AES exchange key and stores it as a delegation\n */\n encryptionKeys?: { [key: string]: Array<Delegation> }\n /**\n * The base64 encoded data of this object, formatted as JSON and encrypted in AES using the random master key from encryptionKeys.\n */\n encryptedSelf?: string\n /**\n * The id of the medical location where this entity was created.\n */\n medicalLocationId?: string\n nonDuplicateIds?: Array<string>\n encryptedAdministrativesDocuments?: Array<string>\n comment?: string\n warning?: string\n fatherBirthCountry?: CodeStub\n birthCountry?: CodeStub\n nativeCountry?: CodeStub\n socialStatus?: CodeStub\n mainSourceOfIncome?: CodeStub\n schoolingInfos?: Array<SchoolingInfo>\n employementInfos?: Array<EmploymentInfo>\n securityMetadata?: SecurityMetadata\n \n}\nexport namespace Patient {\n export type GenderEnum = 'male' | 'female' | 'indeterminate' | 'changed' | 'changedToMale' | 'changedToFemale' | 'unknown'\n export const GenderEnum = {\n Male: 'male' as GenderEnum,\n Female: 'female' as GenderEnum,\n Indeterminate: 'indeterminate' as GenderEnum,\n Changed: 'changed' as GenderEnum,\n ChangedToMale: 'changedToMale' as GenderEnum,\n ChangedToFemale: 'changedToFemale' as GenderEnum,\n Unknown: 'unknown' as GenderEnum,\n }\n export type BirthSexEnum = 'male' | 'female' | 'indeterminate' | 'changed' | 'changedToMale' | 'changedToFemale' | 'unknown'\n export const BirthSexEnum = {\n Male: 'male' as BirthSexEnum,\n Female: 'female' as BirthSexEnum,\n Indeterminate: 'indeterminate' as BirthSexEnum,\n Changed: 'changed' as BirthSexEnum,\n ChangedToMale: 'changedToMale' as BirthSexEnum,\n ChangedToFemale: 'changedToFemale' as BirthSexEnum,\n Unknown: 'unknown' as BirthSexEnum,\n }\n export type DeactivationReasonEnum = 'deceased' | 'moved' | 'other_doctor' | 'retired' | 'no_contact' | 'unknown' | 'none'\n export const DeactivationReasonEnum = {\n Deceased: 'deceased' as DeactivationReasonEnum,\n Moved: 'moved' as DeactivationReasonEnum,\n OtherDoctor: 'other_doctor' as DeactivationReasonEnum,\n Retired: 'retired' as DeactivationReasonEnum,\n NoContact: 'no_contact' as DeactivationReasonEnum,\n Unknown: 'unknown' as DeactivationReasonEnum,\n None: 'none' as DeactivationReasonEnum,\n }\n export type PersonalStatusEnum =\n | 'single'\n | 'in_couple'\n | 'married'\n | 'separated'\n | 'divorced'\n | 'divorcing'\n | 'widowed'\n | 'widower'\n | 'complicated'\n | 'unknown'\n | 'contract'\n | 'other'\n | 'annulled'\n | 'polygamous'\n export const PersonalStatusEnum = {\n Single: 'single' as PersonalStatusEnum,\n InCouple: 'in_couple' as PersonalStatusEnum,\n Married: 'married' as PersonalStatusEnum,\n Separated: 'separated' as PersonalStatusEnum,\n Divorced: 'divorced' as PersonalStatusEnum,\n Divorcing: 'divorcing' as PersonalStatusEnum,\n Widowed: 'widowed' as PersonalStatusEnum,\n Widower: 'widower' as PersonalStatusEnum,\n Complicated: 'complicated' as PersonalStatusEnum,\n Unknown: 'unknown' as PersonalStatusEnum,\n Contract: 'contract' as PersonalStatusEnum,\n Other: 'other' as PersonalStatusEnum,\n Annulled: 'annulled' as PersonalStatusEnum,\n Polygamous: 'polygamous' as PersonalStatusEnum,\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Patient.js","sourceRoot":"","sources":["../../../icc-api/model/Patient.ts"],"names":[],"mappings":";;;AA0BA;;GAEG;AACH,+CAAuC;AAGvC,MAAa,OAAO;IAClB,YAAY,IAAgB;QAC1B,IAAI,WAAW,GAA8B,EAAE,CAAA;QAC/C,IAAI,CAAC,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAA,EAAE;YACnB,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE;gBACpC,WAAW,CAAC,OAAO,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,OAAO,CAAC,CAAA;aAC5C;iBAAM,IAAI,IAAI,CAAC,OAAO,YAAY,WAAW,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;gBAClF,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;aACnC;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,6BAA6B,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;aACpE;SACF;QACD,MAAM,CAAC,MAAM,CAAC,IAAe,EAAE,IAAI,EAAE,WAAW,CAAC,CAAA;IACnD,CAAC;CA6RF;AA1SD,0BA0SC;AACD,WAAiB,OAAO;IAET,kBAAU,GAAG;QACxB,IAAI,EAAE,MAAoB;QAC1B,MAAM,EAAE,QAAsB;QAC9B,aAAa,EAAE,eAA6B;QAC5C,OAAO,EAAE,SAAuB;QAChC,aAAa,EAAE,eAA6B;QAC5C,eAAe,EAAE,iBAA+B;QAChD,OAAO,EAAE,SAAuB;KACjC,CAAA;IAEY,oBAAY,GAAG;QAC1B,IAAI,EAAE,MAAsB;QAC5B,MAAM,EAAE,QAAwB;QAChC,aAAa,EAAE,eAA+B;QAC9C,OAAO,EAAE,SAAyB;QAClC,aAAa,EAAE,eAA+B;QAC9C,eAAe,EAAE,iBAAiC;QAClD,OAAO,EAAE,SAAyB;KACnC,CAAA;IAEY,8BAAsB,GAAG;QACpC,QAAQ,EAAE,UAAoC;QAC9C,KAAK,EAAE,OAAiC;QACxC,WAAW,EAAE,cAAwC;QACrD,OAAO,EAAE,SAAmC;QAC5C,SAAS,EAAE,YAAsC;QACjD,OAAO,EAAE,SAAmC;QAC5C,IAAI,EAAE,MAAgC;KACvC,CAAA;IAgBY,0BAAkB,GAAG;QAChC,MAAM,EAAE,QAA8B;QACtC,QAAQ,EAAE,WAAiC;QAC3C,OAAO,EAAE,SAA+B;QACxC,SAAS,EAAE,WAAiC;QAC5C,QAAQ,EAAE,UAAgC;QAC1C,SAAS,EAAE,WAAiC;QAC5C,OAAO,EAAE,SAA+B;QACxC,OAAO,EAAE,SAA+B;QACxC,WAAW,EAAE,aAAmC;QAChD,OAAO,EAAE,SAA+B;QACxC,QAAQ,EAAE,UAAgC;QAC1C,KAAK,EAAE,OAA6B;QACpC,QAAQ,EAAE,UAAgC;QAC1C,UAAU,EAAE,YAAkC;KAC/C,CAAA;AACH,CAAC,EA9DgB,OAAO,GAAP,eAAO,KAAP,eAAO,QA8DvB","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 { Address } from './Address'\nimport { CodeStub } from './CodeStub'\nimport { Delegation } from './Delegation'\nimport { EmploymentInfo } from './EmploymentInfo'\nimport { FinancialInstitutionInformation } from './FinancialInstitutionInformation'\nimport { Identifier } from './Identifier'\nimport { Insurability } from './Insurability'\nimport { MedicalHouseContract } from './MedicalHouseContract'\nimport { Partnership } from './Partnership'\nimport { PatientHealthCareParty } from './PatientHealthCareParty'\nimport { PersonName } from './PersonName'\nimport { PropertyStub } from './PropertyStub'\nimport { SchoolingInfo } from './SchoolingInfo'\nimport { Annotation } from './Annotation'\n\n/**\n * This entity is a root level object. It represents a patient It is serialized in JSON and saved in the underlying icure-patient CouchDB database.\n */\nimport { b64_2ab } from './ModelHelper'\nimport { SecurityMetadata } from './SecurityMetadata'\nimport { EntityWithDelegationTypeName } from '../../icc-x-api/utils/EntityWithDelegationTypeName'\nexport class Patient {\n constructor(json: JSON | any) {\n let pictureData: { picture?: ArrayBuffer } = {}\n if (!!json?.picture) {\n if (typeof json.picture === 'string') {\n pictureData.picture = b64_2ab(json.picture)\n } else if (json.picture instanceof ArrayBuffer || ArrayBuffer.isView(json.picture)) {\n pictureData.picture = json.picture\n } else {\n throw new Error(`Invalid type for picture: ${typeof json.picture}`)\n }\n }\n Object.assign(this as Patient, json, pictureData)\n }\n\n /**\n * the Id of the patient. We encourage using either a v4 UUID or a HL7 Id.\n */\n id?: string\n /**\n * the revision of the patient in the database, used for conflict management / optimistic locking.\n */\n rev?: string\n identifier?: Array<Identifier>\n /**\n * The timestamp (unix epoch in ms) of creation of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n created?: number\n /**\n * The date (unix epoch in ms) of the latest modification of this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n modified?: number\n /**\n * The id of the User that has created this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n author?: string\n /**\n * The id of the HealthcareParty that is responsible for this entity, will be filled automatically if missing. Not enforced by the application server.\n */\n responsible?: string\n /**\n * A tag is an item from a codification system that qualifies an entity as being member of a certain class, whatever the value it might have taken. If the tag qualifies the content of a field, it means that whatever the content of the field, the tag will always apply. For example, the label of a field is qualified using a tag. LOINC is a codification system typically used for tags.\n */\n tags?: Array<CodeStub>\n /**\n * A code is an item from a codification system that qualifies the content of this entity. SNOMED-CT, ICPC-2 or ICD-10 codifications systems can be used for codes\n */\n codes?: Array<CodeStub>\n /**\n * Soft delete (unix epoch in ms) timestamp of the object.\n */\n endOfLife?: number\n /**\n * hard delete (unix epoch in ms) timestamp of the object. Filled automatically when deletePatient is called.\n */\n deletionDate?: number\n /**\n * the firstname (name) of the patient.\n */\n firstName?: string\n /**\n * the lastname (surname) of the patient. This is the official lastname that should be used for official administrative purposes.\n */\n lastName?: string\n /**\n * the list of all names of the patient, also containing the official full name information. Ordered by preference of use. First element is therefore the official name used for the patient in the application\n */\n names?: Array<PersonName>\n /**\n * the name of the company this patient is member of.\n */\n companyName?: string\n /**\n * the list of languages spoken by the patient ordered by fluency (alpha-2 code http://www.loc.gov/standards/iso639-2/ascii_8bits.html).\n */\n languages?: Array<string>\n /**\n * the list of addresses (with address type).\n */\n addresses?: Array<Address>\n /**\n * Mr., Ms., Pr., Dr. ...\n */\n civility?: string\n /**\n * the gender of the patient: male, female, indeterminate, changed, changedToMale, changedToFemale, unknown\n */\n gender?: Patient.GenderEnum\n /**\n * the birth sex of the patient: male, female, indeterminate, unknown\n */\n birthSex?: Patient.BirthSexEnum\n /**\n * The id of the patient this patient has been merged with.\n */\n mergeToPatientId?: string\n /**\n * The ids of the patients that have been merged inside this patient.\n */\n mergedIds?: Array<string>\n /**\n * An alias of the person, nickname, ...\n */\n alias?: string\n /**\n * Is the patient active (boolean).\n */\n active?: boolean\n /**\n * When not active, the reason for deactivation.\n */\n deactivationReason?: Patient.DeactivationReasonEnum\n /**\n * Deactivation date of the patient\n */\n deactivationDate?: number\n /**\n * Social security inscription number.\n */\n ssin?: string\n /**\n * Lastname at birth (can be different of the current name), depending on the country, must be used to design the patient .\n */\n maidenName?: string\n /**\n * Lastname of the spouse for a married woman, depending on the country, can be used to design the patient.\n */\n spouseName?: string\n /**\n * Lastname of the partner, should not be used to design the patient.\n */\n partnerName?: string\n /**\n * any of `single`, `in_couple`, `married`, `separated`, `divorced`, `divorcing`, `widowed`, `widower`, `complicated`, `unknown`, `contract`, `other`.\n */\n personalStatus?: Patient.PersonalStatusEnum\n /**\n * The birthdate encoded as a fuzzy date on 8 positions (YYYYMMDD) MM and/or DD can be set to 00 if unknown (19740000 is a valid date).\n */\n dateOfBirth?: number\n /**\n * The date of death encoded as a fuzzy date on 8 positions (YYYYMMDD) MM and/or DD can be set to 00 if unknown (19740000 is a valid date).\n */\n dateOfDeath?: number\n /**\n * Timestamp of the latest validation of the eID of the person..\n */\n timestampOfLatestEidReading?: number\n /**\n * The place of birth.\n */\n placeOfBirth?: string\n /**\n * The place of death.\n */\n placeOfDeath?: string\n /**\n * Is the patient deceased.\n */\n deceased?: boolean\n /**\n * The level of education (college degree, undergraduate, phd).\n */\n education?: string\n /**\n * The current professional activity.\n */\n profession?: string\n /**\n * A text note (can be confidential, encrypted by default).\n * @deprecated use notes instead with proper tags\n */\n note?: string\n /**\n * An administrative note, not confidential.\n * @deprecated use notes instead with proper tags\n */\n administrativeNote?: string\n /**\n * A list of localized notes.\n */\n notes?: Annotation[]\n /**\n * The nationality of the patient.\n */\n nationality?: string\n /**\n * The race of the patient.\n */\n race?: string\n /**\n * The ethnicity of the patient.\n */\n ethnicity?: string\n /**\n * The id of the user that usually handles this patient.\n */\n preferredUserId?: string\n /**\n * A picture usually saved in JPEG format.\n */\n picture?: ArrayBuffer\n /**\n * An external (from another source) id with no guarantee or requirement for unicity .\n */\n externalId?: string\n /**\n * List of insurance coverages (of class Insurability, see below).\n */\n insurabilities?: Array<Insurability>\n /**\n * List of partners, or persons of contact (of class Partnership, see below).\n */\n partnerships?: Array<Partnership>\n /**\n * Links (usually for therapeutic reasons) between this patient and healthcare parties (of class PatientHealthcareParty).\n */\n patientHealthCareParties?: Array<PatientHealthCareParty>\n /**\n * Financial information (Bank, bank account) used to reimburse the patient.\n */\n financialInstitutionInformation?: Array<FinancialInstitutionInformation>\n /**\n * Contracts between the patient and the healthcare entity.\n */\n medicalHouseContracts?: Array<MedicalHouseContract>\n /**\n * Codified list of professions exercised by this patient.\n */\n patientProfessions?: Array<CodeStub>\n /**\n * Extra parameters\n */\n parameters?: { [key: string]: Array<string> }\n /**\n * Extra properties\n */\n properties?: Array<PropertyStub>\n /**\n * For each couple of HcParties (delegator and delegate), this map contains the exchange AES key. The delegator is always this hcp, the key of the map is the id of the delegate.The AES exchange key is encrypted using RSA twice : once using this hcp public key (index 0 in the Array) and once using the other hcp public key (index 1 in the Array). For a pair of HcParties. Each HcParty always has one AES exchange key for himself.\n */\n hcPartyKeys?: { [key: string]: Array<string> }\n /**\n * Extra AES exchange keys, usually the ones we lost access to at some point. The structure is { publicKey: { delegateId: { myPubKey1: aesExKey_for_this, delegatePubKey1: aesExKey_for_delegate } } }\n */\n aesExchangeKeys?: { [key: string]: { [key: string]: { [key: string]: string } } }\n /**\n * Our private keys encrypted with our public keys. The structure is { publicKey1: { publicKey2: privateKey2_encrypted_with_publicKey1, publicKey3: privateKey3_encrypted_with_publicKey1 } }\n */\n transferKeys?: { [key: string]: { [key: string]: string } }\n /**\n * The privateKeyShamirPartitions are used to share this hcp's private RSA key with a series of other hcParties using Shamir's algorithm. The key of the map is the hcp Id with whom this partition has been shared. The value is \\\"threshold⎮partition in hex\\\" encrypted using the the partition's holder's public RSA key\n */\n privateKeyShamirPartitions?: { [key: string]: string }\n /**\n * The public key of this hcp\n */\n publicKey?: string\n /**\n * The public keys of this actor that are generates using the OAEP Sha-256 standard\n */\n publicKeysForOaepWithSha256?: Array<string>\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find all contacts for a specific patient. These keys are in clear. You can have several to partition the medical document space.\n */\n secretForeignKeys?: Array<string>\n /**\n * The secretForeignKeys are filled at the to many end of a one to many relationship (for example inside Contact for the Patient -> Contacts relationship). Used when we want to find the patient for a specific contact. These keys are the encrypted id (using the hcParty key for the delegate) that can be found in clear inside the patient. ids encrypted using the hcParty keys.\n */\n cryptedForeignKeys?: { [key: string]: Array<Delegation> }\n /**\n * When a document is created, the responsible generates a cryptographically random master key (never to be used for something else than referencing from other entities). He/she encrypts it using his own AES exchange key and stores it as a delegation. The responsible is thus always in the delegations as well\n */\n delegations?: { [key: string]: Array<Delegation> }\n /**\n * When a document needs to be encrypted, the responsible generates a cryptographically random master key (different from the delegation key, never to appear in clear anywhere in the db. He/she encrypts it using his own AES exchange key and stores it as a delegation\n */\n encryptionKeys?: { [key: string]: Array<Delegation> }\n /**\n * The base64 encoded data of this object, formatted as JSON and encrypted in AES using the random master key from encryptionKeys.\n */\n encryptedSelf?: string\n /**\n * The id of the medical location where this entity was created.\n */\n medicalLocationId?: string\n nonDuplicateIds?: Array<string>\n encryptedAdministrativesDocuments?: Array<string>\n comment?: string\n warning?: string\n fatherBirthCountry?: CodeStub\n birthCountry?: CodeStub\n nativeCountry?: CodeStub\n socialStatus?: CodeStub\n mainSourceOfIncome?: CodeStub\n schoolingInfos?: Array<SchoolingInfo>\n employementInfos?: Array<EmploymentInfo>\n securityMetadata?: SecurityMetadata\n}\nexport namespace Patient {\n export type GenderEnum = 'male' | 'female' | 'indeterminate' | 'changed' | 'changedToMale' | 'changedToFemale' | 'unknown'\n export const GenderEnum = {\n Male: 'male' as GenderEnum,\n Female: 'female' as GenderEnum,\n Indeterminate: 'indeterminate' as GenderEnum,\n Changed: 'changed' as GenderEnum,\n ChangedToMale: 'changedToMale' as GenderEnum,\n ChangedToFemale: 'changedToFemale' as GenderEnum,\n Unknown: 'unknown' as GenderEnum,\n }\n export type BirthSexEnum = 'male' | 'female' | 'indeterminate' | 'changed' | 'changedToMale' | 'changedToFemale' | 'unknown'\n export const BirthSexEnum = {\n Male: 'male' as BirthSexEnum,\n Female: 'female' as BirthSexEnum,\n Indeterminate: 'indeterminate' as BirthSexEnum,\n Changed: 'changed' as BirthSexEnum,\n ChangedToMale: 'changedToMale' as BirthSexEnum,\n ChangedToFemale: 'changedToFemale' as BirthSexEnum,\n Unknown: 'unknown' as BirthSexEnum,\n }\n export type DeactivationReasonEnum = 'deceased' | 'moved' | 'other_doctor' | 'retired' | 'no_contact' | 'unknown' | 'none'\n export const DeactivationReasonEnum = {\n Deceased: 'deceased' as DeactivationReasonEnum,\n Moved: 'moved' as DeactivationReasonEnum,\n OtherDoctor: 'other_doctor' as DeactivationReasonEnum,\n Retired: 'retired' as DeactivationReasonEnum,\n NoContact: 'no_contact' as DeactivationReasonEnum,\n Unknown: 'unknown' as DeactivationReasonEnum,\n None: 'none' as DeactivationReasonEnum,\n }\n export type PersonalStatusEnum =\n | 'single'\n | 'in_couple'\n | 'married'\n | 'separated'\n | 'divorced'\n | 'divorcing'\n | 'widowed'\n | 'widower'\n | 'complicated'\n | 'unknown'\n | 'contract'\n | 'other'\n | 'annulled'\n | 'polygamous'\n export const PersonalStatusEnum = {\n Single: 'single' as PersonalStatusEnum,\n InCouple: 'in_couple' as PersonalStatusEnum,\n Married: 'married' as PersonalStatusEnum,\n Separated: 'separated' as PersonalStatusEnum,\n Divorced: 'divorced' as PersonalStatusEnum,\n Divorcing: 'divorcing' as PersonalStatusEnum,\n Widowed: 'widowed' as PersonalStatusEnum,\n Widower: 'widower' as PersonalStatusEnum,\n Complicated: 'complicated' as PersonalStatusEnum,\n Unknown: 'unknown' as PersonalStatusEnum,\n Contract: 'contract' as PersonalStatusEnum,\n Other: 'other' as PersonalStatusEnum,\n Annulled: 'annulled' as PersonalStatusEnum,\n Polygamous: 'polygamous' as PersonalStatusEnum,\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class SamV2Update {
|
|
2
|
+
constructor(json: JSON | any);
|
|
3
|
+
id?: string;
|
|
4
|
+
rev?: string;
|
|
5
|
+
samVersion?: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
date?: number;
|
|
8
|
+
type?: string;
|
|
9
|
+
updates?: {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
};
|
|
12
|
+
deletions?: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SamV2Update = void 0;
|
|
4
|
+
class SamV2Update {
|
|
5
|
+
constructor(json) {
|
|
6
|
+
Object.assign(this, json);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.SamV2Update = SamV2Update;
|
|
10
|
+
//# sourceMappingURL=SamV2Update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SamV2Update.js","sourceRoot":"","sources":["../../../icc-api/model/SamV2Update.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;IACtB,YAAY,IAAgB;QAC1B,MAAM,CAAC,MAAM,CAAC,IAAmB,EAAE,IAAI,CAAC,CAAA;IAC1C,CAAC;CAUF;AAbD,kCAaC","sourcesContent":["export class SamV2Update {\n constructor(json: JSON | any) {\n Object.assign(this as SamV2Update, json)\n }\n\n id?: string\n rev?: string\n samVersion?: string\n version?: string\n date?: number\n type?: string\n updates?: { [key: string]: string }\n deletions?: { [key: string]: string }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SamV2UpdateTaskLogItem = void 0;
|
|
4
|
+
class SamV2UpdateTaskLogItem {
|
|
5
|
+
constructor(json) {
|
|
6
|
+
Object.assign(this, json);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.SamV2UpdateTaskLogItem = SamV2UpdateTaskLogItem;
|
|
10
|
+
//# sourceMappingURL=SamV2UpdateTaskLogItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SamV2UpdateTaskLogItem.js","sourceRoot":"","sources":["../../../icc-api/model/SamV2UpdateTaskLogItem.ts"],"names":[],"mappings":";;;AAAA,MAAa,sBAAsB;IACjC,YAAY,IAAgB;QAC1B,MAAM,CAAC,MAAM,CAAC,IAA8B,EAAE,IAAI,CAAC,CAAA;IACrD,CAAC;CAKF;AARD,wDAQC","sourcesContent":["export class SamV2UpdateTaskLogItem {\n constructor(json: JSON | any) {\n Object.assign(this as SamV2UpdateTaskLogItem, json)\n }\n\n status?: 'Started' | 'Running' | 'Error' | 'Completed' | 'Missing'\n time?: number\n msg?: string\n}\n"]}
|
package/package.json
CHANGED
|
@@ -138,7 +138,7 @@ describe('test confidential helement', () => {
|
|
|
138
138
|
(0, chai_1.expect)(anyNonConfidentialHe.secretForeignKeys).to.have.length(1);
|
|
139
139
|
(0, chai_1.expect)(nonConfidentialSecretIds).to.include(anyNonConfidentialHe.secretForeignKeys[0]);
|
|
140
140
|
const allNonConfidentialHe = yield childApi.healthcareElementApi.newInstance(childUser, modifiedPatient, { descr: 'Confidential info' }, { sfkOption: UseAllSharedWithParent });
|
|
141
|
-
(0, chai_1.expect)(allNonConfidentialHe.secretForeignKeys).to.have.members(
|
|
141
|
+
(0, chai_1.expect)(allNonConfidentialHe.secretForeignKeys).to.have.members(nonConfidentialSecretIds);
|
|
142
142
|
}));
|
|
143
143
|
it('Should allow creation of half-links by using no sfk', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
144
|
const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = yield (0, test_utils_1.createHcpHierarchyApis)(env);
|
|
@@ -149,5 +149,20 @@ describe('test confidential helement', () => {
|
|
|
149
149
|
(0, chai_1.expect)(decryptedPatientId).to.have.length(1);
|
|
150
150
|
(0, chai_1.expect)(decryptedPatientId[0]).to.equal(pat.id);
|
|
151
151
|
}));
|
|
152
|
+
it('Should allow creation of links using the provided sfks', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
153
|
+
const { parentApi: childApi, parentUser: childUser, grandApi: parentApi, grandUser: parentUser } = yield (0, test_utils_1.createHcpHierarchyApis)(env);
|
|
154
|
+
const pat = yield childApi.patientApi.newInstance(childUser, { firstName: 'John', lastName: 'Doe' });
|
|
155
|
+
const modifiedPatient = (yield childApi.patientApi.initConfidentialSecretId(pat, childUser));
|
|
156
|
+
const secretIds = yield childApi.patientApi.decryptSecretIdsOf(modifiedPatient);
|
|
157
|
+
(0, chai_1.expect)(secretIds).to.have.length(2);
|
|
158
|
+
const halfLinkedHe = yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: new SecretIdUseOption_1.SecretIdUseOption.Use([]), ignoreAutoDelegations: true });
|
|
159
|
+
(0, chai_1.expect)(halfLinkedHe.secretForeignKeys).to.have.length(0);
|
|
160
|
+
const linkedHeSfk0 = yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: new SecretIdUseOption_1.SecretIdUseOption.Use([secretIds[0]]), ignoreAutoDelegations: true });
|
|
161
|
+
(0, chai_1.expect)(linkedHeSfk0.secretForeignKeys).to.have.members([secretIds[0]]);
|
|
162
|
+
const linkedHeSfk1 = yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: new SecretIdUseOption_1.SecretIdUseOption.Use([secretIds[1]]), ignoreAutoDelegations: true });
|
|
163
|
+
(0, chai_1.expect)(linkedHeSfk1.secretForeignKeys).to.have.members([secretIds[1]]);
|
|
164
|
+
const linkedHeSfkBoth = yield childApi.healthcareElementApi.newInstance(childUser, pat, { descr: 'Confidential info' }, { sfkOption: new SecretIdUseOption_1.SecretIdUseOption.Use(secretIds), ignoreAutoDelegations: true });
|
|
165
|
+
(0, chai_1.expect)(linkedHeSfkBoth.secretForeignKeys).to.have.members(secretIds);
|
|
166
|
+
}));
|
|
152
167
|
});
|
|
153
168
|
//# sourceMappingURL=confidential-entities-test.js.map
|
|
@@ -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,S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AI,EAAE,CACpD,CAAA;QACD,IAAA,aAAM,EAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QACxD,MAAM,kBAAkB,GAAG,MAAM,QAAQ,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAA;QAC/F,IAAA,aAAM,EAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAC5C,IAAA,aAAM,EAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAChD,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(confidentialSecretIds)\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"]}
|
|
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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CAAC,EAAE,qBAAqB,EAAE,IAAI,EAAE,CACtF,CAAA;QACD,IAAA,aAAM,EAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACtE,MAAM,eAAe,GAAG,MAAM,QAAQ,CAAC,oBAAoB,CAAC,WAAW,CACrE,SAAS,EACT,GAAG,EACH,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAC9B,EAAE,SAAS,EAAE,IAAI,qCAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,qBAAqB,EAAE,IAAI,EAAE,CACjF,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 +0,0 @@
|
|
|
1
|
-
import 'isomorphic-fetch';
|
|
@@ -1,75 +0,0 @@
|
|
|
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
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
require("isomorphic-fetch");
|
|
13
|
-
const util_1 = require("util");
|
|
14
|
-
const icc_x_api_1 = require("../../icc-x-api");
|
|
15
|
-
const crypto_1 = require("crypto");
|
|
16
|
-
function setLocalStorage(fetch) {
|
|
17
|
-
;
|
|
18
|
-
global.localStorage = new (require('node-localstorage').LocalStorage)("/Users/trema/icure-typescript-sdk/scratch", 5 * Math.pow(1024, 3));
|
|
19
|
-
global.fetch = fetch;
|
|
20
|
-
global.Storage = '';
|
|
21
|
-
global.TextDecoder = util_1.TextDecoder;
|
|
22
|
-
global.TextEncoder = util_1.TextEncoder;
|
|
23
|
-
global.headers = Headers;
|
|
24
|
-
}
|
|
25
|
-
setLocalStorage(fetch);
|
|
26
|
-
class MyCryptoStrategies {
|
|
27
|
-
dataOwnerRequiresAnonymousDelegation(dataOwner) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
generateNewKeyForDataOwner(self, cryptoPrimitives) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
return Promise.resolve(false);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
recoverAndVerifySelfHierarchyKeys(keysData, cryptoPrimitives, keyPairRecoverer) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
return {
|
|
38
|
-
"44f19c1a-8da8-4959-90df-96a2e98112f4": {
|
|
39
|
-
recoveredKeys: {
|
|
40
|
-
"a6987fd0b8335e60a59abf0203010001": yield cryptoPrimitives.RSA.importKeyPair("pkcs8", (0, icc_x_api_1.hex2ua)("privhere"), "spki", (0, icc_x_api_1.hex2ua)("30820122300d06092a864886f70d01010105000382010f003082010a0282010100a0c7b15b203e00d233f169897ad96c3f82137c3d302e490264238fbda1f609c1152f4a1e75848e5d87133db56fa00678c4e5d9c27efb51e37d59e214b2fcfd7a5d89015a60f582d53ff8ee9c6164f003ec2f08984203008ac3d2a7f169c06cee3629611f04fc6e806a2a6ef846277c9c52c0dedd78ed11185208d0d544ee641b080b7178cb15d2a14b78e9c0e5629a2dac3a97a0a5bd13e694af68daad1ca86ee34cdeecef26db26360c6773c9c6b614b8040cdcbb306a3baac726a9928c792f6801dd65277f8febac1791fbf35eab7968bb0ed16d49308dff679a5e915e73fb827e5efa13ac04c1b2595069d7f50d4fd0e8589e7ba6987fd0b8335e60a59abf0203010001"), icc_x_api_1.ShaVersion.Sha1)
|
|
41
|
-
},
|
|
42
|
-
keyAuthenticity: {}
|
|
43
|
-
},
|
|
44
|
-
"f80f2b9f-4924-4a46-a6a4-a176f33607d8": {
|
|
45
|
-
recoveredKeys: {
|
|
46
|
-
"dd1574537845c22ac062190203010001": yield cryptoPrimitives.RSA.importKeyPair("pkcs8", (0, icc_x_api_1.hex2ua)("privhere"), "spki", (0, icc_x_api_1.hex2ua)("30820122300d06092a864886f70d01010105000382010f003082010a028201010095b3e15bf00ee73c2adea786f0783cd0ddf09e8aeded45e4a0b5982c96b8025ef6e7b31e2498073fa956dc195871e7e64f37a663900aae2ba9e6c89651b8bbb3da03e77e12424dddccf2343c2ac9e64f99f2bf1dc6fa0acfe289d0c0cb41dd0dbc6c71f8cdab722ec2a6f73a241eda7600128e64bcd0f106eca8f849fd8ec1c9c27c61d88a3c4c6940c43d7d54efc01b397e835e8ef43a2c2f216aa5ad1a281399ac513d407389d4661f68b45f7c12354547666087a2a644bdc7823e06adada1142d35cf048da03106040281b6b26a213bca037d3b63fd974fcd518938c697000a738ac2c7c6578d7ee7bb9662d35133bc8b919b37dd1574537845c22ac062190203010001"), icc_x_api_1.ShaVersion.Sha1)
|
|
47
|
-
},
|
|
48
|
-
keyAuthenticity: {}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
verifyDelegatePublicKeys(delegate, publicKeys, cryptoPrimitives) {
|
|
54
|
-
throw "Unused";
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
describe('Autofix anonymity tests', () => {
|
|
58
|
-
it('User', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
console.log("Start init");
|
|
60
|
-
const api = yield icc_x_api_1.IcureApi.initialise("https://api.icure.cloud", { "username": "2de6069e-b8af-4831-aac9-75953b4780cf", password: "54d3b6ba-e969-453f-bf6c-b0a2e6f26b87" }, new MyCryptoStrategies(), crypto_1.webcrypto, fetch);
|
|
61
|
-
console.log("Init done");
|
|
62
|
-
const user = yield api.userApi.getCurrentUser();
|
|
63
|
-
console.log("Getting calendar items");
|
|
64
|
-
const calendarItems = yield api.calendarItemApi.getCalendarsByPeriodAndAgendaIdWithUser(user, 20250117000000, 20250118000000, "agenda_2de6069e-b8af-4831-aac9-75953b4780cf");
|
|
65
|
-
for (const ci of calendarItems) {
|
|
66
|
-
yield api.calendarItemApi.getDataOwnersWithAccessTo(ci);
|
|
67
|
-
}
|
|
68
|
-
// console.log(calendarItems.map((x) => x.details))
|
|
69
|
-
// console.log("Getting time tables")
|
|
70
|
-
// const timeTables: Array<TimeTable> = await api.timetableApi.getTimeTablesByPeriodAndAgendaId(20250117000000, 20250118000000, "agenda_2de6069e-b8af-4831-aac9-75953b4780cf")
|
|
71
|
-
// console.log("Get types")
|
|
72
|
-
// console.log(await api.calendarItemTypeApi.getCalendarItemTypesIncludeDeletedWithPagination())
|
|
73
|
-
}));
|
|
74
|
-
});
|
|
75
|
-
//# sourceMappingURL=diocancaro.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diocancaro.js","sourceRoot":"","sources":["../../../test/icc-x-api/diocancaro.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4BAAyB;AACzB,+BAA8C;AAC9C,+CAA0G;AAI1G,mCAAiC;AAIjC,SAAS,eAAe,CAAC,KAAoE;IAC3F,CAAC;IAAC,MAAc,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,CAAC,2CAA2C,EAAE,CAAC,GAAG,SAAA,IAAI,EAAI,CAAC,CAAA,CAAC,CAC1I;IAAC,MAAc,CAAC,KAAK,GAAG,KAAK,CAC7B;IAAC,MAAc,CAAC,OAAO,GAAG,EAAE,CAC5B;IAAC,MAAc,CAAC,WAAW,GAAG,kBAAW,CACzC;IAAC,MAAc,CAAC,WAAW,GAAG,kBAAW,CACzC;IAAC,MAAc,CAAC,OAAO,GAAG,OAAO,CAAA;AACpC,CAAC;AACD,eAAe,CAAC,KAAK,CAAC,CAAA;AAEtB,MAAM,kBAAkB;IACtB,oCAAoC,CAAC,SAAkC;QACrE,OAAO,KAAK,CAAC;IACf,CAAC;IAEK,0BAA0B,CAAC,IAAuB,EAA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AG,CAAC,OAAO,CAAC,cAAc,EAAE,CAAA;QAC/C,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;QACrC,MAAM,aAAa,GAAwB,MAAM,GAAG,CAAC,eAAe,CAAC,uCAAuC,CAAC,IAAI,EAAE,cAAc,EAAE,cAAc,EAAE,6CAA6C,CAAC,CAAA;QACjM,KAAK,MAAM,EAAE,IAAI,aAAa,EAAE;YAC9B,MAAM,GAAG,CAAC,eAAe,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAA;SACxD;QACD,mDAAmD;QACnD,qCAAqC;QACrC,8KAA8K;QAC9K,2BAA2B;QAC3B,gGAAgG;IAClG,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import 'isomorphic-fetch'\nimport {TextDecoder, TextEncoder} from \"util\";\nimport {CryptoPrimitives, CryptoStrategies, hex2ua, IcureApi, KeyPair, ShaVersion} from \"../../icc-x-api\";\nimport {CryptoActorStubWithType} from \"../../icc-api/model/CryptoActorStub\";\nimport {DataOwnerWithType} from \"../../icc-api/model/DataOwnerWithType\";\nimport {KeyPairRecoverer} from \"../../icc-x-api/crypto/KeyPairRecoverer\";\nimport {webcrypto} from \"crypto\";\nimport {CalendarItem} from \"../../icc-api/model/CalendarItem\";\nimport {TimeTable} from \"../../icc-api/model/TimeTable\";\n\nfunction setLocalStorage(fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>) {\n ;(global as any).localStorage = new (require('node-localstorage').LocalStorage)(\"/Users/trema/icure-typescript-sdk/scratch\", 5 * 1024 ** 3)\n ;(global as any).fetch = fetch\n ;(global as any).Storage = ''\n ;(global as any).TextDecoder = TextDecoder\n ;(global as any).TextEncoder = TextEncoder\n ;(global as any).headers = Headers\n}\nsetLocalStorage(fetch)\n\nclass MyCryptoStrategies implements CryptoStrategies {\n dataOwnerRequiresAnonymousDelegation(dataOwner: CryptoActorStubWithType): boolean {\n return false;\n }\n\n async generateNewKeyForDataOwner(self: DataOwnerWithType, cryptoPrimitives: CryptoPrimitives): Promise<KeyPair<CryptoKey> | boolean> {\n return Promise.resolve(false);\n }\n\n async recoverAndVerifySelfHierarchyKeys(keysData: {\n dataOwner: DataOwnerWithType;\n unknownKeys: string[];\n unavailableKeys: string[]\n }[], cryptoPrimitives: CryptoPrimitives, keyPairRecoverer: KeyPairRecoverer): Promise<{\n [p: string]: { recoveredKeys: { [p: string]: KeyPair<CryptoKey> }; keyAuthenticity: { [p: string]: boolean } }\n }> {\n return {\n \"44f19c1a-8da8-4959-90df-96a2e98112f4\": {\n recoveredKeys: {\n \"a6987fd0b8335e60a59abf0203010001\": await cryptoPrimitives.RSA.importKeyPair(\n \"pkcs8\",\n hex2ua(\"privhere\"),\n \"spki\",\n hex2ua(\"30820122300d06092a864886f70d01010105000382010f003082010a0282010100a0c7b15b203e00d233f169897ad96c3f82137c3d302e490264238fbda1f609c1152f4a1e75848e5d87133db56fa00678c4e5d9c27efb51e37d59e214b2fcfd7a5d89015a60f582d53ff8ee9c6164f003ec2f08984203008ac3d2a7f169c06cee3629611f04fc6e806a2a6ef846277c9c52c0dedd78ed11185208d0d544ee641b080b7178cb15d2a14b78e9c0e5629a2dac3a97a0a5bd13e694af68daad1ca86ee34cdeecef26db26360c6773c9c6b614b8040cdcbb306a3baac726a9928c792f6801dd65277f8febac1791fbf35eab7968bb0ed16d49308dff679a5e915e73fb827e5efa13ac04c1b2595069d7f50d4fd0e8589e7ba6987fd0b8335e60a59abf0203010001\"),\n ShaVersion.Sha1\n )\n },\n keyAuthenticity: {}\n },\n \"f80f2b9f-4924-4a46-a6a4-a176f33607d8\": {\n recoveredKeys: {\n \"dd1574537845c22ac062190203010001\": await cryptoPrimitives.RSA.importKeyPair(\n \"pkcs8\",\n hex2ua(\"privhere\"),\n \"spki\",\n hex2ua(\"30820122300d06092a864886f70d01010105000382010f003082010a028201010095b3e15bf00ee73c2adea786f0783cd0ddf09e8aeded45e4a0b5982c96b8025ef6e7b31e2498073fa956dc195871e7e64f37a663900aae2ba9e6c89651b8bbb3da03e77e12424dddccf2343c2ac9e64f99f2bf1dc6fa0acfe289d0c0cb41dd0dbc6c71f8cdab722ec2a6f73a241eda7600128e64bcd0f106eca8f849fd8ec1c9c27c61d88a3c4c6940c43d7d54efc01b397e835e8ef43a2c2f216aa5ad1a281399ac513d407389d4661f68b45f7c12354547666087a2a644bdc7823e06adada1142d35cf048da03106040281b6b26a213bca037d3b63fd974fcd518938c697000a738ac2c7c6578d7ee7bb9662d35133bc8b919b37dd1574537845c22ac062190203010001\"),\n ShaVersion.Sha1\n )\n },\n keyAuthenticity: {}\n }\n }\n }\n\n verifyDelegatePublicKeys(delegate: CryptoActorStubWithType, publicKeys: string[], cryptoPrimitives: CryptoPrimitives): Promise<string[]> {\n throw \"Unused\";\n }\n\n}\n\ndescribe('Autofix anonymity tests', () => {\n it('User', async () => {\n console.log(\"Start init\")\n const api = await IcureApi.initialise(\n \"https://api.icure.cloud\",\n { \"username\": \"2de6069e-b8af-4831-aac9-75953b4780cf\", password: \"54d3b6ba-e969-453f-bf6c-b0a2e6f26b87\"},\n new MyCryptoStrategies(),\n webcrypto as any,\n fetch,\n )\n console.log(\"Init done\")\n const user = await api.userApi.getCurrentUser()\n console.log(\"Getting calendar items\")\n const calendarItems: Array<CalendarItem> = await api.calendarItemApi.getCalendarsByPeriodAndAgendaIdWithUser(user, 20250117000000, 20250118000000, \"agenda_2de6069e-b8af-4831-aac9-75953b4780cf\")\n for (const ci of calendarItems) {\n await api.calendarItemApi.getDataOwnersWithAccessTo(ci)\n }\n // console.log(calendarItems.map((x) => x.details))\n // console.log(\"Getting time tables\")\n // const timeTables: Array<TimeTable> = await api.timetableApi.getTimeTablesByPeriodAndAgendaId(20250117000000, 20250118000000, \"agenda_2de6069e-b8af-4831-aac9-75953b4780cf\")\n // console.log(\"Get types\")\n // console.log(await api.calendarItemTypeApi.getCalendarItemTypesIncludeDeletedWithPagination())\n })\n})"]}
|