@nmshd/runtime 2.8.3 → 2.9.1

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 (72) hide show
  1. package/dist/Runtime.js +7 -0
  2. package/dist/Runtime.js.map +1 -1
  3. package/dist/buildInformation.js +4 -4
  4. package/dist/dataViews/DataViewExpander.js +20 -0
  5. package/dist/dataViews/DataViewExpander.js.map +1 -1
  6. package/dist/dataViews/consumption/DecidableRequestItemDVOs.d.ts +4 -0
  7. package/dist/dataViews/content/RequestItemDVOs.d.ts +4 -0
  8. package/dist/extensibility/ConsumptionServices.d.ts +3 -2
  9. package/dist/extensibility/ConsumptionServices.js +5 -2
  10. package/dist/extensibility/ConsumptionServices.js.map +1 -1
  11. package/dist/extensibility/facades/consumption/NotificationsFacade.d.ts +18 -0
  12. package/dist/extensibility/facades/consumption/NotificationsFacade.js +61 -0
  13. package/dist/extensibility/facades/consumption/NotificationsFacade.js.map +1 -0
  14. package/dist/extensibility/facades/consumption/index.d.ts +1 -0
  15. package/dist/extensibility/facades/consumption/index.js +1 -0
  16. package/dist/extensibility/facades/consumption/index.js.map +1 -1
  17. package/dist/modules/NotificationModule.d.ts +8 -0
  18. package/dist/modules/NotificationModule.js +47 -0
  19. package/dist/modules/NotificationModule.js.map +1 -0
  20. package/dist/modules/index.d.ts +1 -0
  21. package/dist/modules/index.js +1 -0
  22. package/dist/modules/index.js.map +1 -1
  23. package/dist/types/consumption/LocalNotificationDTO.d.ts +15 -0
  24. package/dist/types/consumption/LocalNotificationDTO.js +3 -0
  25. package/dist/types/consumption/LocalNotificationDTO.js.map +1 -0
  26. package/dist/types/consumption/index.d.ts +1 -0
  27. package/dist/types/consumption/index.js +1 -0
  28. package/dist/types/consumption/index.js.map +1 -1
  29. package/dist/useCases/common/RuntimeErrors.d.ts +7 -0
  30. package/dist/useCases/common/RuntimeErrors.js +12 -0
  31. package/dist/useCases/common/RuntimeErrors.js.map +1 -1
  32. package/dist/useCases/common/Schemas.d.ts +5 -0
  33. package/dist/useCases/common/Schemas.js +122 -3
  34. package/dist/useCases/common/Schemas.js.map +1 -1
  35. package/dist/useCases/common/validation/ValidatableStrings.d.ts +4 -0
  36. package/dist/useCases/consumption/attributes/DeleteAttribute.js.map +1 -1
  37. package/dist/useCases/consumption/attributes/GetAttribute.js.map +1 -1
  38. package/dist/useCases/consumption/attributes/SucceedAttribute.js.map +1 -1
  39. package/dist/useCases/consumption/index.d.ts +1 -0
  40. package/dist/useCases/consumption/index.js +1 -0
  41. package/dist/useCases/consumption/index.js.map +1 -1
  42. package/dist/useCases/consumption/notifications/GetNotification.d.ts +16 -0
  43. package/dist/useCases/consumption/notifications/GetNotification.js +48 -0
  44. package/dist/useCases/consumption/notifications/GetNotification.js.map +1 -0
  45. package/dist/useCases/consumption/notifications/GetNotifications.d.ts +15 -0
  46. package/dist/useCases/consumption/notifications/GetNotifications.js +40 -0
  47. package/dist/useCases/consumption/notifications/GetNotifications.js.map +1 -0
  48. package/dist/useCases/consumption/notifications/NotificationMapper.d.ts +6 -0
  49. package/dist/useCases/consumption/notifications/NotificationMapper.js +25 -0
  50. package/dist/useCases/consumption/notifications/NotificationMapper.js.map +1 -0
  51. package/dist/useCases/consumption/notifications/ProcessNotificationById.d.ts +16 -0
  52. package/dist/useCases/consumption/notifications/ProcessNotificationById.js +49 -0
  53. package/dist/useCases/consumption/notifications/ProcessNotificationById.js.map +1 -0
  54. package/dist/useCases/consumption/notifications/ProcessOpenNotifactionsReceivedByCurrentDevice.d.ts +8 -0
  55. package/dist/useCases/consumption/notifications/ProcessOpenNotifactionsReceivedByCurrentDevice.js +35 -0
  56. package/dist/useCases/consumption/notifications/ProcessOpenNotifactionsReceivedByCurrentDevice.js.map +1 -0
  57. package/dist/useCases/consumption/notifications/ReceivedNotification.d.ts +18 -0
  58. package/dist/useCases/consumption/notifications/ReceivedNotification.js +60 -0
  59. package/dist/useCases/consumption/notifications/ReceivedNotification.js.map +1 -0
  60. package/dist/useCases/consumption/notifications/SentNotification.d.ts +18 -0
  61. package/dist/useCases/consumption/notifications/SentNotification.js +60 -0
  62. package/dist/useCases/consumption/notifications/SentNotification.js.map +1 -0
  63. package/dist/useCases/consumption/notifications/index.d.ts +6 -0
  64. package/dist/useCases/consumption/notifications/index.js +23 -0
  65. package/dist/useCases/consumption/notifications/index.js.map +1 -0
  66. package/dist/useCases/transport/messages/GetAttachmentMetadata.js +1 -1
  67. package/dist/useCases/transport/messages/GetAttachmentMetadata.js.map +1 -1
  68. package/lib-web/nmshd.runtime.js +736 -10
  69. package/lib-web/nmshd.runtime.js.map +1 -1
  70. package/lib-web/nmshd.runtime.min.js +3 -3
  71. package/lib-web/nmshd.runtime.min.js.map +1 -1
  72. package/package.json +7 -5
