@icure/cardinal-sdk 2.4.4 → 2.6.0

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.
Files changed (37) hide show
  1. package/Kotlin-DateTime-library-kotlinx-datetime.mjs +1 -1
  2. package/api/RoleApi.d.mts +6 -4
  3. package/cardinal-sdk-ts.d.mts +78 -78
  4. package/cardinal-sdk-ts.mjs +39335 -39225
  5. package/cardinal-sdk.mjs +68660 -69414
  6. package/filters/ContactFilters.d.mts +9 -26
  7. package/filters/DocumentFilters.d.mts +6 -12
  8. package/filters/HealthElementFilters.d.mts +15 -41
  9. package/filters/MaintenanceTaskFilters.d.mts +2 -8
  10. package/filters/MessageFilters.d.mts +8 -22
  11. package/filters/PatientFilters.d.mts +24 -62
  12. package/filters/ServiceFilters.d.mts +19 -52
  13. package/kotlin-kotlin-stdlib.mjs +10 -10
  14. package/model/Agenda.d.mts +4 -4
  15. package/model/Agenda.mjs +4 -4
  16. package/model/CalendarItem.d.mts +9 -9
  17. package/model/CalendarItem.mjs +6 -6
  18. package/model/Group.d.mts +1 -1
  19. package/model/Group.mjs +1 -1
  20. package/model/Patient.d.mts +3 -3
  21. package/model/Patient.mjs +3 -3
  22. package/model/Role.d.mts +16 -6
  23. package/model/Role.mjs +20 -5
  24. package/model/User.d.mts +6 -0
  25. package/model/User.mjs +11 -0
  26. package/model/base/CryptoActor.mjs +3 -3
  27. package/model/embed/Partnership.d.mts +60 -3
  28. package/model/embed/Partnership.mjs +85 -4
  29. package/model/embed/Service.d.mts +306 -0
  30. package/model/embed/Service.mjs +214 -0
  31. package/model/embed/form/template/Field.d.mts +1 -1
  32. package/model/embed/form/template/StructureElement.mjs +6 -6
  33. package/model/filter/predicate/Predicate.d.mts +1 -1
  34. package/model/filter/predicate/Predicate.mjs +3 -3
  35. package/model/security/Enable2faRequest.d.mts +20 -1
  36. package/model/security/Enable2faRequest.mjs +23 -1
  37. package/package.json +1 -1
