@nmshd/runtime 1.2.11 → 1.2.15

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.
@@ -3,9 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MessageStatus = void 0;
4
4
  var MessageStatus;
5
5
  (function (MessageStatus) {
6
- MessageStatus["Received"] = "received";
7
- MessageStatus["Delivering"] = "delivering";
8
- MessageStatus["Delivered"] = "delivered";
9
- MessageStatus["Errorneous"] = "errorneous";
6
+ /**
7
+ * Message was received
8
+ */
9
+ MessageStatus["Received"] = "Received";
10
+ /**
11
+ * Message was sent but is not yet received by every recipient
12
+ */
13
+ MessageStatus["Delivering"] = "Delivering";
14
+ /**
15
+ * Message was sent and was received by every recipient
16
+ */
17
+ MessageStatus["Delivered"] = "Delivered";
10
18
  })(MessageStatus = exports.MessageStatus || (exports.MessageStatus = {}));
11
19
  //# sourceMappingURL=MessageDVO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessageDVO.js","sourceRoot":"","sources":["../../../src/dataViews/transport/MessageDVO.ts"],"names":[],"mappings":";;;AAIA,IAAY,aAKX;AALD,WAAY,aAAa;IACrB,sCAAqB,CAAA;IACrB,0CAAyB,CAAA;IACzB,wCAAuB,CAAA;IACvB,0CAAyB,CAAA;AAC7B,CAAC,EALW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAKxB"}
1
+ {"version":3,"file":"MessageDVO.js","sourceRoot":"","sources":["../../../src/dataViews/transport/MessageDVO.ts"],"names":[],"mappings":";;;AAIA,IAAY,aAaX;AAbD,WAAY,aAAa;IACrB;;OAEG;IACH,sCAAqB,CAAA;IACrB;;OAEG;IACH,0CAAyB,CAAA;IACzB;;OAEG;IACH,wCAAuB,CAAA;AAC3B,CAAC,EAbW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAaxB"}
@@ -1,9 +1,18 @@
1
+ import { RelationshipChangeStatus, RelationshipChangeType } from "@nmshd/transport";
1
2
  import { DataViewObject } from "../DataViewObject";
3
+ export declare enum RelationshipDirection {
4
+ Outgoing = "Outgoing",
5
+ Incoming = "Incoming"
6
+ }
2
7
  export interface RelationshipDVO extends DataViewObject {
3
8
  type: "RelationshipDVO";
4
9
  status: string;
10
+ direction: string;
11
+ statusText: string;
5
12
  isPinned: boolean;
6
13
  theme: RelationshipTheme;
14
+ changes: RelationshipChangeDVO[];
15
+ changeCount: number;
7
16
  }