@@ -359,6 +359,9 @@ class Runtime {
359
359
  typescript_ioc_1.Container.bind(consumption_1.SettingsController)
360
360
  .factory(() => this.getConsumptionController().settings)
361
361
  .scope(typescript_ioc_1.Scope.Request);
362
+ typescript_ioc_1.Container.bind(consumption_1.NotificationsController)
363
+ .factory(() => this.getConsumptionController().notifications)
364
+ .scope(typescript_ioc_1.Scope.Request);
362
365
  typescript_ioc_1.Container.bind(transport_1.AnonymousTokenController)
363
366
  .factory(() => new transport_1.AnonymousTokenController(this.transport.config))
364
367
  .scope(typescript_ioc_1.Scope.Singleton);
@@ -408,6 +411,10 @@ class Runtime {
408
411
  const attributeListenerModule = new modules_1.AttributeListenerModule(this, moduleConfiguration, this.loggerFactory.getLogger(modules_1.AttributeListenerModule));
409
412
  this.modules.add(attributeListenerModule);
410
413
  break;
414
+ case "NotificationModule":
415
+ const notificationModule = new modules_1.NotificationModule(this, moduleConfiguration, this.loggerFactory.getLogger(modules_1.NotificationModule));
416
+ this.modules.add(notificationModule);
417
+ break;
411
418
  default:
412
419
  throw new Error(`Module ${moduleConfiguration.name} is not a builtin module.`);
413
420
  }
@@ -548,10 +555,10 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
548
555
  const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
549
556
  const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
550
557
  exports.buildInformation = {
551
- version: "2.8.3",
552
- build: "172",
553
- date: "2023-10-20T10:54:54+00:00",
554
- commit: "4c2920768495e1467d200b244e51d4a1ffe13f67",
558
+ version: "2.9.1",
559
+ build: "174",
560
+ date: "2023-11-08T16:51:09+00:00",
561
+ commit: "47dcb9c2b07e0a9dd9259c929749410be96e733b",
555
562
  dependencies: {"@js-soft/docdb-querytranslator":"1.1.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"2.0.9","@js-soft/ts-utils":"^2.3.1","@nmshd/consumption":"3.4.3","@nmshd/content":"2.7.4","@nmshd/crypto":"2.0.4","@nmshd/transport":"2.1.2","ajv":"^8.12.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^3.4.3","qrcode":"1.5.3","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
556
563
  libraries: {
557
564
  serval: ts_serval_1.buildInformation,
@@ -1080,6 +1087,26 @@ let DataViewExpander = class DataViewExpander {
1080
1087
  isDecidable,
1081
1088
  response: responseItemDVO
1082
1089
  };
1090
+ case "FreeTextRequestItem":
1091
+ const freeTextRequestItem = requestItem;
1092
+ if (isDecidable) {
1093
+ return {
1094
+ ...freeTextRequestItem,
1095
+ type: "DecidableFreeTextRequestItemDVO",
1096
+ id: "",
1097
+ name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.DecidableFreeTextRequestItem.name",
1098
+ isDecidable,
1099
+ response: responseItemDVO
1100
+ };
1101
+ }
1102
+ return {
1103
+ ...freeTextRequestItem,
1104
+ type: "FreeTextRequestItemDVO",
1105
+ id: "",
1106
+ name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.FreeTextRequestItem.name",
1107
+ isDecidable,
1108
+ response: responseItemDVO
1109
+ };
1083
1110
  case "RegisterAttributeListenerRequestItem":
1084
1111
  const registerAttributeListenerRequestItem = requestItem;
1085
1112
  const queryDVO = (await this.expandAttributeQuery(registerAttributeListenerRequestItem.query));
@@ -3507,13 +3534,14 @@ exports.ConsumptionServices = void 0;
3507
3534
  const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
3508
3535
  const consumption_1 = __webpack_require__(/*! ./facades/consumption */ "./dist/extensibility/facades/consumption/index.js");
3509
3536
  let ConsumptionServices = class ConsumptionServices {
3510
- constructor(attributes, drafts, settings, incomingRequests, outgoingRequests, attributeListeners) {
3537
+ constructor(attributes, drafts, settings, incomingRequests, outgoingRequests, attributeListeners, notifications) {
3511
3538
  this.attributes = attributes;
3512
3539
  this.drafts = drafts;
3513
3540
  this.settings = settings;
3514
3541
  this.incomingRequests = incomingRequests;
3515
3542
  this.outgoingRequests = outgoingRequests;
3516
3543
  this.attributeListeners = attributeListeners;
3544
+ this.notifications = notifications;
3517
3545
  }
3518
3546
  };
3519
3547
  exports.ConsumptionServices = ConsumptionServices;
@@ -3524,12 +3552,14 @@ exports.ConsumptionServices = ConsumptionServices = __decorate([
3524
3552
  __param(3, typescript_ioc_1.Inject),
3525
3553
  __param(4, typescript_ioc_1.Inject),
3526
3554
  __param(5, typescript_ioc_1.Inject),
3555
+ __param(6, typescript_ioc_1.Inject),
3527
3556
  __metadata("design:paramtypes", [consumption_1.AttributesFacade,
3528
3557
  consumption_1.DraftsFacade,
3529
3558
  consumption_1.SettingsFacade,
3530
3559
  consumption_1.IncomingRequestsFacade,
3531
3560
  consumption_1.OutgoingRequestsFacade,
3532
- consumption_1.AttributeListenersFacade])
3561
+ consumption_1.AttributeListenersFacade,
3562
+ consumption_1.NotificationsFacade])
3533
3563
  ], ConsumptionServices);
3534
3564
  //# sourceMappingURL=ConsumptionServices.js.map
3535
3565
 
@@ -4001,6 +4031,77 @@ exports.IncomingRequestsFacade = IncomingRequestsFacade = __decorate([
4001
4031
 
4002
4032
  /***/ }),
4003
4033
 
4034
+ /***/ "./dist/extensibility/facades/consumption/NotificationsFacade.js":
4035
+ /*!***********************************************************************!*\
4036
+ !*** ./dist/extensibility/facades/consumption/NotificationsFacade.js ***!
4037
+ \***********************************************************************/
4038
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
4039
+
4040
+ "use strict";
4041
+
4042
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4043
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4044
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4045
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4046
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
4047
+ };
4048
+ var __metadata = (this && this.__metadata) || function (k, v) {
4049
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4050
+ };
4051
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
4052
+ return function (target, key) { decorator(target, key, paramIndex); }
4053
+ };
4054
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4055
+ exports.NotificationsFacade = void 0;
4056
+ const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
4057
+ const useCases_1 = __webpack_require__(/*! ../../../useCases */ "./dist/useCases/index.js");
4058
+ let NotificationsFacade = class NotificationsFacade {
4059
+ constructor(getUseCase, queryUseCase, sentNotificationUseCase, receivedNotificationUseCase, processOpenNotifactionsReceivedByCurrentDeviceUseCase, processNotificationByIdUseCase) {
4060
+ this.getUseCase = getUseCase;
4061
+ this.queryUseCase = queryUseCase;
4062
+ this.sentNotificationUseCase = sentNotificationUseCase;
4063
+ this.receivedNotificationUseCase = receivedNotificationUseCase;
4064
+ this.processOpenNotifactionsReceivedByCurrentDeviceUseCase = processOpenNotifactionsReceivedByCurrentDeviceUseCase;
4065
+ this.processNotificationByIdUseCase = processNotificationByIdUseCase;
4066
+ }
4067
+ async getNotification(request) {
4068
+ return await this.getUseCase.execute(request);
4069
+ }
4070
+ async getNotifications(request) {
4071
+ return await this.queryUseCase.execute(request);
4072
+ }
4073
+ async sentNotification(request) {
4074
+ return await this.sentNotificationUseCase.execute(request);
4075
+ }
4076
+ async receivedNotification(request) {
4077
+ return await this.receivedNotificationUseCase.execute(request);
4078
+ }
4079
+ async processOpenNotifactionsReceivedByCurrentDevice() {
4080
+ return await this.processOpenNotifactionsReceivedByCurrentDeviceUseCase.execute();
4081
+ }
4082
+ async processNotificationById(request) {
4083
+ return await this.processNotificationByIdUseCase.execute(request);
4084
+ }
4085
+ };
4086
+ exports.NotificationsFacade = NotificationsFacade;
4087
+ exports.NotificationsFacade = NotificationsFacade = __decorate([
4088
+ __param(0, typescript_ioc_1.Inject),
4089
+ __param(1, typescript_ioc_1.Inject),
4090
+ __param(2, typescript_ioc_1.Inject),
4091
+ __param(3, typescript_ioc_1.Inject),
4092
+ __param(4, typescript_ioc_1.Inject),
4093
+ __param(5, typescript_ioc_1.Inject),
4094
+ __metadata("design:paramtypes", [useCases_1.GetNotificationUseCase,
4095
+ useCases_1.GetNotificationsUseCase,
4096
+ useCases_1.SentNotificationUseCase,
4097
+ useCases_1.ReceivedNotificationUseCase,
4098
+ useCases_1.ProcessOpenNotifactionsReceivedByCurrentDeviceUseCase,
4099
+ useCases_1.ProcessNotificationByIdUseCase])
4100
+ ], NotificationsFacade);
4101
+ //# sourceMappingURL=NotificationsFacade.js.map
4102
+
4103
+ /***/ }),
4104
+
4004
4105
  /***/ "./dist/extensibility/facades/consumption/OutgoingRequestsFacade.js":