package/model/Group.d.mts CHANGED
@@ -26,7 +26,7 @@ export declare class Group implements StoredDocument, HasTags {
26
26
  rev: string | undefined;
27
27
  /**
28
28
  *
29
- * Hard delete (unix epoch in ms) timestamp of the object.
29
+ * Soft delete (unix epoch in ms) timestamp of the object.
30
30
  */
31
31
  deletionDate: number | undefined;
32
32
  /**
package/model/Group.mjs CHANGED
@@ -24,7 +24,7 @@ export class Group {
24
24
  this.rev = undefined;
25
25
  /**
26
26
  *
27
- * Hard delete (unix epoch in ms) timestamp of the object.
27
+ * Soft delete (unix epoch in ms) timestamp of the object.
28
28
  */
29
29
  this.deletionDate = undefined;
30
30
  /**
@@ -14,7 +14,7 @@ import { DecryptedFinancialInstitutionInformation, EncryptedFinancialInstitution
14
14
  import { Gender } from './embed/Gender.mjs';
15
15
  import { DecryptedInsurability, EncryptedInsurability, Insurability } from './embed/Insurability.mjs';
16
16
  import { DecryptedMedicalHouseContract, EncryptedMedicalHouseContract, MedicalHouseContract } from './embed/MedicalHouseContract.mjs';
17
- import { Partnership } from './embed/Partnership.mjs';
17
+ import { DecryptedPartnership, EncryptedPartnership, Partnership } from './embed/Partnership.mjs';
18
18
  import { DecryptedPatientHealthCareParty, EncryptedPatientHealthCareParty, PatientHealthCareParty } from './embed/PatientHealthCareParty.mjs';
19
19
  import { PersonName } from './embed/PersonName.mjs';
20
20
  import { PersonalStatus } from './embed/PersonalStatus.mjs';
@@ -461,7 +461,7 @@ export declare class DecryptedPatient {
461
461
  *
462
462
  * List of partners, or persons of contact.
463
463
  */
464
- partnerships: Array<Partnership>;
464
+ partnerships: Array<DecryptedPartnership>;
465
465
  /**
466
466
  *
467
467
  * Links between this patient and healthcare parties.
@@ -829,7 +829,7 @@ export declare class EncryptedPatient {
829
829
  *
830
830
  * List of partners, or persons of contact.
831
831
  */
832
- partnerships: Array<Partnership>;
832
+ partnerships: Array<EncryptedPartnership>;
833
833
  /**
834
834
  *
835
835
  * Links between this patient and healthcare parties.
package/model/Patient.mjs CHANGED
@@ -11,7 +11,7 @@ import { DecryptedFinancialInstitutionInformation, EncryptedFinancialInstitution
11
11
  import { Gender } from './embed/Gender.mjs';
12
12
  import { DecryptedInsurability, EncryptedInsurability } from './embed/Insurability.mjs';
13
13
  import { DecryptedMedicalHouseContract, EncryptedMedicalHouseContract } from './embed/MedicalHouseContract.mjs';
14
- import { Partnership } from './embed/Partnership.mjs';
14
+ import { DecryptedPartnership, EncryptedPartnership } from './embed/Partnership.mjs';
15
15
  import { DecryptedPatientHealthCareParty, EncryptedPatientHealthCareParty } from './embed/PatientHealthCareParty.mjs';
16
16
  import { PersonName } from './embed/PersonName.mjs';
17
17
  import { PersonalStatus } from './embed/PersonalStatus.mjs';
@@ -652,7 +652,7 @@ export class DecryptedPatient {
652
652
  race: expectString(extractEntry(jCpy, 'race', false, path), true, [...path, ".race"]),
653
653
  ethnicity: expectString(extractEntry(jCpy, 'ethnicity', false, path), true, [...path, ".ethnicity"]),
654
654
  insurabilities: expectArray(extractEntry(jCpy, 'insurabilities', false, path), false, [...path, ".insurabilities"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, DecryptedInsurability.fromJSON)),
655
- partnerships: expectArray(extractEntry(jCpy, 'partnerships', false, path), false, [...path, ".partnerships"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, Partnership.fromJSON)),
655
+ partnerships: expectArray(extractEntry(jCpy, 'partnerships', false, path), false, [...path, ".partnerships"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, DecryptedPartnership.fromJSON)),
656
656
  patientHealthCareParties: expectArray(extractEntry(jCpy, 'patientHealthCareParties', false, path), false, [...path, ".patientHealthCareParties"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, DecryptedPatientHealthCareParty.fromJSON)),
657
657
  financialInstitutionInformation: expectArray(extractEntry(jCpy, 'financialInstitutionInformation', false, path), false, [...path, ".financialInstitutionInformation"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, DecryptedFinancialInstitutionInformation.fromJSON)),
658
658
  medicalHouseContracts: expectArray(extractEntry(jCpy, 'medicalHouseContracts', false, path), false, [...path, ".medicalHouseContracts"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, DecryptedMedicalHouseContract.fromJSON)),
@@ -1318,7 +1318,7 @@ export class EncryptedPatient {
1318
1318
  race: expectString(extractEntry(jCpy, 'race', false, path), true, [...path, ".race"]),
1319
1319
  ethnicity: expectString(extractEntry(jCpy, 'ethnicity', false, path), true, [...path, ".ethnicity"]),
1320
1320
  insurabilities: expectArray(extractEntry(jCpy, 'insurabilities', false, path), false, [...path, ".insurabilities"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, EncryptedInsurability.fromJSON)),
1321
- partnerships: expectArray(extractEntry(jCpy, 'partnerships', false, path), false, [...path, ".partnerships"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, Partnership.fromJSON)),
1321
+ partnerships: expectArray(extractEntry(jCpy, 'partnerships', false, path), false, [...path, ".partnerships"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, EncryptedPartnership.fromJSON)),
1322
1322
  patientHealthCareParties: expectArray(extractEntry(jCpy, 'patientHealthCareParties', false, path), false, [...path, ".patientHealthCareParties"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, EncryptedPatientHealthCareParty.fromJSON)),
1323
1323
  financialInstitutionInformation: expectArray(extractEntry(jCpy, 'financialInstitutionInformation', false, path), false, [...path, ".financialInstitutionInformation"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, EncryptedFinancialInstitutionInformation.fromJSON)),
1324
1324
  medicalHouseContracts: expectArray(extractEntry(jCpy, 'medicalHouseContracts', false, path), false, [...path, ".medicalHouseContracts"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, EncryptedMedicalHouseContract.fromJSON)),
package/model/Role.d.mts CHANGED
@@ -1,16 +1,16 @@
1
1
  import { StoredDocument } from './base/StoredDocument.mjs';
2
2
  /**
3
3
  *
4
- * The RoleDto class represents a role in the system, which can have permissions and can be
4
+ *
5
+ * The RoleDto class represents a role in the system, which can have permissions and can be
5
6
  * inheritable up to a certain level by users in child Groups.$
6
- * down the group hierarchy this role can be inherited by users in child groups. A value of 0 means
7
+ * down the group hierarchy this role can be inherited by users in child groups. A value of 0 means
7
8
  * it cannot be inherited, while a value of -1 means it can be inherited indefinitely.
8
- * /
9
9
  */
10
10
  export declare class Role implements StoredDocument {
11
11
  /**
12
12
  *
13
- * The unique identifier of the role.
13
+ * The unique identifier of the role. It is automatically set to <GROUP_ID>:<ROLE_NAME>
14
14
  */
15
15
  id: string;
16
16
  /**
@@ -25,12 +25,22 @@ export declare class Role implements StoredDocument {
25
25
  deletionDate: number | undefined;
26
26
  /**
27
27
  *
28
- * The name of the role.
28
+ * The name of the role. It can only contain uppercase letters, numbers, and underscores for a max
29
+ * length of 40 characters.
29
30
  */
30
31
  name: string | undefined;
31
32
  /**
32
33
  *
33
- * The maximum level of inheritance for this role, indicating how far
34
+ * A short description for the role. It cannot exceed 300 characters.
35
+ */
36
+ description: string | undefined;
37
+ /**
38
+ *
39
+ *
40
+ * Represents the levels in the descendant groups hierarchy where this role can be used. Eg:
41
+ * - null: all the users in the descendants of the group can use this role.
42
+ * - 0: only the users in the group can use this role.
43
+ * - 1: only the users in the group and in its children groups can use this role.
34
44
  */
35
45
  inheritableUpTo: number | undefined;
36
46
  /**
package/model/Role.mjs CHANGED
@@ -3,11 +3,11 @@ import { expectArray, expectNumber, expectString, extractEntry } from '../intern
3
3
  import { randomUuid } from '../utils/Id.mjs';
4
4
  /**
5
5
  *
6
- * The RoleDto class represents a role in the system, which can have permissions and can be
6
+ *
7
+ * The RoleDto class represents a role in the system, which can have permissions and can be
7
8
  * inheritable up to a certain level by users in child Groups.$
8
- * down the group hierarchy this role can be inherited by users in child groups. A value of 0 means
9
+ * down the group hierarchy this role can be inherited by users in child groups. A value of 0 means
9
10
  * it cannot be inherited, while a value of -1 means it can be inherited indefinitely.
10
- * /
11
11
  */
12
12
  export class Role {
13
13
  constructor(partial) {
@@ -24,12 +24,22 @@ export class Role {
24
24
  this.deletionDate = undefined;
25
25
  /**
26
26
  *
27
- * The name of the role.
27
+ * The name of the role. It can only contain uppercase letters, numbers, and underscores for a max
28
+ * length of 40 characters.
28
29
  */
29
30
  this.name = undefined;
30
31
  /**
31
32
  *
32
- * The maximum level of inheritance for this role, indicating how far
33
+ * A short description for the role. It cannot exceed 300 characters.
34
+ */
35
+ this.description = undefined;
36
+ /**
37
+ *
38
+ *
39
+ * Represents the levels in the descendant groups hierarchy where this role can be used. Eg:
40
+ * - null: all the users in the descendants of the group can use this role.
41
+ * - 0: only the users in the group can use this role.
42
+ * - 1: only the users in the group and in its children groups can use this role.
33
43
  */
34
44
  this.inheritableUpTo = undefined;
35
45
  /**
@@ -45,6 +55,8 @@ export class Role {
45
55
  this.deletionDate = partial.deletionDate;
46
56
  if ('name' in partial)
47
57
  this.name = partial.name;
58
+ if ('description' in partial)
59
+ this.description = partial.description;
48
60
  if ('inheritableUpTo' in partial)
49
61
  this.inheritableUpTo = partial.inheritableUpTo;
50
62
  if ('permissions' in partial && partial.permissions !== undefined)
@@ -59,6 +71,8 @@ export class Role {
59
71
  res['deletionDate'] = this.deletionDate;
60
72
  if (this.name != undefined)
61
73
  res['name'] = this.name;
74
+ if (this.description != undefined)
75
+ res['description'] = this.description;
62
76
  if (this.inheritableUpTo != undefined)
63
77
  res['inheritableUpTo'] = this.inheritableUpTo;
64
78
  res['permissions'] = this.permissions.map((x0) => x0);
@@ -73,6 +87,7 @@ export class Role {
73
87
  rev: expectString(extractEntry(jCpy, 'rev', false, path), true, [...path, ".rev"]),
74
88
  deletionDate: expectNumber(extractEntry(jCpy, 'deletionDate', false, path), true, true, [...path, ".deletionDate"]),
75
89
  name: expectString(extractEntry(jCpy, 'name', false, path), true, [...path, ".name"]),
90
+ description: expectString(extractEntry(jCpy, 'description', false, path), true, [...path, ".description"]),
76
91
  inheritableUpTo: expectNumber(extractEntry(jCpy, 'inheritableUpTo', false, path), true, true, [...path, ".inheritableUpTo"]),
77
92
  permissions: expectArray(extractEntry(jCpy, 'permissions', false, path), false, [...path, ".permissions"], (x0, p0) => expectString(x0, false, p0)),
78
93
  });
package/model/User.d.mts CHANGED
@@ -141,6 +141,12 @@ export declare namespace User {
141
141
  loginIdentifiers: Array<LoginIdentifier>;
142
142
  verifiedEmail: boolean | undefined;
143
143
  verifiedMobilePhone: boolean | undefined;
144
+ /**
145
+ *
146
+ *
147
+ * True if the user has 2fa enabled for login with password
148
+ */
149
+ uses2fa: boolean | undefined;
144
150
  constructor(partial: Partial<SystemMetadata> & Pick<SystemMetadata, "roles" | "isAdmin" | "inheritsRoles">);
145
151
  toJSON(): object;
146
152
  static fromJSON(json: any, ignoreUnknownKeys?: boolean, path?: Array<string>): SystemMetadata;
package/model/User.mjs CHANGED
@@ -251,6 +251,12 @@ export class User {
251
251
  this.loginIdentifiers = [];
252
252
  this.verifiedEmail = undefined;
253
253
  this.verifiedMobilePhone = undefined;
254
+ /**
255
+ *
256
+ *
257
+ * True if the user has 2fa enabled for login with password
258
+ */
259
+ this.uses2fa = undefined;
254
260
  this.roles = partial.roles;
255
261
  this.isAdmin = partial.isAdmin;
256
262
  this.inheritsRoles = partial.inheritsRoles;
@@ -260,6 +266,8 @@ export class User {
260
266
  this.verifiedEmail = partial.verifiedEmail;
261
267
  if ('verifiedMobilePhone' in partial)
262
268
  this.verifiedMobilePhone = partial.verifiedMobilePhone;
269
+ if ('uses2fa' in partial)
270
+ this.uses2fa = partial.uses2fa;
263
271
  }
264
272
  toJSON() {
265
273
  const res = {};
@@ -271,6 +279,8 @@ export class User {
271
279
  res['verifiedEmail'] = this.verifiedEmail;
272
280
  if (this.verifiedMobilePhone != undefined)
273
281
  res['verifiedMobilePhone'] = this.verifiedMobilePhone;
282
+ if (this.uses2fa != undefined)
283
+ res['uses2fa'] = this.uses2fa;
274
284
  return res;
275
285
  }
276
286
  static fromJSON(json, ignoreUnknownKeys = false, path = ['SystemMetadata']) {
@@ -284,6 +294,7 @@ export class User {
284
294
  loginIdentifiers: expectArray(extractEntry(jCpy, 'loginIdentifiers', false, path), false, [...path, ".loginIdentifiers"], (x0, p0) => expectObject(x0, false, ignoreUnknownKeys, p0, LoginIdentifier.fromJSON)),
285
295
  verifiedEmail: expectBoolean(extractEntry(jCpy, 'verifiedEmail', false, path), true, [...path, ".verifiedEmail"]),
286
296
  verifiedMobilePhone: expectBoolean(extractEntry(jCpy, 'verifiedMobilePhone', false, path), true, [...path, ".verifiedMobilePhone"]),
297
+ uses2fa: expectBoolean(extractEntry(jCpy, 'uses2fa', false, path), true, [...path, ".uses2fa"]),
287
298
  });
288
299
  if (!ignoreUnknownKeys) {
289
300
  const unused = Object.keys(jCpy);
@@ -8,10 +8,10 @@ export var CryptoActor;
8
8
  function fromJSON(json, ignoreUnknownKeys = false, path = ['CryptoActor']) {
9
9
  switch (json.$ktClass) {
10
10
  case 'com.icure.cardinal.sdk.model.Device': return Device.fromJSON(json, ignoreUnknownKeys);
11
- case 'com.icure.cardinal.sdk.model.DecryptedPatient': return DecryptedPatient.fromJSON(json, ignoreUnknownKeys);
12
- case 'com.icure.cardinal.sdk.model.EncryptedPatient': return EncryptedPatient.fromJSON(json, ignoreUnknownKeys);
13
- case 'com.icure.cardinal.sdk.model.HealthcareParty': return HealthcareParty.fromJSON(json, ignoreUnknownKeys);
14
11
  case 'com.icure.cardinal.sdk.model.CryptoActorStub': return CryptoActorStub.fromJSON(json, ignoreUnknownKeys);
12
+ case 'com.icure.cardinal.sdk.model.HealthcareParty': return HealthcareParty.fromJSON(json, ignoreUnknownKeys);
13
+ case 'com.icure.cardinal.sdk.model.EncryptedPatient': return EncryptedPatient.fromJSON(json, ignoreUnknownKeys);
14
+ case 'com.icure.cardinal.sdk.model.DecryptedPatient': return DecryptedPatient.fromJSON(json, ignoreUnknownKeys);
15
15
  default: throw new Error('Unexpected discriminator for CryptoActor: ' + json.$ktClass);
16
16
  }
17
17
  }
@@ -1,3 +1,5 @@
1
+ import { Base64String } from '../specializations/Base64String.mjs';
2
+ import { Encryptable } from './Encryptable.mjs';
1
3
  import { PartnershipStatus } from './PartnershipStatus.mjs';
2
4
  import { PartnershipType } from './PartnershipType.mjs';
3
5
  /**
@@ -6,7 +8,7 @@ import { PartnershipType } from './PartnershipType.mjs';
6
8
  * patient).
7
9
  * /
8
10
  */
9
- export declare class Partnership {
11
+ export interface Partnership extends Encryptable {
10
12
  /**
11
13
  *
12
14
  * The type of relationship (from CD-CONTACT-PERSON codes).
@@ -22,7 +24,62 @@ export declare class Partnership {
22
24
  * The UUID of the contact person or patient in this relationship.
23
25
  */
24
26
  partnerId: string | undefined;
25
- constructor(partial: Partial<Partnership>);
27
+ readonly isEncrypted: boolean;
26
28
  toJSON(): object;
27
- static fromJSON(json: any, ignoreUnknownKeys?: boolean, path?: Array<string>): Partnership;
29
+ }
30
+ /**
31
+ *
32
+ * Represents a relationship between a patient and another person (contact person or another
33
+ * patient).
34
+ * /
35
+ */
36
+ export declare class DecryptedPartnership {
37
+ /**
38
+ *
39
+ * The type of relationship (from CD-CONTACT-PERSON codes).
40
+ */
41
+ type: PartnershipType | undefined;
42
+ /**
43
+ *
44
+ * The status of the relationship.
45
+ */
46
+ status: PartnershipStatus | undefined;
47
+ /**
48
+ *
49
+ * The UUID of the contact person or patient in this relationship.
50
+ */
51
+ partnerId: string | undefined;
52
+ encryptedSelf: Base64String | undefined;
53
+ readonly isEncrypted: false;
54
+ constructor(partial: Partial<DecryptedPartnership>);
55
+ toJSON(): object;
56
+ static fromJSON(json: any, ignoreUnknownKeys?: boolean, path?: Array<string>): DecryptedPartnership;
57
+ }
58
+ /**
59
+ *
60
+ * Represents a relationship between a patient and another person (contact person or another
61
+ * patient).
62
+ * /
63
+ */
64
+ export declare class EncryptedPartnership {
65
+ /**
66
+ *
67
+ * The type of relationship (from CD-CONTACT-PERSON codes).
68
+ */
69
+ type: PartnershipType | undefined;
70
+ /**
71
+ *
72
+ * The status of the relationship.
73
+ */
74
+ status: PartnershipStatus | undefined;
75
+ /**
76
+ *
77
+ * The UUID of the contact person or patient in this relationship.
78
+ */
79
+ partnerId: string | undefined;
80
+ encryptedSelf: Base64String | undefined;
81
+ readonly isEncrypted: true;
82
+ constructor(partial: Partial<EncryptedPartnership>);
83
+ toJSON(): object;
84
+ static fromJSON(json: any, ignoreUnknownKeys?: boolean, path?: Array<string>): EncryptedPartnership;
28
85
  }
@@ -8,7 +8,7 @@ import { PartnershipType } from './PartnershipType.mjs';
8
8
  * patient).
9
9
  * /
10
10
  */
11
- export class Partnership {
11
+ export class DecryptedPartnership {
12
12
  constructor(partial) {
13
13
  /**
14
14
  *
@@ -25,12 +25,18 @@ export class Partnership {
25
25
  * The UUID of the contact person or patient in this relationship.
26
26
  */
27
27
  this.partnerId = undefined;
28
+ this.encryptedSelf = undefined;
29
+ this.isEncrypted = false;
30
+ if (partial.isEncrypted !== undefined && partial.isEncrypted !== false)
31
+ throw new Error('partial.isEncrypted must be undefined or false');
28
32
  if ('type' in partial)
29
33
  this.type = partial.type;
30
34
  if ('status' in partial)
31
35
  this.status = partial.status;
32
36
  if ('partnerId' in partial)
33
37
  this.partnerId = partial.partnerId;
38
+ if ('encryptedSelf' in partial)
39
+ this.encryptedSelf = partial.encryptedSelf;
34
40
  }
35
41
  toJSON() {
36
42
  const res = {};
@@ -40,21 +46,96 @@ export class Partnership {
40
46
  res['status'] = this.status;
41
47
  if (this.partnerId != undefined)
42
48
  res['partnerId'] = this.partnerId;
49
+ if (this.encryptedSelf != undefined)
50
+ res['encryptedSelf'] = this.encryptedSelf;
51
+ res['isEncrypted'] = false;
43
52
  return res;
44
53
  }
45
- static fromJSON(json, ignoreUnknownKeys = false, path = ['Partnership']) {
54
+ static fromJSON(json, ignoreUnknownKeys = false, path = ['DecryptedPartnership']) {
46
55
  if (typeof json != 'object')
47
56
  throw new Error(`Expected json object at path ${path.join("")}`);
48
57
  const jCpy = Object.assign({}, json);
49
- const res = new Partnership({
58
+ if (extractEntry(jCpy, "isEncrypted", true, path) !== false)
59
+ throw new Error(`Unexpected value for ${path.join("")} isEncrypted marker, should be false. The provided json doesn't represent a DecryptedPartnership`);
60
+ const res = new DecryptedPartnership({
50
61
  type: expectStringEnum(extractEntry(jCpy, 'type', false, path), true, [...path, ".type"], PartnershipType, 'PartnershipType'),
51
62
  status: expectStringEnum(extractEntry(jCpy, 'status', false, path), true, [...path, ".status"], PartnershipStatus, 'PartnershipStatus'),
52
63
  partnerId: expectString(extractEntry(jCpy, 'partnerId', false, path), true, [...path, ".partnerId"]),
64
+ encryptedSelf: expectString(extractEntry(jCpy, 'encryptedSelf', false, path), true, [...path, ".encryptedSelf"]),
53
65
  });
54
66
  if (!ignoreUnknownKeys) {
55
67
  const unused = Object.keys(jCpy);
56
68
  if (unused.length > 0)
57
- throw new Error(`Unexpected key(s) for json object Partnership at path ${path.join("")}: ${unused}`);
69
+ throw new Error(`Unexpected key(s) for json object DecryptedPartnership at path ${path.join("")}: ${unused}`);
70
+ }
71
+ return res;
72
+ }
73
+ }
74
+ /**
75
+ *
76
+ * Represents a relationship between a patient and another person (contact person or another
77
+ * patient).
78
+ * /
79
+ */
80
+ export class EncryptedPartnership {
81
+ constructor(partial) {
82
+ /**
83
+ *
84
+ * The type of relationship (from CD-CONTACT-PERSON codes).
85
+ */
86
+ this.type = undefined;
87
+ /**
88
+ *
89
+ * The status of the relationship.
90
+ */
91
+ this.status = undefined;
92
+ /**
93
+ *
94
+ * The UUID of the contact person or patient in this relationship.
95
+ */
96
+ this.partnerId = undefined;
97
+ this.encryptedSelf = undefined;
98
+ this.isEncrypted = true;
99
+ if (partial.isEncrypted !== undefined && partial.isEncrypted !== true)
100
+ throw new Error('partial.isEncrypted must be undefined or true');
101
+ if ('type' in partial)
102
+ this.type = partial.type;
103
+ if ('status' in partial)
104
+ this.status = partial.status;
105
+ if ('partnerId' in partial)
106
+ this.partnerId = partial.partnerId;
107
+ if ('encryptedSelf' in partial)
108
+ this.encryptedSelf = partial.encryptedSelf;
109
+ }
110
+ toJSON() {
111
+ const res = {};
112
+ if (this.type != undefined)
113
+ res['type'] = this.type;
114
+ if (this.status != undefined)
115
+ res['status'] = this.status;
116
+ if (this.partnerId != undefined)
117
+ res['partnerId'] = this.partnerId;
118
+ if (this.encryptedSelf != undefined)
119
+ res['encryptedSelf'] = this.encryptedSelf;
120
+ res['isEncrypted'] = true;
121
+ return res;
122
+ }
123
+ static fromJSON(json, ignoreUnknownKeys = false, path = ['EncryptedPartnership']) {
124
+ if (typeof json != 'object')
125
+ throw new Error(`Expected json object at path ${path.join("")}`);
126
+ const jCpy = Object.assign({}, json);
127
+ if (extractEntry(jCpy, "isEncrypted", true, path) !== true)
128
+ throw new Error(`Unexpected value for ${path.join("")} isEncrypted marker, should be true. The provided json doesn't represent a EncryptedPartnership`);
129
+ const res = new EncryptedPartnership({
130
+ type: expectStringEnum(extractEntry(jCpy, 'type', false, path), true, [...path, ".type"], PartnershipType, 'PartnershipType'),
131
+ status: expectStringEnum(extractEntry(jCpy, 'status', false, path), true, [...path, ".status"], PartnershipStatus, 'PartnershipStatus'),
132
+ partnerId: expectString(extractEntry(jCpy, 'partnerId', false, path), true, [...path, ".partnerId"]),
133
+ encryptedSelf: expectString(extractEntry(jCpy, 'encryptedSelf', false, path), true, [...path, ".encryptedSelf"]),
134
+ });
135
+ if (!ignoreUnknownKeys) {
136
+ const unused = Object.keys(jCpy);
137
+ if (unused.length > 0)
138
+ throw new Error(`Unexpected key(s) for json object EncryptedPartnership at path ${path.join("")}: ${unused}`);
58
139
  }
59
140
  return res;
60
141
  }