@nmshd/runtime 1.2.10 → 1.2.14
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/dist/buildInformation.js +5 -5
- package/dist/dataViews/DataViewExpander.d.ts +7 -4
- package/dist/dataViews/DataViewExpander.js +115 -31
- package/dist/dataViews/DataViewExpander.js.map +1 -1
- package/dist/dataViews/DataViewTranslateable.js +5 -5
- package/dist/dataViews/consumption/MatchedAttributesDVO.d.ts +1 -0
- package/dist/dataViews/consumption/StoredAttributeDVO.d.ts +1 -0
- package/dist/dataViews/content/MailDVOs.d.ts +3 -4
- package/dist/dataViews/content/RequestDVOs.d.ts +23 -1
- package/dist/dataViews/transport/IdentityDVO.d.ts +4 -2
- package/dist/dataViews/transport/MessageDVO.d.ts +62 -6
- package/dist/dataViews/transport/MessageDVO.js +12 -4
- package/dist/dataViews/transport/MessageDVO.js.map +1 -1
- package/dist/dataViews/transport/RelationshipDVO.d.ts +33 -0
- package/dist/dataViews/transport/RelationshipDVO.js +6 -0
- package/dist/dataViews/transport/RelationshipDVO.js.map +1 -1
- package/dist/useCases/common/RuntimeErrors.d.ts +1 -0
- package/dist/useCases/common/RuntimeErrors.js +3 -0
- package/dist/useCases/common/RuntimeErrors.js.map +1 -1
- package/dist/useCases/common/UseCase.d.ts +1 -1
- package/dist/useCases/common/UseCase.js +14 -7
- package/dist/useCases/common/UseCase.js.map +1 -1
- package/dist/useCases/transport/relationshipTemplates/RelationshipTemplateMapper.js +1 -1
- package/dist/useCases/transport/relationshipTemplates/RelationshipTemplateMapper.js.map +1 -1
- package/dist/useCases/transport/relationships/RelationshipMapper.js +4 -2
- package/dist/useCases/transport/relationships/RelationshipMapper.js.map +1 -1
- package/lib-web/nmshd.runtime.js +222 -60
- package/lib-web/nmshd.runtime.js.map +1 -1
- package/lib-web/nmshd.runtime.min.js +2 -2
- package/lib-web/nmshd.runtime.min.js.map +1 -1
- package/package.json +16 -13
package/lib-web/nmshd.runtime.js
CHANGED
|
@@ -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.
|
|
331
|
-
build: "
|
|
332
|
-
date: "2022-01-
|
|
333
|
-
commit: "
|
|
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.
|
|
330
|
+
version: "1.2.14",
|
|
331
|
+
build: "29",
|
|
332
|
+
date: "2022-01-18T14:34:32+00:00",
|
|
333
|
+
commit: "e918dc5de9040616f4be81f76521ea83cd13c405",
|
|
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.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
|
|
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
|
-
|
|
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
|
-
|
|
506
|
-
|
|
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
|
-
|
|
513
|
-
value.ccCount = mailContent.cc.length;
|
|
517
|
+
cc = mailContent.cc.map((value) => addressMap[value]);
|
|
514
518
|
}
|
|
515
|
-
|
|
516
|
-
|
|
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
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
return
|
|
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
|
|
541
|
+
return mailDVO;
|
|
529
542
|
}
|
|
530
|
-
return
|
|
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
|
-
|
|
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.
|
|
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 &&
|
|
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:
|
|
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.
|
|
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.
|
|
954
|
-
relationshipIncoming: `${DataViewTranslateable.prefix}relationship.
|
|
955
|
-
relationshipRejected: `${DataViewTranslateable.prefix}relationship.
|
|
956
|
-
relationshipRevoked: `${DataViewTranslateable.prefix}relationship.
|
|
957
|
-
relationshipActive: `${DataViewTranslateable.prefix}relationship.
|
|
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
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
MessageStatus["
|
|
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
|
/***/ }),
|
|
@@ -3746,6 +3844,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
3746
3844
|
exports.RuntimeErrors = void 0;
|
|
3747
3845
|
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
3748
3846
|
class General {
|
|
3847
|
+
unknown(message, data) {
|
|
3848
|
+
return new ts_utils_1.ApplicationError("error.runtime.unknown", message, data);
|
|
3849
|
+
}
|
|
3749
3850
|
alreadyInitialized() {
|
|
3750
3851
|
return new ts_utils_1.ApplicationError("error.runtime.alreadyInitialized", "The runtime is already initialized. The init method can only be executed once.");
|
|
3751
3852
|
}
|
|
@@ -5921,15 +6022,19 @@ exports.LoadPeerTokenRequest = {
|
|
|
5921
6022
|
/*!*****************************************!*\
|
|
5922
6023
|
!*** ./dist/useCases/common/UseCase.js ***!
|
|
5923
6024
|
\*****************************************/
|
|
5924
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
6025
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5925
6026
|
|
|
5926
6027
|
"use strict";
|
|
5927
6028
|
|
|
6029
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6030
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6031
|
+
};
|
|
5928
6032
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5929
6033
|
exports.UseCase = void 0;
|
|
5930
6034
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
5931
6035
|
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
5932
6036
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
6037
|
+
const json_stringify_safe_1 = __importDefault(__webpack_require__(/*! json-stringify-safe */ "./node_modules/json-stringify-safe/stringify.js"));
|
|
5933
6038
|
const PlatformErrorCodes_1 = __webpack_require__(/*! ./PlatformErrorCodes */ "./dist/useCases/common/PlatformErrorCodes.js");
|
|
5934
6039
|
const RuntimeErrors_1 = __webpack_require__(/*! ./RuntimeErrors */ "./dist/useCases/common/RuntimeErrors.js");
|
|
5935
6040
|
class UseCase {
|
|
@@ -5947,20 +6052,23 @@ class UseCase {
|
|
|
5947
6052
|
return await this.executeInternal(request);
|
|
5948
6053
|
}
|
|
5949
6054
|
catch (e) {
|
|
5950
|
-
|
|
5951
|
-
throw e;
|
|
5952
|
-
}
|
|
5953
|
-
return this.resultFromError(e);
|
|
6055
|
+
return this.failingResultFromUnknownError(e);
|
|
5954
6056
|
}
|
|
5955
6057
|
}
|
|
5956
|
-
|
|
6058
|
+
failingResultFromUnknownError(error) {
|
|
6059
|
+
if (!(error instanceof Error)) {
|
|
6060
|
+
return ts_utils_1.Result.fail(RuntimeErrors_1.RuntimeErrors.general.unknown(`An unknown object was thrown in a UseCase: ${(0, json_stringify_safe_1.default)(error)}`, error));
|
|
6061
|
+
}
|
|
5957
6062
|
if (error instanceof transport_1.RequestError) {
|
|
5958
6063
|
return this.handleRequestError(error);
|
|
5959
6064
|
}
|
|
5960
6065
|
if (error instanceof ts_serval_1.ServalError) {
|
|
5961
6066
|
return this.handleServalError(error);
|
|
5962
6067
|
}
|
|
5963
|
-
|
|
6068
|
+
if (error instanceof ts_utils_1.ApplicationError) {
|
|
6069
|
+
return ts_utils_1.Result.fail(error);
|
|
6070
|
+
}
|
|
6071
|
+
return ts_utils_1.Result.fail(RuntimeErrors_1.RuntimeErrors.general.unknown(`An error was thrown in a UseCase: ${error.message}`, error));
|
|
5964
6072
|
}
|
|
5965
6073
|
handleServalError(error) {
|
|
5966
6074
|
let runtimeError;
|
|
@@ -5986,7 +6094,7 @@ class UseCase {
|
|
|
5986
6094
|
if (PlatformErrorCodes_1.PlatformErrorCodes.isUnexpectedError(error)) {
|
|
5987
6095
|
return ts_utils_1.Result.fail(new ts_utils_1.ApplicationError(error.code, error.message));
|
|
5988
6096
|
}
|
|
5989
|
-
|
|
6097
|
+
return ts_utils_1.Result.fail(error);
|
|
5990
6098
|
}
|
|
5991
6099
|
validationFailed(validationResult) {
|
|
5992
6100
|
var _a, _b, _c;
|
|
@@ -11658,7 +11766,7 @@ class RelationshipTemplateMapper {
|
|
|
11658
11766
|
createdBy: template.cache.createdBy.toString(),
|
|
11659
11767
|
createdByDevice: template.cache.createdByDevice.toString(),
|
|
11660
11768
|
createdAt: template.cache.createdAt.toString(),
|
|
11661
|
-
content: template.cache.content,
|
|
11769
|
+
content: template.cache.content.toJSON(),
|
|
11662
11770
|
expiresAt: (_a = template.cache.expiresAt) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
11663
11771
|
maxNumberOfRelationships: template.cache.maxNumberOfRelationships
|
|
11664
11772
|
};
|
|
@@ -12212,19 +12320,21 @@ class RelationshipMapper {
|
|
|
12212
12320
|
return relationships.map((r) => this.toRelationshipDTO(r));
|
|
12213
12321
|
}
|
|
12214
12322
|
static toRelationshipChangeRequestDTO(change) {
|
|
12323
|
+
var _a;
|
|
12215
12324
|
return {
|
|
12216
12325
|
createdBy: change.createdBy.toString(),
|
|
12217
12326
|
createdByDevice: change.createdByDevice.toString(),
|
|
12218
12327
|
createdAt: change.createdAt.toString(),
|
|
12219
|
-
content: change.content
|
|
12328
|
+
content: (_a = change.content) === null || _a === void 0 ? void 0 : _a.toJSON()
|
|
12220
12329
|
};
|
|
12221
12330
|
}
|
|
12222
12331
|
static toRelationshipChangeResponseDTO(change) {
|
|
12332
|
+
var _a;
|
|
12223
12333
|
return {
|
|
12224
12334
|
createdBy: change.createdBy.toString(),
|
|
12225
12335
|
createdByDevice: change.createdByDevice.toString(),
|
|
12226
12336
|
createdAt: change.createdAt.toString(),
|
|
12227
|
-
content: change.content
|
|
12337
|
+
content: (_a = change.content) === null || _a === void 0 ? void 0 : _a.toJSON()
|
|
12228
12338
|
};
|
|
12229
12339
|
}
|
|
12230
12340
|
static toRelationshipChangeDTO(change) {
|
|
@@ -14145,7 +14255,7 @@ Object.defineProperty(exports, "CodeGen", ({ enumerable: true, get: function ()
|
|
|
14145
14255
|
"use strict";
|
|
14146
14256
|
|
|
14147
14257
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14148
|
-
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;
|
|
14149
14259
|
class _CodeOrName {
|
|
14150
14260
|
}
|
|
14151
14261
|
exports._CodeOrName = _CodeOrName;
|
|
@@ -14285,6 +14395,14 @@ function getProperty(key) {
|
|
|
14285
14395
|
return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
|
|
14286
14396
|
}
|
|
14287
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;
|
|
14288
14406
|
function regexpCode(rx) {
|
|
14289
14407
|
return new _Code(rx.toString());
|
|
14290
14408
|
}
|
|
@@ -19113,6 +19231,8 @@ exports["default"] = def;
|
|
|
19113
19231
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
19114
19232
|
const codegen_1 = __webpack_require__(/*! ../../compile/codegen */ "./node_modules/ajv/dist/compile/codegen/index.js");
|
|
19115
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");
|
|
19116
19236
|
const error = {
|
|
19117
19237
|
message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag
|
|
19118
19238
|
? `tag "${tagName}" must be string`
|
|
@@ -19164,10 +19284,15 @@ const def = {
|
|
|
19164
19284
|
const topRequired = hasRequired(parentSchema);
|
|
19165
19285
|
let tagRequired = true;
|
|
19166
19286
|
for (let i = 0; i < oneOf.length; i++) {
|
|
19167
|
-
|
|
19168
|
-
|
|
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];
|
|
19169
19294
|
if (typeof propSch != "object") {
|
|
19170
|
-
throw new Error(`discriminator: oneOf schemas must have "properties/${tagName}"`);
|
|
19295
|
+
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
|
|
19171
19296
|
}
|
|
19172
19297
|
tagRequired = tagRequired && (topRequired || hasRequired(sch));
|
|
19173
19298
|
addMappings(propSch, i);
|
|
@@ -24927,6 +25052,43 @@ function escapeJsonPtr(str) {
|
|
|
24927
25052
|
}
|
|
24928
25053
|
|
|
24929
25054
|
|
|
25055
|
+
/***/ }),
|
|
25056
|
+
|
|
25057
|
+
/***/ "./node_modules/json-stringify-safe/stringify.js":
|
|
25058
|
+
/*!*******************************************************!*\
|
|
25059
|
+
!*** ./node_modules/json-stringify-safe/stringify.js ***!
|
|
25060
|
+
\*******************************************************/
|
|
25061
|
+
/***/ ((module, exports) => {
|
|
25062
|
+
|
|
25063
|
+
exports = module.exports = stringify
|
|
25064
|
+
exports.getSerialize = serializer
|
|
25065
|
+
|
|
25066
|
+
function stringify(obj, replacer, spaces, cycleReplacer) {
|
|
25067
|
+
return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces)
|
|
25068
|
+
}
|
|
25069
|
+
|
|
25070
|
+
function serializer(replacer, cycleReplacer) {
|
|
25071
|
+
var stack = [], keys = []
|
|
25072
|
+
|
|
25073
|
+
if (cycleReplacer == null) cycleReplacer = function(key, value) {
|
|
25074
|
+
if (stack[0] === value) return "[Circular ~]"
|
|
25075
|
+
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"
|
|
25076
|
+
}
|
|
25077
|
+
|
|
25078
|
+
return function(key, value) {
|
|
25079
|
+
if (stack.length > 0) {
|
|
25080
|
+
var thisPos = stack.indexOf(this)
|
|
25081
|
+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this)
|
|
25082
|
+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)
|
|
25083
|
+
if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value)
|
|
25084
|
+
}
|
|
25085
|
+
else stack.push(value)
|
|
25086
|
+
|
|
25087
|
+
return replacer == null ? value : replacer.call(this, key, value)
|
|
25088
|
+
}
|
|
25089
|
+
}
|
|
25090
|
+
|
|
25091
|
+
|
|
24930
25092
|
/***/ }),
|
|
24931
25093
|
|
|
24932
25094
|
/***/ "./node_modules/lodash.get/index.js":
|