4005
4106
  /*!**************************************************************************!*\
4006
4107
  !*** ./dist/extensibility/facades/consumption/OutgoingRequestsFacade.js ***!
@@ -4182,6 +4283,7 @@ __exportStar(__webpack_require__(/*! ./AttributeListenersFacade */ "./dist/exten
4182
4283
  __exportStar(__webpack_require__(/*! ./AttributesFacade */ "./dist/extensibility/facades/consumption/AttributesFacade.js"), exports);
4183
4284
  __exportStar(__webpack_require__(/*! ./DraftsFacade */ "./dist/extensibility/facades/consumption/DraftsFacade.js"), exports);
4184
4285
  __exportStar(__webpack_require__(/*! ./IncomingRequestsFacade */ "./dist/extensibility/facades/consumption/IncomingRequestsFacade.js"), exports);
4286
+ __exportStar(__webpack_require__(/*! ./NotificationsFacade */ "./dist/extensibility/facades/consumption/NotificationsFacade.js"), exports);
4185
4287
  __exportStar(__webpack_require__(/*! ./OutgoingRequestsFacade */ "./dist/extensibility/facades/consumption/OutgoingRequestsFacade.js"), exports);
4186
4288
  __exportStar(__webpack_require__(/*! ./SettingsFacade */ "./dist/extensibility/facades/consumption/SettingsFacade.js"), exports);
4187
4289
  //# sourceMappingURL=index.js.map
@@ -5240,6 +5342,63 @@ exports.MessageModule = MessageModule;
5240
5342
 
5241
5343
  /***/ }),
5242
5344
 
5345
+ /***/ "./dist/modules/NotificationModule.js":
5346
+ /*!********************************************!*\
5347
+ !*** ./dist/modules/NotificationModule.js ***!
5348
+ \********************************************/
5349
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5350
+
5351
+ "use strict";
5352
+
5353
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
5354
+ exports.NotificationModule = void 0;
5355
+ const events_1 = __webpack_require__(/*! ../events */ "./dist/events/index.js");
5356
+ const RuntimeModule_1 = __webpack_require__(/*! ../extensibility/modules/RuntimeModule */ "./dist/extensibility/modules/RuntimeModule.js");
5357
+ class NotificationModule extends RuntimeModule_1.RuntimeModule {
5358
+ init() {
5359
+ // Noting to do here
5360
+ }
5361
+ start() {
5362
+ this.subscribeToEvent(events_1.MessageReceivedEvent, this.handleMessageReceivedEvent.bind(this));
5363
+ this.subscribeToEvent(events_1.MessageSentEvent, this.handleMessageSentEvent.bind(this));
5364
+ }
5365
+ async handleMessageReceivedEvent(event) {
5366
+ const message = event.data;
5367
+ if (message.content["@type"] !== "Notification")
5368
+ return;
5369
+ const services = await this.runtime.getServices(event.eventTargetAddress);
5370
+ const receivedResult = await services.consumptionServices.notifications.receivedNotification({ messageId: message.id });
5371
+ if (receivedResult.isError) {
5372
+ this.logger.error(`Could not mark Notification as received for message '${message.id}'.`, receivedResult.error);
5373
+ return;
5374
+ }
5375
+ const notification = receivedResult.value;
5376
+ const processResult = await services.consumptionServices.notifications.processNotificationById({ notificationId: notification.id });
5377
+ if (processResult.isError) {
5378
+ this.logger.error(`Could not process Notification '${notification.id}'.`, processResult.error);
5379
+ return;
5380
+ }
5381
+ }
5382
+ async handleMessageSentEvent(event) {
5383
+ const message = event.data;
5384
+ if (message.content["@type"] !== "Notification")
5385
+ return;
5386
+ const services = await this.runtime.getServices(event.eventTargetAddress);
5387
+ const sentResult = await services.consumptionServices.notifications.sentNotification({ messageId: message.id });
5388
+ if (sentResult.isError) {
5389
+ this.logger.error(`Could not mark Notification as sent by Message '${message.id}'.`, sentResult.error);
5390
+ return;
5391
+ }
5392
+ }
5393
+ stop() {
5394
+ this.unsubscribeFromAllEvents();
5395
+ }
5396
+ }
5397
+ exports.NotificationModule = NotificationModule;
5398
+ //# sourceMappingURL=NotificationModule.js.map
5399
+
5400
+ /***/ }),
5401
+
5243
5402
  /***/ "./dist/modules/RequestModule.js":
5244
5403
  /*!***************************************!*\
5245
5404
  !*** ./dist/modules/RequestModule.js ***!
@@ -5520,6 +5679,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
5520
5679
  __exportStar(__webpack_require__(/*! ./AttributeListenerModule */ "./dist/modules/AttributeListenerModule.js"), exports);
5521
5680
  __exportStar(__webpack_require__(/*! ./DeciderModule */ "./dist/modules/DeciderModule.js"), exports);
5522
5681
  __exportStar(__webpack_require__(/*! ./MessageModule */ "./dist/modules/MessageModule.js"), exports);
5682
+ __exportStar(__webpack_require__(/*! ./NotificationModule */ "./dist/modules/NotificationModule.js"), exports);
5523
5683
  __exportStar(__webpack_require__(/*! ./RequestModule */ "./dist/modules/RequestModule.js"), exports);
5524
5684
  //# sourceMappingURL=index.js.map
5525
5685
 
@@ -5577,6 +5737,19 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
5577
5737
 
5578
5738
  /***/ }),
5579
5739
 
5740
+ /***/ "./dist/types/consumption/LocalNotificationDTO.js":
5741
+ /*!********************************************************!*\
5742
+ !*** ./dist/types/consumption/LocalNotificationDTO.js ***!
5743
+ \********************************************************/
5744
+ /***/ ((__unused_webpack_module, exports) => {
5745
+
5746
+ "use strict";
5747
+
5748
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
5749
+ //# sourceMappingURL=LocalNotificationDTO.js.map
5750
+
5751
+ /***/ }),
5752
+
5580
5753
  /***/ "./dist/types/consumption/LocalRequestDTO.js":
5581
5754
  /*!***************************************************!*\
5582
5755
  !*** ./dist/types/consumption/LocalRequestDTO.js ***!
@@ -5642,6 +5815,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
5642
5815
  __exportStar(__webpack_require__(/*! ./DraftDTO */ "./dist/types/consumption/DraftDTO.js"), exports);
5643
5816
  __exportStar(__webpack_require__(/*! ./LocalAttributeDTO */ "./dist/types/consumption/LocalAttributeDTO.js"), exports);
5644
5817
  __exportStar(__webpack_require__(/*! ./LocalAttributeListenerDTO */ "./dist/types/consumption/LocalAttributeListenerDTO.js"), exports);
5818
+ __exportStar(__webpack_require__(/*! ./LocalNotificationDTO */ "./dist/types/consumption/LocalNotificationDTO.js"), exports);
5645
5819
  __exportStar(__webpack_require__(/*! ./LocalRequestDTO */ "./dist/types/consumption/LocalRequestDTO.js"), exports);
5646
5820
  __exportStar(__webpack_require__(/*! ./RequestValidationResultDTO */ "./dist/types/consumption/RequestValidationResultDTO.js"), exports);