8
17
  export interface RelationshipTheme {
9
18
  image?: string;
@@ -11,3 +20,27 @@ export interface RelationshipTheme {
11
20
  backgroundColor?: string;
12
21
  foregroundColor?: string;
13
22
  }
23
+ export interface RelationshipChangeDVO extends DataViewObject {
24
+ type: "RelationshipChangeDVO";
25
+ request: RelationshipChangeRequestDVO;
26
+ response?: RelationshipChangeResponseDVO;
27
+ status: RelationshipChangeStatus;
28
+ statusText: string;
29
+ changeType: RelationshipChangeType;
30
+ changeTypeText: string;
31
+ isOwn: boolean;
32
+ }
33
+ export interface RelationshipChangeRequestDVO extends DataViewObject {
34
+ type: "RelationshipChangeRequestDVO";
35
+ createdBy: string;
36
+ createdByDevice: string;
37
+ createdAt: string;
38
+ content?: any;
39
+ }
40
+ export interface RelationshipChangeResponseDVO extends DataViewObject {
41
+ type: "RelationshipChangeResponseDVO";
42
+ createdBy: string;
43
+ createdByDevice: string;
44
+ createdAt: string;
45
+ content?: any;
46
+ }
@@ -1,3 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RelationshipDirection = void 0;
4
+ var RelationshipDirection;
5
+ (function (RelationshipDirection) {
6
+ RelationshipDirection["Outgoing"] = "Outgoing";
7
+ RelationshipDirection["Incoming"] = "Incoming";
8
+ })(RelationshipDirection = exports.RelationshipDirection || (exports.RelationshipDirection = {}));
3
9
  //# sourceMappingURL=RelationshipDVO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipDVO.js","sourceRoot":"","sources":["../../../src/dataViews/transport/RelationshipDVO.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"RelationshipDVO.js","sourceRoot":"","sources":["../../../src/dataViews/transport/RelationshipDVO.ts"],"names":[],"mappings":";;;AAGA,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC7B,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;AACzB,CAAC,EAHW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAGhC"}
@@ -15,7 +15,7 @@ class RelationshipTemplateMapper {
15
15
  createdBy: template.cache.createdBy.toString(),
16
16
  createdByDevice: template.cache.createdByDevice.toString(),
17
17
  createdAt: template.cache.createdAt.toString(),
18
- content: template.cache.content,
18
+ content: template.cache.content.toJSON(),
19
19
  expiresAt: (_a = template.cache.expiresAt) === null || _a === void 0 ? void 0 : _a.toString(),
20
20
  maxNumberOfRelationships: template.cache.maxNumberOfRelationships
21
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipTemplateMapper.js","sourceRoot":"","sources":["../../../../src/useCases/transport/relationshipTemplates/RelationshipTemplateMapper.ts"],"names":[],"mappings":";;;AAAA,gDAAwD;AAExD,yCAA6C;AAE7C,MAAa,0BAA0B;IAC5B,MAAM,CAAC,yBAAyB,CAAC,QAA8B;;QAClE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;YACjB,MAAM,sBAAa,CAAC,OAAO,CAAC,UAAU,CAAC,gCAAoB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;SACxF;QAED,OAAO;YACH,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE;YAC1B,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE;YAC9C,eAAe,EAAE,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAE;YAC1D,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,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EAAE;YAC/C,wBAAwB,EAAE,QAAQ,CAAC,KAAK,CAAC,wBAAwB;SACpE,CAAC;IACN,CAAC;IAEM,MAAM,CAAC,6BAA6B,CAAC,aAAqC;QAC7E,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;CACJ;AArBD,gEAqBC"}
@@ -29,19 +29,21 @@ class RelationshipMapper {
29
29
  return relationships.map((r) => this.toRelationshipDTO(r));
30
30
  }
31
31
  static toRelationshipChangeRequestDTO(change) {
32
+ var _a;
32
33
  return {
33
34
  createdBy: change.createdBy.toString(),
34
35
  createdByDevice: change.createdByDevice.toString(),
35
36
  createdAt: change.createdAt.toString(),
36
- content: change.content
37
+ content: (_a = change.content) === null || _a === void 0 ? void 0 : _a.toJSON()
37
38
  };
38
39
  }
39
40
  static toRelationshipChangeResponseDTO(change) {
41
+ var _a;
40
42
  return {
41
43
  createdBy: change.createdBy.toString(),
42
44
  createdByDevice: change.createdByDevice.toString(),
43
45
  createdAt: change.createdAt.toString(),
44
- content: change.content
46
+ content: (_a = change.content) === null || _a === void 0 ? void 0 : _a.toJSON()
45
47
  };
46
48
  }
47
49
  static toRelationshipChangeDTO(change) {
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipMapper.js","sourceRoot":"","sources":["../../../../src/useCases/transport/relationships/RelationshipMapper.ts"],"names":[],"mappings":";;;AAAA,gDAA2H;AAE3H,yCAA6C;AAC7C,oGAAiG;AAEjG,MAAa,kBAAkB;IACpB,MAAM,CAAC,iBAAiB,CAAC,YAA0B;;QACtD,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE;YACrB,MAAM,sBAAa,CAAC,OAAO,CAAC,UAAU,CAAC,wBAAY,EAAE,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;SACpF;QAED,OAAO;YACH,EAAE,EAAE,YAAY,CAAC,EAAE,CA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AClD,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE;YACtC,OAAO,EAAE,MAAA,MAAM,CAAC,OAAO,0CAAE,MAAM,EAAE;SACpC,CAAC;IACN,CAAC;IAEO,MAAM,CAAC,uBAAuB,CAAC,MAA0B;QAC7D,OAAO;YACH,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI,CAAC,8BAA8B,CAAC,MAAM,CAAC,OAAO,CAAC;YAC5D,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,+BAA+B,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;SAChG,CAAC;IACN,CAAC;CACJ;AArDD,gDAqDC"}
@@ -327,11 +327,11 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
327
327
  const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
328
328
  const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
329
329
  exports.buildInformation = {
330
- version: "1.2.11",
331
- build: "26",
332
- date: "2022-01-04T10:02:05+00:00",
333
- commit: "983cadd9b210c4fc12b1184cfa7b316e767c8d37",
334
- dependencies: {"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"1.0.2","@js-soft/ts-utils":"^1.1.1","@nmshd/consumption":"1.0.11","@nmshd/content":"1.1.2","@nmshd/crypto":"1.0.6","@nmshd/transport":"1.1.5","ajv":"^8.8.2","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","fluent-ts-validator":"3.0.2","json-stringify-safe":"^5.0.1","luxon":"^2.3.0","qrcode":"1.5.0","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
330
+ version: "1.2.15",
331
+ build: "30",
332
+ date: "2022-01-21T09:17:46+00:00",
333
+ commit: "d1521387289a090e451cd4171b2d5cbfa9c37176",
334
+ dependencies: {"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"1.0.2","@js-soft/ts-utils":"^1.1.1","@nmshd/consumption":"1.0.12","@nmshd/content":"1.1.3","@nmshd/crypto":"1.0.7","@nmshd/transport":"1.1.6","ajv":"^8.9.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","fluent-ts-validator":"3.0.2","json-stringify-safe":"^5.0.1","luxon":"^2.3.0","qrcode":"1.5.0","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
335
335
  libraries: {
336
336
  serval: ts_serval_1.buildInformation,
337
337
  consumption: consumption_1.buildInformation,
@@ -373,6 +373,7 @@ const ConsumptionServices_1 = __webpack_require__(/*! ../extensibility/Consumpti
373
373
  const useCases_1 = __webpack_require__(/*! ../useCases */ "./dist/useCases/index.js");
374
374
  const DataViewTranslateable_1 = __webpack_require__(/*! ./DataViewTranslateable */ "./dist/dataViews/DataViewTranslateable.js");
375
375
  const MessageDVO_1 = __webpack_require__(/*! ./transport/MessageDVO */ "./dist/dataViews/transport/MessageDVO.js");
376
+ const RelationshipDVO_1 = __webpack_require__(/*! ./transport/RelationshipDVO */ "./dist/dataViews/transport/RelationshipDVO.js");
376
377
  let DataViewExpander = class DataViewExpander {
377
378
  constructor(transport, consumption, identityController) {
378
379
  this.transport = transport;
@@ -461,6 +462,8 @@ let DataViewExpander = class DataViewExpander {
461
462
  }
462
463
  async expandMessageDTO(message) {
463
464
  const recipientRelationships = await this.expandRecipients(message.recipients);
465
+ const addressMap = {};
466
+ recipientRelationships.forEach((value) => (addressMap[value.id] = value));
464
467
  const createdByRelationship = await this.expandAddress(message.createdBy);
465
468
  const fileIds = [];
466
469
  const filePromises = [];
@@ -476,13 +479,19 @@ let DataViewExpander = class DataViewExpander {
476
479
  }
477
480
  const files = await Promise.all(filePromises);
478
481
  const isOwn = this.identityController.isMe(transport_1.CoreAddress.from(message.createdBy));
482
+ let peer;
479
483
  let status = MessageDVO_1.MessageStatus.Received;
480
484
  if (isOwn) {
481
485
  const receivedByEveryone = message.recipients.every((r) => !!r.receivedAt);
482
486
  status = receivedByEveryone ? MessageDVO_1.MessageStatus.Delivered : MessageDVO_1.MessageStatus.Delivering;
487
+ // Overwrite the RecipientDVO to be a IdentityDVO for this special case
488
+ peer = { ...recipientRelationships[0], type: "IdentityDVO" };
489
+ }
490
+ else {
491
+ peer = createdByRelationship;
483
492
  }
484
493
  const name = DataViewTranslateable_1.DataViewTranslateable.transport.messageName;
485
- const value = {
494
+ const messageDVO = {
486
495
  id: message.id,
487
496
  name: name,
488
497
  date: message.createdAt,
@@ -496,38 +505,42 @@ let DataViewExpander = class DataViewExpander {
496
505
  recipientCount: message.recipients.length,
497
506
  attachmentCount: message.attachments.length,
498
507
  status,
499
- image: ""
508
+ statusText: `i18n://dvo.message.${status}`,
509
+ image: "",
510
+ peer: peer
500
511
  };
501
512
  if (message.content["@type"] === "Mail" || message.content["@type"] === "RequestMail") {
502
- value.name = DataViewTranslateable_1.DataViewTranslateable.consumption.mails.mailSubjectFallback;
503
- value.type = "MailDVO";
504
513
  const mailContent = message.content;
505
- if (mailContent.subject) {
506
- value.name = mailContent.subject;
507
- }
508
- value.to = await this.expandAddresses(mailContent.to);
509
- value.toCount = mailContent.to.length;
510
- value.ccCount = 0;
514
+ const to = mailContent.to.map((value) => addressMap[value]);
515
+ let cc = [];
511
516
  if (mailContent.cc) {
512
- value.cc = await this.expandAddresses(mailContent.cc);
513
- value.ccCount = mailContent.cc.length;
517
+ cc = mailContent.cc.map((value) => addressMap[value]);
514
518
  }
515
- value.subject = mailContent.subject;
516
- value.body = mailContent.body;
519
+ const mailDVO = {
520
+ ...messageDVO,
521
+ type: "MailDVO",
522
+ name: mailContent.subject ? mailContent.subject : DataViewTranslateable_1.DataViewTranslateable.consumption.mails.mailSubjectFallback,
523
+ subject: mailContent.subject,
524
+ body: mailContent.body,
525
+ to: to,
526
+ toCount: mailContent.to.length,
527
+ cc: cc,
528
+ ccCount: cc.length
529
+ };
517
530
  if (mailContent["@type"] === "RequestMail") {
518
531
  const requestMailContent = message.content;
519
- value.name = DataViewTranslateable_1.DataViewTranslateable.consumption.mails.requestMailSubjectFallback;
520
- if (requestMailContent.subject) {
521
- value.name = requestMailContent.subject;
522
- }
523
- value.type = "RequestMailDVO";
524
- value.requests = await this.expandUnknownRequests(requestMailContent.requests);
525
- value.requestCount = requestMailContent.requests.length;
526
- return value;
532
+ const requestMailDVO = {
533
+ ...mailDVO,
534
+ type: "RequestMailDVO",
535
+ name: requestMailContent.subject ? requestMailContent.subject : DataViewTranslateable_1.DataViewTranslateable.consumption.mails.requestMailSubjectFallback,
536
+ requests: await this.expandUnknownRequests(requestMailContent.requests),
537
+ requestCount: requestMailContent.requests.length
538
+ };
539
+ return requestMailDVO;
527
540
  }
528
- return value;
541
+ return mailDVO;
529
542
  }
530
- return value;
543
+ return messageDVO;
531
544
  }
532
545
  async expandMessageDTOs(messages) {
533
546
  const messagePromises = messages.map((message) => this.expandMessageDTO(message));
@@ -632,7 +645,8 @@ let DataViewExpander = class DataViewExpander {
632
645
  value: attribute.content.value,
633
646
  date: attribute.createdAt,
634
647
  isOwn: true,
635
- sharedItems: []
648
+ sharedItems: [],
649
+ sharedItemCount: 0
636
650
  };
637
651
  }
638
652
  async expandConsumptionAttributes(attributes) {
@@ -654,6 +668,7 @@ let DataViewExpander = class DataViewExpander {
654
668
  id: name,
655
669
  name: name,
656
670
  matches: matchedAttributes,
671
+ matchCount: matchedAttributes.length,
657
672
  bestMatch: bestMatch
658
673
  };
659
674
  }
@@ -696,13 +711,24 @@ let DataViewExpander = class DataViewExpander {
696
711
  else {
697
712
  name = DataViewTranslateable_1.DataViewTranslateable.consumption.requests.attributesChangeRequestName;
698
713
  }
714
+ const changes = [];
715
+ attributesObjects.forEach((attribute, index) => {
716
+ changes.push({
717
+ oldAttribute: oldAttributesObjects[index],
718
+ newAttribute: attribute
719
+ });
720
+ });
699
721
  return {
700
722
  ...request,
701
723
  type: "AttributesChangeRequestDVO",
702
724
  name: name,
703
725
  newAttributes: attributesObjects,
726
+ newAttributeCount: attributesObjects.length,
704
727
  oldAttributes: oldAttributesObjects,
705
- applyTo: applyToObject
728
+ oldAttributeCount: oldAttributesObjects.length,
729
+ applyTo: applyToObject,
730
+ changes: changes,
731
+ changeCount: changes.length
706
732
  };
707
733
  }
708
734
  async expandAttributesRequest(attributesRequest) {
@@ -719,8 +745,10 @@ let DataViewExpander = class DataViewExpander {
719
745
  ...request,
720
746
  type: "AttributesRequestDVO",
721
747
  names: attributesRequest.names,
748
+ nameCount: attributesRequest.names.length,
722
749
  name: name,
723
750
  attributes: attributesObjects,
751
+ attributeCount: attributesObjects.length,
724
752
  required: attributesRequest.required
725
753
  };
726
754
  }
@@ -775,18 +803,69 @@ let DataViewExpander = class DataViewExpander {
775
803
  const relationshipPromises = addresses.map((address) => this.expandAddress(address));
776
804
  return await Promise.all(relationshipPromises);
777
805
  }
806
+ async expandRecipient(recipient) {
807
+ const identity = await this.expandAddress(recipient.address);
808
+ return {
809
+ ...identity,
810
+ type: "RecipientDVO",
811
+ receivedAt: recipient.receivedAt,
812
+ receivedByDevice: recipient.receivedByDevice
813
+ };
814
+ }
778
815
  async expandRecipients(recipients) {
779
- const relationshipPromises = recipients.map((recipient) => this.expandAddress(recipient.address));
816
+ const relationshipPromises = recipients.map((recipient) => this.expandRecipient(recipient));
780
817
  return await Promise.all(relationshipPromises);
781
818
  }
819
+ expandRelationshipChange(relationship, change) {
820
+ const date = change.response ? change.response.createdAt : change.request.createdAt;
821
+ let isOwn = false;
822
+ if (this.identityController.isMe(transport_1.CoreAddress.from(change.request.createdBy))) {
823
+ isOwn = true;
824
+ }
825
+ let response;
826
+ if (change.response) {
827
+ response = {
828
+ ...change.response,
829
+ id: `${change.id}_response`,
830
+ name: "i18n://dvo.relationshipChange.response.name",
831
+ type: "RelationshipChangeResponseDVO"
832
+ };
833
+ }
834
+ return Promise.resolve({
835
+ type: "RelationshipChangeDVO",
836
+ id: change.id,
837
+ name: "",
838
+ date: date,
839
+ status: change.status,
840
+ statusText: `i18n://dvo.relationshipChange.${change.status}`,
841
+ changeType: change.type,
842
+ changeTypeText: `i18n://dvo.relationshipChange.${change.type}`,
843
+ isOwn: isOwn,
844
+ request: {
845
+ ...change.request,
846
+ id: `${change.id}_request`,
847
+ name: "i18n://dvo.relationshipChange.request.name",
848
+ type: "RelationshipChangeRequestDVO"
849
+ },
850
+ response: response
851
+ });
852
+ }
853
+ async expandRelationshipChanges(relationship) {
854
+ const changePromises = relationship.changes.map((change) => this.expandRelationshipChange(relationship, change));
855
+ return await Promise.all(changePromises);
856
+ }
782
857
  async createRelationshipDVO(relationship, relationshipInfo) {
783
858
  var _a, _b, _c, _d;
784
859
  if (!relationshipInfo) {
785
860
  const relationshipInfoResult = await this.consumption.relationshipInfo.getRelationshipInfoByRelationship({ relationshipId: relationship.id });
786
861
  relationshipInfo = relationshipInfoResult.value;
787
862
  }
863
+ let direction = RelationshipDVO_1.RelationshipDirection.Incoming;
864
+ if (this.identityController.isMe(transport_1.CoreAddress.from(relationship.changes[0].request.createdBy))) {
865
+ direction = RelationshipDVO_1.RelationshipDirection.Outgoing;
866
+ }
788
867
  let statusText = "";
789
- if (relationship.status === transport_1.RelationshipStatus.Pending && this.identityController.isMe(transport_1.CoreAddress.from(relationship.changes[0].request.createdBy))) {
868
+ if (relationship.status === transport_1.RelationshipStatus.Pending && direction === RelationshipDVO_1.RelationshipDirection.Outgoing) {
790
869
  statusText = DataViewTranslateable_1.DataViewTranslateable.transport.relationshipOutgoing;
791
870
  }
792
871
  else if (relationship.status === transport_1.RelationshipStatus.Pending) {
@@ -801,6 +880,7 @@ let DataViewExpander = class DataViewExpander {
801
880
  else if (relationship.status === transport_1.RelationshipStatus.Active) {
802
881
  statusText = DataViewTranslateable_1.DataViewTranslateable.transport.relationshipActive;
803
882
  }
883
+ const changes = await this.expandRelationshipChanges(relationship);
804
884
  return {
805
885
  id: relationship.id,
806
886
  name: relationshipInfo.userTitle ? relationshipInfo.userTitle : relationshipInfo.title,
@@ -808,14 +888,18 @@ let DataViewExpander = class DataViewExpander {
808
888
  date: relationship.changes[0].request.createdAt,
809
889
  image: "",
810
890
  type: "RelationshipDVO",
811
- status: statusText,
891
+ status: relationship.status,
892
+ statusText: statusText,
893
+ direction: direction,
812
894
  isPinned: relationshipInfo.isPinned,
813
895
  theme: {
814
896
  image: (_a = relationshipInfo.theme) === null || _a === void 0 ? void 0 : _a.image,
815
897
  headerImage: (_b = relationshipInfo.theme) === null || _b === void 0 ? void 0 : _b.imageBar,
816
898
  backgroundColor: (_c = relationshipInfo.theme) === null || _c === void 0 ? void 0 : _c.backgroundColor,
817
899
  foregroundColor: (_d = relationshipInfo.theme) === null || _d === void 0 ? void 0 : _d.foregroundColor
818
- }
900
+ },
901
+ changes: changes,
902
+ changeCount: changes.length
819
903
  };
820
904
  }
821
905
  async expandRelationshipDTO(relationship) {
@@ -827,7 +911,7 @@ let DataViewExpander = class DataViewExpander {
827
911
  const initials = ((_a = name.match(/\b\w/g)) !== null && _a !== void 0 ? _a : []).join("");
828
912
  const relationshipDVO = await this.createRelationshipDVO(relationship, relationshipInfo);
829
913
  if (!description) {
830
- description = relationshipDVO.status;
914
+ description = relationshipDVO.statusText;
831
915
  }
832
916
  return {
833
917
  type: "IdentityDVO",
@@ -950,11 +1034,11 @@ exports.DataViewTranslateable = DataViewTranslateable;
950
1034
  DataViewTranslateable.prefix = "i18n://dvo.";
951
1035
  DataViewTranslateable.transport = {
952
1036
  messageName: `${DataViewTranslateable.prefix}message.name`,
953
- relationshipOutgoing: `${DataViewTranslateable.prefix}relationship.outgoing`,
954
- relationshipIncoming: `${DataViewTranslateable.prefix}relationship.incoming`,
955
- relationshipRejected: `${DataViewTranslateable.prefix}relationship.rejected`,
956
- relationshipRevoked: `${DataViewTranslateable.prefix}relationship.revoked`,
957
- relationshipActive: `${DataViewTranslateable.prefix}relationship.active`,
1037
+ relationshipOutgoing: `${DataViewTranslateable.prefix}relationship.Outgoing`,
1038
+ relationshipIncoming: `${DataViewTranslateable.prefix}relationship.Incoming`,
1039
+ relationshipRejected: `${DataViewTranslateable.prefix}relationship.Rejected`,
1040
+ relationshipRevoked: `${DataViewTranslateable.prefix}relationship.Revoked`,
1041
+ relationshipActive: `${DataViewTranslateable.prefix}relationship.Active`,
958
1042
  fileName: `${DataViewTranslateable.prefix}file.name`
959
1043
  };
960
1044
  DataViewTranslateable.consumption = {
@@ -1208,10 +1292,18 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
1208
1292
  exports.MessageStatus = void 0;
1209
1293
  var MessageStatus;
1210
1294
  (function (MessageStatus) {
1211
- MessageStatus["Received"] = "received";
1212
- MessageStatus["Delivering"] = "delivering";
1213
- MessageStatus["Delivered"] = "delivered";
1214
- MessageStatus["Errorneous"] = "errorneous";
1295
+ /**
1296
+ * Message was received
1297
+ */
1298
+ MessageStatus["Received"] = "Received";
1299
+ /**
1300
+ * Message was sent but is not yet received by every recipient
1301
+ */
1302
+ MessageStatus["Delivering"] = "Delivering";
1303
+ /**
1304
+ * Message was sent and was received by every recipient
1305
+ */
1306
+ MessageStatus["Delivered"] = "Delivered";
1215
1307
  })(MessageStatus = exports.MessageStatus || (exports.MessageStatus = {}));
1216
1308
  //# sourceMappingURL=MessageDVO.js.map
1217
1309
 
@@ -1226,6 +1318,12 @@ var MessageStatus;
1226
1318
  "use strict";
1227
1319
 
1228
1320
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1321
+ exports.RelationshipDirection = void 0;
1322
+ var RelationshipDirection;
1323
+ (function (RelationshipDirection) {
1324
+ RelationshipDirection["Outgoing"] = "Outgoing";
1325
+ RelationshipDirection["Incoming"] = "Incoming";
1326
+ })(RelationshipDirection = exports.RelationshipDirection || (exports.RelationshipDirection = {}));
1229
1327
  //# sourceMappingURL=RelationshipDVO.js.map
1230
1328
 
1231
1329
  /***/ }),
@@ -11668,7 +11766,7 @@ class RelationshipTemplateMapper {
11668
11766
  createdBy: template.cache.createdBy.toString(),
11669
11767
  createdByDevice: template.cache.createdByDevice.toString(),
11670
11768
  createdAt: template.cache.createdAt.toString(),
11671
- content: template.cache.content,
11769
+ content: template.cache.content.toJSON(),
11672
11770
  expiresAt: (_a = template.cache.expiresAt) === null || _a === void 0 ? void 0 : _a.toString(),
11673
11771
  maxNumberOfRelationships: template.cache.maxNumberOfRelationships
11674
11772
  };
@@ -12222,19 +12320,21 @@ class RelationshipMapper {
12222
12320
  return relationships.map((r) => this.toRelationshipDTO(r));
12223
12321
  }
12224
12322
  static toRelationshipChangeRequestDTO(change) {
12323
+ var _a;
12225
12324
  return {
12226
12325
  createdBy: change.createdBy.toString(),
12227
12326
  createdByDevice: change.createdByDevice.toString(),
12228
12327
  createdAt: change.createdAt.toString(),
12229
- content: change.content
12328
+ content: (_a = change.content) === null || _a === void 0 ? void 0 : _a.toJSON()
12230
12329
  };
12231
12330
  }
12232
12331
  static toRelationshipChangeResponseDTO(change) {
12332
+ var _a;
12233
12333
  return {
12234
12334
  createdBy: change.createdBy.toString(),
12235
12335
  createdByDevice: change.createdByDevice.toString(),
12236
12336
  createdAt: change.createdAt.toString(),
12237
- content: change.content
12337
+ content: (_a = change.content) === null || _a === void 0 ? void 0 : _a.toJSON()
12238
12338
  };
12239
12339
  }
12240
12340
  static toRelationshipChangeDTO(change) {
@@ -14155,7 +14255,7 @@ Object.defineProperty(exports, "CodeGen", ({ enumerable: true, get: function ()
14155
14255
  "use strict";
14156
14256
 
14157
14257
  Object.defineProperty(exports, "__esModule", ({ value: true }));
14158
- exports.regexpCode = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
14258
+ exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
14159
14259
  class _CodeOrName {
14160
14260
  }
14161
14261
  exports._CodeOrName = _CodeOrName;
@@ -14295,6 +14395,14 @@ function getProperty(key) {
14295
14395
  return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
14296
14396
  }
14297
14397
  exports.getProperty = getProperty;
14398
+ //Does best effort to format the name properly
14399
+ function getEsmExportName(key) {
14400
+ if (typeof key == "string" && exports.IDENTIFIER.test(key)) {
14401
+ return new _Code(`${key}`);
14402
+ }
14403
+ throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
14404
+ }
14405
+ exports.getEsmExportName = getEsmExportName;
14298
14406
  function regexpCode(rx) {
14299
14407
  return new _Code(rx.toString());
14300
14408
  }
@@ -19123,6 +19231,8 @@ exports["default"] = def;
19123
19231
  Object.defineProperty(exports, "__esModule", ({ value: true }));
19124
19232
  const codegen_1 = __webpack_require__(/*! ../../compile/codegen */ "./node_modules/ajv/dist/compile/codegen/index.js");
19125
19233
  const types_1 = __webpack_require__(/*! ../discriminator/types */ "./node_modules/ajv/dist/vocabularies/discriminator/types.js");
19234
+ const compile_1 = __webpack_require__(/*! ../../compile */ "./node_modules/ajv/dist/compile/index.js");
19235
+ const util_1 = __webpack_require__(/*! ../../compile/util */ "./node_modules/ajv/dist/compile/util.js");
19126
19236
  const error = {
19127
19237
  message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag
19128
19238
  ? `tag "${tagName}" must be string`
@@ -19174,10 +19284,15 @@ const def = {
19174
19284
  const topRequired = hasRequired(parentSchema);
19175
19285
  let tagRequired = true;
19176
19286
  for (let i = 0; i < oneOf.length; i++) {
19177
- const sch = oneOf[i];
19178
- const propSch = (_a = sch.properties) === null || _a === void 0 ? void 0 : _a[tagName];
19287
+ let sch = oneOf[i];
19288
+ if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) {
19289
+ sch = compile_1.resolveRef.call(it.self, it.schemaEnv, it.baseId, sch === null || sch === void 0 ? void 0 : sch.$ref);
19290
+ if (sch instanceof compile_1.SchemaEnv)
19291
+ sch = sch.schema;
19292
+ }
19293
+ const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName];
19179
19294
  if (typeof propSch != "object") {
19180
- throw new Error(`discriminator: oneOf schemas must have "properties/${tagName}"`);
19295
+ throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
19181
19296
  }
19182
19297
  tagRequired = tagRequired && (topRequired || hasRequired(sch));
19183
19298
  addMappings(propSch, i);