5647
5821
  __exportStar(__webpack_require__(/*! ./SettingDTO */ "./dist/types/consumption/SettingDTO.js"), exports);
@@ -6300,6 +6474,17 @@ class Challenges {
6300
6474
  return new ts_utils_1.ApplicationError("error.runtime.challenges.invalidChallenge", "The challengeString is invalid.");
6301
6475
  }
6302
6476
  }
6477
+ class Notifications {
6478
+ cannotReceiveNotificationFromOwnMessage() {
6479
+ return new ts_utils_1.ApplicationError("error.runtime.notifications.cannotReceiveNotificationFromOwnMessage", "Cannot receive Notification from own message.");
6480
+ }
6481
+ cannotSaveSentNotificationFromPeerMessage() {
6482
+ return new ts_utils_1.ApplicationError("error.runtime.notifications.cannotSaveSendNotificationFromPeerMessage", "Cannot send Notification from peer message.");
6483
+ }
6484
+ messageDoesNotContainNotification(messageId) {
6485
+ return new ts_utils_1.ApplicationError("error.runtime.notifications.messageDoesNotContainNotification", `The Message with the ID '${messageId.toString()}' does not contain a Notification.`);
6486
+ }
6487
+ }
6303
6488
  class RuntimeErrors {
6304
6489
  }
6305
6490
  exports.RuntimeErrors = RuntimeErrors;
@@ -6310,6 +6495,7 @@ RuntimeErrors.files = new Files();
6310
6495
  RuntimeErrors.relationshipTemplates = new RelationshipTemplates();
6311
6496
  RuntimeErrors.messages = new Messages();
6312
6497
  RuntimeErrors.challenges = new Challenges();
6498
+ RuntimeErrors.notifications = new Notifications();
6313
6499
  //# sourceMappingURL=RuntimeErrors.js.map
6314
6500
 
6315
6501
  /***/ }),
@@ -6402,9 +6588,9 @@ exports.JsonSchema = JsonSchema;
6402
6588
  "use strict";
6403
6589
 
6404
6590
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6405
- exports.DownloadAttachmentRequest = exports.SyncDatawalletRequest = exports.RegisterPushNotificationTokenRequest = exports.LoadItemFromTruncatedReferenceRequest = exports.DownloadFileRequest = exports.UpdateSettingRequest = exports.GetSettingsRequest = exports.GetSettingByKeyRequest = exports.GetSettingRequest = exports.DeleteSettingRequest = exports.CreateSettingRequest = exports.UpdateDraftRequest = exports.GetDraftsRequest = exports.GetDraftRequest = exports.DeleteDraftRequest = exports.CreateDraftRequest = exports.ValidateIQLQueryRequest = exports.UpdateAttributeRequest = exports.SucceedAttributeRequest = exports.ShareAttributeRequest = exports.SentOutgoingRequestRequest = exports.RequireManualDecisionOfIncomingRequestRequest = exports.ReceivedIncomingRequestRequest = exports.GetOutgoingRequestsRequest = exports.GetOutgoingRequestRequest = exports.GetIncomingRequestsRequest = exports.GetIncomingRequestRequest = exports.DiscardOutgoingRequestRequest = exports.CreateOutgoingRequestRequest = exports.CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseRequest = exports.CompleteOutgoingRequestRequest = exports.CompleteIncomingRequestRequest = exports.CheckPrerequisitesOfIncomingRequestRequest = exports.RejectIncomingRequestRequest = exports.CanCreateOutgoingRequestRequest = exports.AcceptIncomingRequestRequest = exports.GetSharedToPeerAttributesRequest = exports.GetPeerAttributesRequest = exports.GetAttributesRequest = exports.GetAttributeRequest = exports.ExecuteThirdPartyRelationshipAttributeQueryRequest = exports.ExecuteRelationshipAttributeQueryRequest = exports.ExecuteIQLQueryRequest = exports.ExecuteIdentityAttributeQueryRequest = exports.DeleteAttributeRequest = exports.CreateSharedAttributeCopyRequest = exports.CreateAttributeRequest = exports.GetAttributeListenerRequest = exports.LoadPeerTokenAnonymousByTruncatedReferenceRequest = exports.LoadPeerTokenAnonymousByIdAndKeyRequest = void 0;
6406
- exports.LoadPeerTokenViaSecretRequest = exports.LoadPeerTokenViaReferenceRequest = exports.GetTokensRequest = exports.GetTokenRequest = exports.GetQRCodeForTokenRequest = exports.CreateOwnTokenRequest = exports.LoadPeerRelationshipTemplateRequest = exports.LoadPeerRelationshipTemplateViaReferenceRequest = exports.LoadPeerRelationshipTemplateViaSecretRequest = exports.GetRelationshipTemplatesRequest = exports.GetRelationshipTemplateRequest = exports.CreateTokenQrCodeForOwnTemplateRequest = exports.CreateTokenForOwnTemplateRequest = exports.CreateQrCodeForOwnTemplateRequest = exports.CreateOwnRelationshipTemplateRequest = exports.RevokeRelationshipChangeRequest = exports.RejectRelationshipChangeRequest = exports.GetRelationshipsRequest = exports.GetRelationshipByAddressRequest = exports.GetRelationshipRequest = exports.GetAttributesForRelationshipRequest = exports.CreateRelationshipRequest = exports.AcceptRelationshipChangeRequest = exports.SendMessageRequest = exports.GetMessagesRequest = exports.GetMessageRequest = exports.GetAttachmentMetadataRequest = exports.CheckIdentityRequest = exports.UploadOwnFileValidatableRequest = exports.UploadOwnFileRequest = exports.GetOrLoadFileRequest = exports.GetOrLoadFileViaReferenceRequest = exports.GetOrLoadFileViaSecretRequest = exports.GetFilesRequest = exports.GetFileRequest = exports.CreateTokenQrCodeForFileRequest = exports.CreateTokenForFileRequest = exports.CreateQrCodeForFileRequest = exports.UpdateDeviceRequest = exports.GetDeviceOnboardingInfoRequest = exports.GetDeviceRequest = exports.DeleteDeviceRequest = exports.CreateDeviceOnboardingTokenRequest = exports.CreateDeviceRequest = exports.ValidateChallengeRequest = exports.CreateChallengeRequest = exports.CreateDeviceChallengeRequest = exports.CreateIdentityChallengeRequest = exports.CreateRelationshipChallengeRequest = exports.SyncEverythingRequest = void 0;
6407
- exports.LoadPeerTokenRequest = void 0;
6591
+ exports.UpdateSettingRequest = exports.GetSettingsRequest = exports.GetSettingByKeyRequest = exports.GetSettingRequest = exports.DeleteSettingRequest = exports.CreateSettingRequest = exports.SentNotificationRequest = exports.ReceivedNotificationRequest = exports.ProcessNotificationByIdRequest = exports.GetNotificationsRequest = exports.GetNotificationRequest = exports.UpdateDraftRequest = exports.GetDraftsRequest = exports.GetDraftRequest = exports.DeleteDraftRequest = exports.CreateDraftRequest = exports.ValidateIQLQueryRequest = exports.UpdateAttributeRequest = exports.SucceedAttributeRequest = exports.ShareAttributeRequest = exports.SentOutgoingRequestRequest = exports.RequireManualDecisionOfIncomingRequestRequest = exports.ReceivedIncomingRequestRequest = exports.GetOutgoingRequestsRequest = exports.GetOutgoingRequestRequest = exports.GetIncomingRequestsRequest = exports.GetIncomingRequestRequest = exports.DiscardOutgoingRequestRequest = exports.CreateOutgoingRequestRequest = exports.CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseRequest = exports.CompleteOutgoingRequestRequest = exports.CompleteIncomingRequestRequest = exports.CheckPrerequisitesOfIncomingRequestRequest = exports.RejectIncomingRequestRequest = exports.CanCreateOutgoingRequestRequest = exports.AcceptIncomingRequestRequest = exports.GetSharedToPeerAttributesRequest = exports.GetPeerAttributesRequest = exports.GetAttributesRequest = exports.GetAttributeRequest = exports.ExecuteThirdPartyRelationshipAttributeQueryRequest = exports.ExecuteRelationshipAttributeQueryRequest = exports.ExecuteIQLQueryRequest = exports.ExecuteIdentityAttributeQueryRequest = exports.DeleteAttributeRequest = exports.CreateSharedAttributeCopyRequest = exports.CreateAttributeRequest = exports.GetAttributeListenerRequest = exports.LoadPeerTokenAnonymousByTruncatedReferenceRequest = exports.LoadPeerTokenAnonymousByIdAndKeyRequest = void 0;
6592
+ exports.CreateOwnTokenRequest = exports.LoadPeerRelationshipTemplateRequest = exports.LoadPeerRelationshipTemplateViaReferenceRequest = exports.LoadPeerRelationshipTemplateViaSecretRequest = exports.GetRelationshipTemplatesRequest = exports.GetRelationshipTemplateRequest = exports.CreateTokenQrCodeForOwnTemplateRequest = exports.CreateTokenForOwnTemplateRequest = exports.CreateQrCodeForOwnTemplateRequest = exports.CreateOwnRelationshipTemplateRequest = exports.RevokeRelationshipChangeRequest = exports.RejectRelationshipChangeRequest = exports.GetRelationshipsRequest = exports.GetRelationshipByAddressRequest = exports.GetRelationshipRequest = exports.GetAttributesForRelationshipRequest = exports.CreateRelationshipRequest = exports.AcceptRelationshipChangeRequest = exports.SendMessageRequest = exports.GetMessagesRequest = exports.GetMessageRequest = exports.GetAttachmentMetadataRequest = exports.CheckIdentityRequest = exports.UploadOwnFileValidatableRequest = exports.UploadOwnFileRequest = exports.GetOrLoadFileRequest = exports.GetOrLoadFileViaReferenceRequest = exports.GetOrLoadFileViaSecretRequest = exports.GetFilesRequest = exports.GetFileRequest = exports.CreateTokenQrCodeForFileRequest = exports.CreateTokenForFileRequest = exports.CreateQrCodeForFileRequest = exports.UpdateDeviceRequest = exports.GetDeviceOnboardingInfoRequest = exports.GetDeviceRequest = exports.DeleteDeviceRequest = exports.CreateDeviceOnboardingTokenRequest = exports.CreateDeviceRequest = exports.ValidateChallengeRequest = exports.CreateChallengeRequest = exports.CreateDeviceChallengeRequest = exports.CreateIdentityChallengeRequest = exports.CreateRelationshipChallengeRequest = exports.SyncEverythingRequest = exports.DownloadAttachmentRequest = exports.SyncDatawalletRequest = exports.RegisterPushNotificationTokenRequest = exports.LoadItemFromTruncatedReferenceRequest = exports.DownloadFileRequest = void 0;
6593
+ exports.LoadPeerTokenRequest = exports.LoadPeerTokenViaSecretRequest = exports.LoadPeerTokenViaReferenceRequest = exports.GetTokensRequest = exports.GetTokenRequest = exports.GetQRCodeForTokenRequest = void 0;
6408
6594
  exports.LoadPeerTokenAnonymousByIdAndKeyRequest = {
6409
6595
  "$schema": "http://json-schema.org/draft-07/schema#",
6410
6596
  "$ref": "#/definitions/LoadPeerTokenAnonymousByIdAndKeyRequest",
@@ -29474,6 +29660,125 @@ exports.UpdateDraftRequest = {
29474
29660
  }
29475
29661
  }
29476
29662
  };
29663
+ exports.GetNotificationRequest = {
29664
+ "$schema": "http://json-schema.org/draft-07/schema#",
29665
+ "$ref": "#/definitions/GetNotificationRequest",
29666
+ "definitions": {
29667
+ "GetNotificationRequest": {
29668
+ "type": "object",
29669
+ "properties": {
29670
+ "id": {
29671
+ "$ref": "#/definitions/NotificationIdString"
29672
+ }
29673
+ },
29674
+ "required": [
29675
+ "id"
29676
+ ],
29677
+ "additionalProperties": false
29678
+ },
29679
+ "NotificationIdString": {
29680
+ "type": "string",
29681
+ "pattern": "NOT[A-Za-z0-9]{17}"
29682
+ }
29683
+ }
29684
+ };
29685
+ exports.GetNotificationsRequest = {
29686
+ "$schema": "http://json-schema.org/draft-07/schema#",
29687
+ "$ref": "#/definitions/GetNotificationsRequest",
29688
+ "definitions": {
29689
+ "GetNotificationsRequest": {
29690
+ "type": "object",
29691
+ "properties": {
29692
+ "query": {
29693
+ "$ref": "#/definitions/GetNotificationsRequestQuery"
29694
+ }
29695
+ },
29696
+ "additionalProperties": false
29697
+ },
29698
+ "GetNotificationsRequestQuery": {
29699
+ "type": "object",
29700
+ "additionalProperties": {
29701
+ "anyOf": [
29702
+ {
29703
+ "type": "string"
29704
+ },
29705
+ {
29706
+ "type": "array",
29707
+ "items": {
29708
+ "type": "string"
29709
+ }
29710
+ }
29711
+ ]
29712
+ }
29713
+ }
29714
+ }
29715
+ };
29716
+ exports.ProcessNotificationByIdRequest = {
29717
+ "$schema": "http://json-schema.org/draft-07/schema#",
29718
+ "$ref": "#/definitions/ProcessNotificationByIdRequest",
29719
+ "definitions": {
29720
+ "ProcessNotificationByIdRequest": {
29721
+ "type": "object",
29722
+ "properties": {
29723
+ "notificationId": {
29724
+ "$ref": "#/definitions/NotificationIdString"
29725
+ }
29726
+ },
29727
+ "required": [
29728
+ "notificationId"
29729
+ ],
29730
+ "additionalProperties": false
29731
+ },
29732
+ "NotificationIdString": {
29733
+ "type": "string",
29734
+ "pattern": "NOT[A-Za-z0-9]{17}"
29735
+ }
29736
+ }
29737
+ };
29738
+ exports.ReceivedNotificationRequest = {
29739
+ "$schema": "http://json-schema.org/draft-07/schema#",
29740
+ "$ref": "#/definitions/ReceivedNotificationRequest",
29741
+ "definitions": {
29742
+ "ReceivedNotificationRequest": {
29743
+ "type": "object",
29744
+ "properties": {
29745
+ "messageId": {
29746
+ "$ref": "#/definitions/MessageIdString"
29747
+ }
29748
+ },
29749
+ "required": [
29750
+ "messageId"
29751
+ ],
29752
+ "additionalProperties": false
29753
+ },
29754
+ "MessageIdString": {
29755
+ "type": "string",
29756
+ "pattern": "MSG[A-Za-z0-9]{17}"
29757
+ }
29758
+ }
29759
+ };
29760
+ exports.SentNotificationRequest = {
29761
+ "$schema": "http://json-schema.org/draft-07/schema#",
29762
+ "$ref": "#/definitions/SentNotificationRequest",
29763
+ "definitions": {
29764
+ "SentNotificationRequest": {
29765
+ "type": "object",
29766
+ "properties": {
29767
+ "messageId": {
29768
+ "$ref": "#/definitions/MessageIdString"
29769
+ }
29770
+ },
29771
+ "required": [
29772
+ "messageId"
29773
+ ],
29774
+ "additionalProperties": false
29775
+ },
29776
+ "MessageIdString": {
29777
+ "type": "string",
29778
+ "pattern": "MSG[A-Za-z0-9]{17}"
29779
+ }
29780
+ }
29781
+ };
29477
29782
  exports.CreateSettingRequest = {
29478
29783
  "$schema": "http://json-schema.org/draft-07/schema#",
29479
29784
  "$ref": "#/definitions/CreateSettingRequest",
@@ -33499,12 +33804,433 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
33499
33804
  __exportStar(__webpack_require__(/*! ./attributeListeners */ "./dist/useCases/consumption/attributeListeners/index.js"), exports);
33500
33805
  __exportStar(__webpack_require__(/*! ./attributes */ "./dist/useCases/consumption/attributes/index.js"), exports);
33501
33806
  __exportStar(__webpack_require__(/*! ./drafts */ "./dist/useCases/consumption/drafts/index.js"), exports);
33807
+ __exportStar(__webpack_require__(/*! ./notifications */ "./dist/useCases/consumption/notifications/index.js"), exports);
33502
33808
  __exportStar(__webpack_require__(/*! ./requests */ "./dist/useCases/consumption/requests/index.js"), exports);
33503
33809
  __exportStar(__webpack_require__(/*! ./settings */ "./dist/useCases/consumption/settings/index.js"), exports);
33504
33810
  //# sourceMappingURL=index.js.map
33505
33811
 
33506
33812
  /***/ }),
33507
33813
 
33814
+ /***/ "./dist/useCases/consumption/notifications/GetNotification.js":
33815
+ /*!********************************************************************!*\
33816
+ !*** ./dist/useCases/consumption/notifications/GetNotification.js ***!
33817
+ \********************************************************************/
33818
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
33819
+
33820
+ "use strict";
33821
+
33822
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
33823
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
33824
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
33825
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
33826
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
33827
+ };
33828
+ var __metadata = (this && this.__metadata) || function (k, v) {
33829
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33830
+ };
33831
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
33832
+ return function (target, key) { decorator(target, key, paramIndex); }
33833
+ };
33834
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
33835
+ exports.GetNotificationUseCase = void 0;
33836
+ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
33837
+ const consumption_1 = __webpack_require__(/*! @nmshd/consumption */ "@nmshd/consumption");
33838
+ const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
33839
+ const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
33840
+ const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
33841
+ const NotificationMapper_1 = __webpack_require__(/*! ./NotificationMapper */ "./dist/useCases/consumption/notifications/NotificationMapper.js");
33842
+ let Validator = class Validator extends common_1.SchemaValidator {
33843
+ constructor(schemaRepository) {
33844
+ super(schemaRepository.getSchema("GetNotificationRequest"));
33845
+ }
33846
+ };
33847
+ Validator = __decorate([
33848
+ __param(0, typescript_ioc_1.Inject),
33849
+ __metadata("design:paramtypes", [common_1.SchemaRepository])
33850
+ ], Validator);
33851
+ let GetNotificationUseCase = class GetNotificationUseCase extends common_1.UseCase {
33852
+ constructor(notificationsController, validator) {
33853
+ super(validator);
33854
+ this.notificationsController = notificationsController;
33855
+ }
33856
+ async executeInternal(request) {
33857
+ const notification = await this.notificationsController.getNotification(transport_1.CoreId.from(request.id));
33858
+ return ts_utils_1.Result.ok(NotificationMapper_1.NotificationMapper.toNotificationDTO(notification));
33859
+ }
33860
+ };
33861
+ exports.GetNotificationUseCase = GetNotificationUseCase;
33862
+ exports.GetNotificationUseCase = GetNotificationUseCase = __decorate([
33863
+ __param(0, typescript_ioc_1.Inject),
33864
+ __param(1, typescript_ioc_1.Inject),
33865
+ __metadata("design:paramtypes", [consumption_1.NotificationsController,
33866
+ Validator])
33867
+ ], GetNotificationUseCase);
33868
+ //# sourceMappingURL=GetNotification.js.map
33869
+
33870
+ /***/ }),
33871
+
33872
+ /***/ "./dist/useCases/consumption/notifications/GetNotifications.js":
33873
+ /*!*********************************************************************!*\
33874
+ !*** ./dist/useCases/consumption/notifications/GetNotifications.js ***!
33875
+ \*********************************************************************/
33876
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
33877
+
33878
+ "use strict";
33879
+
33880
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
33881
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
33882
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
33883
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
33884
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
33885
+ };
33886
+ var __metadata = (this && this.__metadata) || function (k, v) {
33887
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33888
+ };
33889
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
33890
+ return function (target, key) { decorator(target, key, paramIndex); }
33891
+ };
33892
+ var GetNotificationsUseCase_1;
33893
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
33894
+ exports.GetNotificationsUseCase = void 0;
33895
+ const docdb_querytranslator_1 = __webpack_require__(/*! @js-soft/docdb-querytranslator */ "./node_modules/@js-soft/docdb-querytranslator/dist/index.js");
33896
+ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
33897
+ const consumption_1 = __webpack_require__(/*! @nmshd/consumption */ "@nmshd/consumption");
33898
+ const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
33899
+ const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
33900
+ const NotificationMapper_1 = __webpack_require__(/*! ./NotificationMapper */ "./dist/useCases/consumption/notifications/NotificationMapper.js");
33901
+ let GetNotificationsUseCase = GetNotificationsUseCase_1 = class GetNotificationsUseCase extends common_1.UseCase {
33902
+ constructor(notificationsController) {
33903
+ super();
33904
+ this.notificationsController = notificationsController;
33905
+ }
33906
+ async executeInternal(request) {
33907
+ const dbQuery = GetNotificationsUseCase_1.queryTranslator.parse(request.query);
33908
+ const notifications = await this.notificationsController.getNotifications(dbQuery);
33909
+ return ts_utils_1.Result.ok(NotificationMapper_1.NotificationMapper.toNotificationDTOList(notifications));
33910
+ }
33911
+ };
33912
+ exports.GetNotificationsUseCase = GetNotificationsUseCase;
33913
+ GetNotificationsUseCase.queryTranslator = new docdb_querytranslator_1.QueryTranslator({});
33914
+ exports.GetNotificationsUseCase = GetNotificationsUseCase = GetNotificationsUseCase_1 = __decorate([
33915
+ __param(0, typescript_ioc_1.Inject),
33916
+ __metadata("design:paramtypes", [consumption_1.NotificationsController])
33917
+ ], GetNotificationsUseCase);
33918
+ //# sourceMappingURL=GetNotifications.js.map
33919
+
33920
+ /***/ }),
33921
+
33922
+ /***/ "./dist/useCases/consumption/notifications/NotificationMapper.js":
33923
+ /*!***********************************************************************!*\
33924
+ !*** ./dist/useCases/consumption/notifications/NotificationMapper.js ***!
33925
+ \***********************************************************************/
33926
+ /***/ ((__unused_webpack_module, exports) => {
33927
+
33928
+ "use strict";
33929
+
33930
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
33931
+ exports.NotificationMapper = void 0;
33932
+ class NotificationMapper {
33933
+ static toNotificationDTO(notification) {
33934
+ return {
33935
+ id: notification.id.toString(),
33936
+ isOwn: notification.isOwn,
33937
+ peer: notification.peer.toString(),
33938
+ createdAt: notification.createdAt.toISOString(),
33939
+ receivedByDevice: notification.receivedByDevice?.toString(),
33940
+ content: notification.content.toJSON(),
33941
+ status: notification.status,
33942
+ source: {
33943
+ type: "Message",
33944
+ reference: notification.source.reference.toString()
33945
+ }
33946
+ };
33947
+ }
33948
+ static toNotificationDTOList(notifications) {
33949
+ return notifications.map((notification) => this.toNotificationDTO(notification));
33950
+ }
33951
+ }
33952
+ exports.NotificationMapper = NotificationMapper;
33953
+ //# sourceMappingURL=NotificationMapper.js.map
33954
+
33955
+ /***/ }),
33956
+
33957
+ /***/ "./dist/useCases/consumption/notifications/ProcessNotificationById.js":
33958
+ /*!****************************************************************************!*\
33959
+ !*** ./dist/useCases/consumption/notifications/ProcessNotificationById.js ***!
33960
+ \****************************************************************************/
33961
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
33962
+
33963
+ "use strict";
33964
+
33965
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
33966
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
33967
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
33968
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
33969
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
33970
+ };
33971
+ var __metadata = (this && this.__metadata) || function (k, v) {
33972
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33973
+ };
33974
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
33975
+ return function (target, key) { decorator(target, key, paramIndex); }
33976
+ };
33977
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
33978
+ exports.ProcessNotificationByIdUseCase = void 0;
33979
+ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
33980
+ const consumption_1 = __webpack_require__(/*! @nmshd/consumption */ "@nmshd/consumption");
33981
+ const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
33982
+ const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
33983
+ const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
33984
+ const NotificationMapper_1 = __webpack_require__(/*! ./NotificationMapper */ "./dist/useCases/consumption/notifications/NotificationMapper.js");
33985
+ let Validator = class Validator extends common_1.SchemaValidator {
33986
+ constructor(schemaRepository) {
33987
+ super(schemaRepository.getSchema("ProcessNotificationByIdRequest"));
33988
+ }
33989
+ };
33990
+ Validator = __decorate([
33991
+ __param(0, typescript_ioc_1.Inject),
33992
+ __metadata("design:paramtypes", [common_1.SchemaRepository])
33993
+ ], Validator);
33994
+ let ProcessNotificationByIdUseCase = class ProcessNotificationByIdUseCase extends common_1.UseCase {
33995
+ constructor(notificationsController, validator) {
33996
+ super(validator);
33997
+ this.notificationsController = notificationsController;
33998
+ }
33999
+ async executeInternal(request) {
34000
+ const processedNotification = await this.notificationsController.processNotificationById(transport_1.CoreId.from(request.notificationId));
34001
+ const dto = NotificationMapper_1.NotificationMapper.toNotificationDTO(processedNotification);
34002
+ return ts_utils_1.Result.ok(dto);
34003
+ }
34004
+ };
34005
+ exports.ProcessNotificationByIdUseCase = ProcessNotificationByIdUseCase;
34006
+ exports.ProcessNotificationByIdUseCase = ProcessNotificationByIdUseCase = __decorate([
34007
+ __param(0, typescript_ioc_1.Inject),
34008
+ __param(1, typescript_ioc_1.Inject),
34009
+ __metadata("design:paramtypes", [consumption_1.NotificationsController,
34010
+ Validator])
34011
+ ], ProcessNotificationByIdUseCase);
34012
+ //# sourceMappingURL=ProcessNotificationById.js.map
34013
+
34014
+ /***/ }),
34015
+
34016
+ /***/ "./dist/useCases/consumption/notifications/ProcessOpenNotifactionsReceivedByCurrentDevice.js":
34017
+ /*!***************************************************************************************************!*\
34018
+ !*** ./dist/useCases/consumption/notifications/ProcessOpenNotifactionsReceivedByCurrentDevice.js ***!
34019
+ \***************************************************************************************************/
34020
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
34021
+
34022
+ "use strict";
34023
+
34024
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
34025
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
34026
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
34027
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
34028
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
34029
+ };
34030
+ var __metadata = (this && this.__metadata) || function (k, v) {
34031
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
34032
+ };
34033
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
34034
+ return function (target, key) { decorator(target, key, paramIndex); }
34035
+ };
34036
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
34037
+ exports.ProcessOpenNotifactionsReceivedByCurrentDeviceUseCase = void 0;
34038
+ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
34039
+ const consumption_1 = __webpack_require__(/*! @nmshd/consumption */ "@nmshd/consumption");
34040
+ const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
34041
+ const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
34042
+ let ProcessOpenNotifactionsReceivedByCurrentDeviceUseCase = class ProcessOpenNotifactionsReceivedByCurrentDeviceUseCase extends common_1.UseCase {
34043
+ constructor(notificationsController) {
34044
+ super();
34045
+ this.notificationsController = notificationsController;
34046
+ }
34047
+ async executeInternal() {
34048
+ await this.notificationsController.processOpenNotifactionsReceivedByCurrentDevice();
34049
+ return ts_utils_1.Result.ok(undefined);
34050
+ }
34051
+ };
34052
+ exports.ProcessOpenNotifactionsReceivedByCurrentDeviceUseCase = ProcessOpenNotifactionsReceivedByCurrentDeviceUseCase;
34053
+ exports.ProcessOpenNotifactionsReceivedByCurrentDeviceUseCase = ProcessOpenNotifactionsReceivedByCurrentDeviceUseCase = __decorate([
34054
+ __param(0, typescript_ioc_1.Inject),
34055
+ __metadata("design:paramtypes", [consumption_1.NotificationsController])
34056
+ ], ProcessOpenNotifactionsReceivedByCurrentDeviceUseCase);
34057
+ //# sourceMappingURL=ProcessOpenNotifactionsReceivedByCurrentDevice.js.map
34058
+
34059
+ /***/ }),
34060
+
34061
+ /***/ "./dist/useCases/consumption/notifications/ReceivedNotification.js":
34062
+ /*!*************************************************************************!*\
34063
+ !*** ./dist/useCases/consumption/notifications/ReceivedNotification.js ***!
34064
+ \*************************************************************************/
34065
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
34066
+
34067
+ "use strict";
34068
+
34069
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
34070
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
34071
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
34072
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
34073
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
34074
+ };
34075
+ var __metadata = (this && this.__metadata) || function (k, v) {
34076
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
34077
+ };
34078
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
34079
+ return function (target, key) { decorator(target, key, paramIndex); }
34080
+ };
34081
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
34082
+ exports.ReceivedNotificationUseCase = void 0;
34083
+ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
34084
+ const consumption_1 = __webpack_require__(/*! @nmshd/consumption */ "@nmshd/consumption");
34085
+ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
34086
+ const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
34087
+ const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
34088
+ const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
34089
+ const NotificationMapper_1 = __webpack_require__(/*! ./NotificationMapper */ "./dist/useCases/consumption/notifications/NotificationMapper.js");
34090
+ let Validator = class Validator extends common_1.SchemaValidator {
34091
+ constructor(schemaRepository) {
34092
+ super(schemaRepository.getSchema("ReceivedNotificationRequest"));
34093
+ }
34094
+ };
34095
+ Validator = __decorate([
34096
+ __param(0, typescript_ioc_1.Inject),
34097
+ __metadata("design:paramtypes", [common_1.SchemaRepository])
34098
+ ], Validator);
34099
+ let ReceivedNotificationUseCase = class ReceivedNotificationUseCase extends common_1.UseCase {
34100
+ constructor(notificationsController, messageController, validator) {
34101
+ super(validator);
34102
+ this.notificationsController = notificationsController;
34103
+ this.messageController = messageController;
34104
+ }
34105
+ async executeInternal(request) {
34106
+ const message = await this.messageController.getMessage(transport_1.CoreId.from(request.messageId));
34107
+ if (!message)
34108
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.recordNotFound(transport_1.Message));
34109
+ if (!(message.cache.content instanceof content_1.Notification))
34110
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.notifications.messageDoesNotContainNotification(message.id));
34111
+ if (message.isOwn)
34112
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.notifications.cannotReceiveNotificationFromOwnMessage());
34113
+ const notification = await this.notificationsController.received(message);
34114
+ const dto = NotificationMapper_1.NotificationMapper.toNotificationDTO(notification);
34115
+ return ts_utils_1.Result.ok(dto);
34116
+ }
34117
+ };
34118
+ exports.ReceivedNotificationUseCase = ReceivedNotificationUseCase;
34119
+ exports.ReceivedNotificationUseCase = ReceivedNotificationUseCase = __decorate([
34120
+ __param(0, typescript_ioc_1.Inject),
34121
+ __param(1, typescript_ioc_1.Inject),
34122
+ __param(2, typescript_ioc_1.Inject),
34123
+ __metadata("design:paramtypes", [consumption_1.NotificationsController,
34124
+ transport_1.MessageController,
34125
+ Validator])
34126
+ ], ReceivedNotificationUseCase);
34127
+ //# sourceMappingURL=ReceivedNotification.js.map
34128
+
34129
+ /***/ }),
34130
+
34131
+ /***/ "./dist/useCases/consumption/notifications/SentNotification.js":
34132
+ /*!*********************************************************************!*\
34133
+ !*** ./dist/useCases/consumption/notifications/SentNotification.js ***!
34134
+ \*********************************************************************/
34135
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
34136
+
34137
+ "use strict";
34138
+
34139
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
34140
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
34141
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
34142
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
34143
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
34144
+ };
34145
+ var __metadata = (this && this.__metadata) || function (k, v) {
34146
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
34147
+ };
34148
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
34149
+ return function (target, key) { decorator(target, key, paramIndex); }
34150
+ };
34151
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
34152
+ exports.SentNotificationUseCase = void 0;
34153
+ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
34154
+ const consumption_1 = __webpack_require__(/*! @nmshd/consumption */ "@nmshd/consumption");
34155
+ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
34156
+ const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
34157
+ const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
34158
+ const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
34159
+ const NotificationMapper_1 = __webpack_require__(/*! ./NotificationMapper */ "./dist/useCases/consumption/notifications/NotificationMapper.js");
34160
+ let Validator = class Validator extends common_1.SchemaValidator {
34161
+ constructor(schemaRepository) {
34162
+ super(schemaRepository.getSchema("SentNotificationRequest"));
34163
+ }
34164
+ };
34165
+ Validator = __decorate([
34166
+ __param(0, typescript_ioc_1.Inject),
34167
+ __metadata("design:paramtypes", [common_1.SchemaRepository])
34168
+ ], Validator);
34169
+ let SentNotificationUseCase = class SentNotificationUseCase extends common_1.UseCase {
34170
+ constructor(notificationsController, messageController, validator) {
34171
+ super(validator);
34172
+ this.notificationsController = notificationsController;
34173
+ this.messageController = messageController;
34174
+ }
34175
+ async executeInternal(request) {
34176
+ const message = await this.messageController.getMessage(transport_1.CoreId.from(request.messageId));
34177
+ if (!message)
34178
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.recordNotFound(transport_1.Message));
34179
+ if (!(message.cache.content instanceof content_1.Notification))
34180
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.notifications.messageDoesNotContainNotification(message.id));
34181
+ if (!message.isOwn)
34182
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.notifications.cannotSaveSentNotificationFromPeerMessage());
34183
+ const notification = await this.notificationsController.sent(message);
34184
+ const dto = NotificationMapper_1.NotificationMapper.toNotificationDTO(notification);
34185
+ return ts_utils_1.Result.ok(dto);
34186
+ }
34187
+ };
34188
+ exports.SentNotificationUseCase = SentNotificationUseCase;
34189
+ exports.SentNotificationUseCase = SentNotificationUseCase = __decorate([
34190
+ __param(0, typescript_ioc_1.Inject),
34191
+ __param(1, typescript_ioc_1.Inject),
34192
+ __param(2, typescript_ioc_1.Inject),
34193
+ __metadata("design:paramtypes", [consumption_1.NotificationsController,
34194
+ transport_1.MessageController,
34195
+ Validator])
34196
+ ], SentNotificationUseCase);
34197
+ //# sourceMappingURL=SentNotification.js.map
34198
+
34199
+ /***/ }),
34200
+
34201
+ /***/ "./dist/useCases/consumption/notifications/index.js":
34202
+ /*!**********************************************************!*\
34203
+ !*** ./dist/useCases/consumption/notifications/index.js ***!
34204
+ \**********************************************************/
34205
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
34206
+
34207
+ "use strict";
34208
+
34209
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
34210
+ if (k2 === undefined) k2 = k;
34211
+ var desc = Object.getOwnPropertyDescriptor(m, k);
34212
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
34213
+ desc = { enumerable: true, get: function() { return m[k]; } };
34214
+ }
34215
+ Object.defineProperty(o, k2, desc);
34216
+ }) : (function(o, m, k, k2) {
34217
+ if (k2 === undefined) k2 = k;
34218
+ o[k2] = m[k];
34219
+ }));
34220
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
34221
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
34222
+ };
34223
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
34224
+ __exportStar(__webpack_require__(/*! ./GetNotification */ "./dist/useCases/consumption/notifications/GetNotification.js"), exports);
34225
+ __exportStar(__webpack_require__(/*! ./GetNotifications */ "./dist/useCases/consumption/notifications/GetNotifications.js"), exports);
34226
+ __exportStar(__webpack_require__(/*! ./ProcessNotificationById */ "./dist/useCases/consumption/notifications/ProcessNotificationById.js"), exports);
34227
+ __exportStar(__webpack_require__(/*! ./ProcessOpenNotifactionsReceivedByCurrentDevice */ "./dist/useCases/consumption/notifications/ProcessOpenNotifactionsReceivedByCurrentDevice.js"), exports);
34228
+ __exportStar(__webpack_require__(/*! ./ReceivedNotification */ "./dist/useCases/consumption/notifications/ReceivedNotification.js"), exports);
34229
+ __exportStar(__webpack_require__(/*! ./SentNotification */ "./dist/useCases/consumption/notifications/SentNotification.js"), exports);
34230
+ //# sourceMappingURL=index.js.map
34231
+
34232
+ /***/ }),
34233
+
33508
34234
  /***/ "./dist/useCases/consumption/requests/AcceptIncomingRequest.js":
33509
34235
  /*!*********************************************************************!*\
33510
34236
  !*** ./dist/useCases/consumption/requests/AcceptIncomingRequest.js ***!
@@ -37706,7 +38432,7 @@ let GetAttachmentMetadataUseCase = class GetAttachmentMetadataUseCase extends co
37706
38432
  }
37707
38433
  const file = await this.fileController.getFile(attachment);
37708
38434
  if (!file) {
37709
- return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.recordNotFound(File));
38435
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.recordNotFound(transport_1.File));
37710
38436
  }
37711
38437
  return ts_utils_1.Result.ok(FileMapper_1.FileMapper.toFileDTO(file));
37712
38438
  }