@nmshd/consumption 3.3.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildInformation.js +5 -5
- package/dist/consumption/ConsumptionBaseController.js.map +1 -1
- package/dist/consumption/ConsumptionController.d.ts +6 -3
- package/dist/consumption/ConsumptionController.js +19 -6
- package/dist/consumption/ConsumptionController.js.map +1 -1
- package/dist/consumption/ConsumptionControllerName.d.ts +2 -1
- package/dist/consumption/ConsumptionControllerName.js +2 -1
- package/dist/consumption/ConsumptionControllerName.js.map +1 -1
- package/dist/consumption/ConsumptionIds.d.ts +1 -0
- package/dist/consumption/ConsumptionIds.js +1 -0
- package/dist/consumption/ConsumptionIds.js.map +1 -1
- package/dist/consumption/CoreErrors.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/attributeListeners/AttributeListenersController.js +2 -2
- package/dist/modules/attributeListeners/AttributeListenersController.js.map +1 -1
- package/dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.js +2 -2
- package/dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.js.map +1 -1
- package/dist/modules/attributeListeners/local/LocalAttributeListener.js +2 -2
- package/dist/modules/attributeListeners/local/LocalAttributeListener.js.map +1 -1
- package/dist/modules/attributes/AttributesController.d.ts +1 -1
- package/dist/modules/attributes/AttributesController.js +11 -7
- package/dist/modules/attributes/AttributesController.js.map +1 -1
- package/dist/modules/attributes/local/CreateAttributeParams.js +2 -2
- package/dist/modules/attributes/local/CreateAttributeParams.js.map +1 -1
- package/dist/modules/attributes/local/CreateLocalAttributeParams.js +1 -1
- package/dist/modules/attributes/local/CreateLocalAttributeParams.js.map +1 -1
- package/dist/modules/attributes/local/CreatePeerLocalAttributeParams.js +1 -1
- package/dist/modules/attributes/local/CreatePeerLocalAttributeParams.js.map +1 -1
- package/dist/modules/attributes/local/CreateSharedLocalAttributeCopyParams.js +1 -1
- package/dist/modules/attributes/local/CreateSharedLocalAttributeCopyParams.js.map +1 -1
- package/dist/modules/attributes/local/LocalAttribute.d.ts +1 -1
- package/dist/modules/attributes/local/LocalAttribute.js +4 -4
- package/dist/modules/attributes/local/LocalAttribute.js.map +1 -1
- package/dist/modules/attributes/local/LocalAttributeShareInfo.js +1 -1
- package/dist/modules/attributes/local/LocalAttributeShareInfo.js.map +1 -1
- package/dist/modules/attributes/local/QueryTranslator.js +2 -2
- package/dist/modules/attributes/local/QueryTranslator.js.map +1 -1
- package/dist/modules/attributes/local/SucceedLocalAttributeParams.js +1 -1
- package/dist/modules/attributes/local/SucceedLocalAttributeParams.js.map +1 -1
- package/dist/modules/attributes/local/UpdateLocalAttributeParams.js +1 -1
- package/dist/modules/attributes/local/UpdateLocalAttributeParams.js.map +1 -1
- package/dist/modules/drafts/DraftsController.d.ts +1 -1
- package/dist/modules/drafts/DraftsController.js +8 -5
- package/dist/modules/drafts/DraftsController.js.map +1 -1
- package/dist/modules/drafts/local/Draft.js +2 -2
- package/dist/modules/drafts/local/Draft.js.map +1 -1
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/notifications/NotificationsController.d.ts +20 -0
- package/dist/modules/notifications/NotificationsController.js +115 -0
- package/dist/modules/notifications/NotificationsController.js.map +1 -0
- package/dist/modules/notifications/index.d.ts +8 -0
- package/dist/{consumption → modules/notifications}/index.js +8 -5
- package/dist/modules/notifications/index.js.map +1 -0
- package/dist/modules/notifications/itemProcessors/AbstractNotificationItemProcessor.d.ts +26 -0
- package/dist/modules/notifications/itemProcessors/AbstractNotificationItemProcessor.js +12 -0
- package/dist/modules/notifications/itemProcessors/AbstractNotificationItemProcessor.js.map +1 -0
- package/dist/modules/notifications/itemProcessors/NotificationItemConstructor.d.ts +2 -0
- package/dist/modules/{requests/itemProcessors/ProcessorConstructor.js → notifications/itemProcessors/NotificationItemConstructor.js} +1 -1
- package/dist/modules/notifications/itemProcessors/NotificationItemConstructor.js.map +1 -0
- package/dist/modules/notifications/itemProcessors/NotificationItemProcessorConstructor.d.ts +3 -0
- package/dist/modules/notifications/itemProcessors/NotificationItemProcessorConstructor.js +3 -0
- package/dist/modules/notifications/itemProcessors/NotificationItemProcessorConstructor.js.map +1 -0
- package/dist/modules/notifications/itemProcessors/NotificationItemProcessorRegistry.d.ts +13 -0
- package/dist/modules/notifications/itemProcessors/NotificationItemProcessorRegistry.js +28 -0
- package/dist/modules/notifications/itemProcessors/NotificationItemProcessorRegistry.js.map +1 -0
- package/dist/modules/notifications/itemProcessors/attributeSucceeded/AttributeSucceededNotificationItemProcessor.d.ts +8 -0
- package/dist/modules/notifications/itemProcessors/attributeSucceeded/AttributeSucceededNotificationItemProcessor.js +18 -0
- package/dist/modules/notifications/itemProcessors/attributeSucceeded/AttributeSucceededNotificationItemProcessor.js.map +1 -0
- package/dist/modules/notifications/local/LocalNotification.d.ts +32 -0
- package/dist/modules/notifications/local/LocalNotification.js +97 -0
- package/dist/modules/notifications/local/LocalNotification.js.map +1 -0
- package/dist/modules/notifications/local/LocalNotificationSource.d.ts +11 -0
- package/dist/modules/notifications/local/LocalNotificationSource.js +41 -0
- package/dist/modules/notifications/local/LocalNotificationSource.js.map +1 -0
- package/dist/modules/requests/events/IncomingRequestReceivedEvent.js +2 -2
- package/dist/modules/requests/events/IncomingRequestReceivedEvent.js.map +1 -1
- package/dist/modules/requests/events/IncomingRequestStatusChangedEvent.js +2 -2
- package/dist/modules/requests/events/IncomingRequestStatusChangedEvent.js.map +1 -1
- package/dist/modules/requests/events/OutgoingRequestCreatedAndCompletedEvent.js +2 -2
- package/dist/modules/requests/events/OutgoingRequestCreatedAndCompletedEvent.js.map +1 -1
- package/dist/modules/requests/events/OutgoingRequestCreatedEvent.js +2 -2
- package/dist/modules/requests/events/OutgoingRequestCreatedEvent.js.map +1 -1
- package/dist/modules/requests/events/OutgoingRequestStatusChangedEvent.js +2 -2
- package/dist/modules/requests/events/OutgoingRequestStatusChangedEvent.js.map +1 -1
- package/dist/modules/requests/incoming/DecideRequestParametersValidator.js +9 -9
- package/dist/modules/requests/incoming/DecideRequestParametersValidator.js.map +1 -1
- package/dist/modules/requests/incoming/IncomingRequestsController.d.ts +1 -1
- package/dist/modules/requests/incoming/IncomingRequestsController.js +19 -15
- package/dist/modules/requests/incoming/IncomingRequestsController.js.map +1 -1
- package/dist/modules/requests/incoming/checkPrerequisites/CheckPrerequisitesOfIncomingRequestParameters.js +2 -2
- package/dist/modules/requests/incoming/checkPrerequisites/CheckPrerequisitesOfIncomingRequestParameters.js.map +1 -1
- package/dist/modules/requests/incoming/complete/CompleteIncomingRequestParameters.js +1 -1
- package/dist/modules/requests/incoming/complete/CompleteIncomingRequestParameters.js.map +1 -1
- package/dist/modules/requests/incoming/decide/InternalDecideRequestParameters.js +2 -2
- package/dist/modules/requests/incoming/decide/InternalDecideRequestParameters.js.map +1 -1
- package/dist/modules/requests/incoming/received/ReceivedIncomingRequestParameters.js +2 -2
- package/dist/modules/requests/incoming/received/ReceivedIncomingRequestParameters.js.map +1 -1
- package/dist/modules/requests/incoming/requireManualDecision/RequireManualDecisionOfIncomingRequestParameters.js +1 -1
- package/dist/modules/requests/incoming/requireManualDecision/RequireManualDecisionOfIncomingRequestParameters.js.map +1 -1
- package/dist/modules/requests/index.d.ts +9 -9
- package/dist/modules/requests/index.js +9 -9
- package/dist/modules/requests/index.js.map +1 -1
- package/dist/modules/requests/itemProcessors/{ProcessorConstructor.d.ts → RequestItemProcessorConstructor.d.ts} +1 -1
- package/dist/modules/requests/itemProcessors/RequestItemProcessorConstructor.js +3 -0
- package/dist/modules/requests/itemProcessors/RequestItemProcessorConstructor.js.map +1 -0
- package/dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.d.ts +4 -4
- package/dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.js +3 -3
- package/dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.js.map +1 -1
- package/dist/modules/requests/itemProcessors/ValidationResult.js.map +1 -1
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js +4 -4
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.js +2 -2
- package/dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.js.map +1 -1
- package/dist/modules/requests/itemProcessors/freeText/FreeTextRequestItemProcessor.js +2 -2
- package/dist/modules/requests/itemProcessors/freeText/FreeTextRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js +4 -4
- package/dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js.map +1 -1
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js +5 -5
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js +4 -4
- package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js.map +1 -1
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js +3 -3
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js +6 -6
- package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/utility/validateQuery.js +5 -5
- package/dist/modules/requests/itemProcessors/utility/validateQuery.js.map +1 -1
- package/dist/modules/requests/local/LocalRequest.js +7 -7
- package/dist/modules/requests/local/LocalRequest.js.map +1 -1
- package/dist/modules/requests/local/LocalRequestStatus.js +1 -1
- package/dist/modules/requests/local/LocalRequestStatus.js.map +1 -1
- package/dist/modules/requests/local/LocalRequestStatusLogEntry.js +2 -2
- package/dist/modules/requests/local/LocalRequestStatusLogEntry.js.map +1 -1
- package/dist/modules/requests/local/LocalResponse.js +4 -4
- package/dist/modules/requests/local/LocalResponse.js.map +1 -1
- package/dist/modules/requests/outgoing/OutgoingRequestsController.d.ts +1 -1
- package/dist/modules/requests/outgoing/OutgoingRequestsController.js +14 -11
- package/dist/modules/requests/outgoing/OutgoingRequestsController.js.map +1 -1
- package/dist/modules/requests/outgoing/completeOutgoingRequest/CompleteOutgoingRequestParameters.js +2 -2
- package/dist/modules/requests/outgoing/completeOutgoingRequest/CompleteOutgoingRequestParameters.js.map +1 -1
- package/dist/modules/requests/outgoing/createAndCompleteFromRelationshipTemplateResponse/CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseParameters.js +2 -2
- package/dist/modules/requests/outgoing/createAndCompleteFromRelationshipTemplateResponse/CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseParameters.js.map +1 -1
- package/dist/modules/requests/outgoing/createOutgoingRequest/CanCreateOutgoingRequestParameters.js +2 -2
- package/dist/modules/requests/outgoing/createOutgoingRequest/CanCreateOutgoingRequestParameters.js.map +1 -1
- package/dist/modules/requests/outgoing/createOutgoingRequest/CreateOutgoingRequestParameters.js +2 -2
- package/dist/modules/requests/outgoing/createOutgoingRequest/CreateOutgoingRequestParameters.js.map +1 -1
- package/dist/modules/requests/outgoing/sentOutgoingRequest/SentOutgoingRequestParameters.js +2 -2
- package/dist/modules/requests/outgoing/sentOutgoingRequest/SentOutgoingRequestParameters.js.map +1 -1
- package/dist/modules/settings/SettingsController.d.ts +1 -1
- package/dist/modules/settings/SettingsController.js +7 -5
- package/dist/modules/settings/SettingsController.js.map +1 -1
- package/dist/modules/settings/local/Setting.js +3 -3
- package/dist/modules/settings/local/Setting.js.map +1 -1
- package/lib-web/nmshd.consumption.js +878 -315
- package/lib-web/nmshd.consumption.js.map +1 -1
- package/lib-web/nmshd.consumption.min.js +1 -1
- package/lib-web/nmshd.consumption.min.js.map +1 -1
- package/package.json +23 -22
- package/dist/consumption/index.d.ts +0 -5
- package/dist/consumption/index.js.map +0 -1
- package/dist/modules/requests/itemProcessors/ProcessorConstructor.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryTranslator.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/QueryTranslator.ts"],"names":[],"mappings":";;;AAAA,0EAAgE;AAahE,iCAAgC;AAChC,uDAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"QueryTranslator.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/QueryTranslator.ts"],"names":[],"mappings":";;;AAAA,0EAAgE;AAahE,iCAAgC;AAChC,uDAAyC;AACzC,4EAAwE;AAIxE,MAAa,gCAAgC;IAClC,MAAM,CAAC,SAAS,CAAC,KAA6B;QACjD,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,mBAAmB,EAAE,CAAC,CAAA;IAC3F,CAAC;;AAHL,4EAgEC;AA3D2B,2CAAU,GAAG,IAAI,uCAAe,CAAC;IACrD,SAAS,EAAE;QACP,CAAC,IAAA,yBAAM,EAA0B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI;QACtD,CAAC,IAAA,yBAAM,EAA0B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI;QAC3D,CAAC,IAAA,yBAAM,EAA0B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI;QAC3D,CAAC,IAAA,yBAAM,EAA0B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI;QACzD,aAAa,EAAE,IAAI;KACtB;IACD,KAAK,EAAE;QACH,0BAA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AE,EAAE;YAC1F,IAAI,CAAC,KAAK,EAAE;gBACR,OAAM;aACT;YACD,MAAM,gBAAgB,GAAG,gBAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAA;YACnE,KAAK,CACD,GAAG,IAAA,yBAAM,EAAiB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,IAAA,yBAAM,EAAwB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CACnG,GAAG;gBACA,IAAI,EAAE,gBAAgB;aACzB,CAAA;QACL,CAAC;KACJ;CACJ,CAAC,CAAA"}
|
|
@@ -18,6 +18,7 @@ class SucceedLocalAttributeParams extends ts_serval_1.Serializable {
|
|
|
18
18
|
return this.fromAny(value);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
exports.SucceedLocalAttributeParams = SucceedLocalAttributeParams;
|
|
21
22
|
__decorate([
|
|
22
23
|
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
23
24
|
(0, ts_serval_1.validate)(),
|
|
@@ -28,5 +29,4 @@ __decorate([
|
|
|
28
29
|
(0, ts_serval_1.validate)(),
|
|
29
30
|
__metadata("design:type", transport_1.CoreId)
|
|
30
31
|
], SucceedLocalAttributeParams.prototype, "succeeds", void 0);
|
|
31
|
-
exports.SucceedLocalAttributeParams = SucceedLocalAttributeParams;
|
|
32
32
|
//# sourceMappingURL=SucceedLocalAttributeParams.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SucceedLocalAttributeParams.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/SucceedLocalAttributeParams.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAqF;AACrF,4CAOuB;AACvB,gDAAkD;AAYlD,MAAa,2BAA4B,SAAQ,wBAAY;IASlD,MAAM,CAAC,IAAI,CACd,KAAqE;QAErE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;CACJ;
|
|
1
|
+
{"version":3,"file":"SucceedLocalAttributeParams.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/SucceedLocalAttributeParams.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAqF;AACrF,4CAOuB;AACvB,gDAAkD;AAYlD,MAAa,2BAA4B,SAAQ,wBAAY;IASlD,MAAM,CAAC,IAAI,CACd,KAAqE;QAErE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;CACJ;AAdD,kEAcC;AAXU;IAFN,IAAA,qBAAS,EAAC,EAAE,UAAU,EAAE,CAAC,2BAAiB,EAAE,+BAAqB,CAAC,EAAE,CAAC;IACrE,IAAA,oBAAQ,GAAE;;qEACuD;AAI3D;IAFN,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACM,kBAAM;6DAAA"}
|
|
@@ -18,6 +18,7 @@ class UpdateLocalAttributeParams extends ts_serval_1.Serializable {
|
|
|
18
18
|
return this.fromAny(value);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
exports.UpdateLocalAttributeParams = UpdateLocalAttributeParams;
|
|
21
22
|
__decorate([
|
|
22
23
|
(0, ts_serval_1.serialize)(),
|
|
23
24
|
(0, ts_serval_1.validate)(),
|
|
@@ -28,5 +29,4 @@ __decorate([
|
|
|
28
29
|
(0, ts_serval_1.validate)(),
|
|
29
30
|
__metadata("design:type", Object)
|
|
30
31
|
], UpdateLocalAttributeParams.prototype, "content", void 0);
|
|
31
|
-
exports.UpdateLocalAttributeParams = UpdateLocalAttributeParams;
|
|
32
32
|
//# sourceMappingURL=UpdateLocalAttributeParams.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateLocalAttributeParams.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/UpdateLocalAttributeParams.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAqF;AACrF,4CAOuB;AACvB,gDAAkD;AAYlD,MAAa,0BAA2B,SAAQ,wBAAY;IASjD,MAAM,CAAC,IAAI,CACd,KAAmE;QAEnE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;CACJ;
|
|
1
|
+
{"version":3,"file":"UpdateLocalAttributeParams.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/UpdateLocalAttributeParams.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAqF;AACrF,4CAOuB;AACvB,gDAAkD;AAYlD,MAAa,0BAA2B,SAAQ,wBAAY;IASjD,MAAM,CAAC,IAAI,CACd,KAAmE;QAEnE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;CACJ;AAdD,gEAcC;AAXU;IAFN,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACA,kBAAM;sDAAA;AAIV;IAFN,IAAA,qBAAS,EAAC,EAAE,UAAU,EAAE,CAAC,2BAAiB,EAAE,+BAAqB,CAAC,EAAE,CAAC;IACrE,IAAA,oBAAQ,GAAE;;2DAC8C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Serializable } from "@js-soft/ts-serval";
|
|
2
2
|
import { CoreId } from "@nmshd/transport";
|
|
3
|
-
import { ConsumptionBaseController } from "../../consumption";
|
|
3
|
+
import { ConsumptionBaseController } from "../../consumption/ConsumptionBaseController";
|
|
4
4
|
import { ConsumptionController } from "../../consumption/ConsumptionController";
|
|
5
5
|
import { Draft } from "./local/Draft";
|
|
6
6
|
export declare class DraftsController extends ConsumptionBaseController {
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DraftsController = void 0;
|
|
4
4
|
const transport_1 = require("@nmshd/transport");
|
|
5
|
-
const
|
|
5
|
+
const ConsumptionBaseController_1 = require("../../consumption/ConsumptionBaseController");
|
|
6
|
+
const ConsumptionControllerName_1 = require("../../consumption/ConsumptionControllerName");
|
|
7
|
+
const ConsumptionError_1 = require("../../consumption/ConsumptionError");
|
|
8
|
+
const ConsumptionIds_1 = require("../../consumption/ConsumptionIds");
|
|
6
9
|
const Draft_1 = require("./local/Draft");
|
|
7
|
-
class DraftsController extends
|
|
10
|
+
class DraftsController extends ConsumptionBaseController_1.ConsumptionBaseController {
|
|
8
11
|
constructor(parent) {
|
|
9
|
-
super(
|
|
12
|
+
super(ConsumptionControllerName_1.ConsumptionControllerName.DraftsController, parent);
|
|
10
13
|
}
|
|
11
14
|
async init() {
|
|
12
15
|
await super.init();
|
|
@@ -23,7 +26,7 @@ class DraftsController extends consumption_1.ConsumptionBaseController {
|
|
|
23
26
|
}
|
|
24
27
|
async createDraft(content, type = "") {
|
|
25
28
|
const draft = Draft_1.Draft.from({
|
|
26
|
-
id: await
|
|
29
|
+
id: await ConsumptionIds_1.ConsumptionIds.draft.generate(),
|
|
27
30
|
content,
|
|
28
31
|
createdAt: new transport_1.CoreDate(),
|
|
29
32
|
lastModifiedAt: new transport_1.CoreDate(),
|
|
@@ -35,7 +38,7 @@ class DraftsController extends consumption_1.ConsumptionBaseController {
|
|
|
35
38
|
async updateDraft(draft) {
|
|
36
39
|
const oldDraft = await this.drafts.read(draft.id.toString());
|
|
37
40
|
if (!oldDraft) {
|
|
38
|
-
throw new
|
|
41
|
+
throw new ConsumptionError_1.ConsumptionError("Draft Not Found");
|
|
39
42
|
}
|
|
40
43
|
await this.drafts.update(oldDraft, draft);
|
|
41
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DraftsController.js","sourceRoot":"","sources":["../../../src/modules/drafts/DraftsController.ts"],"names":[],"mappings":";;;AACA,gDAA2E;AAC3E,
|
|
1
|
+
{"version":3,"file":"DraftsController.js","sourceRoot":"","sources":["../../../src/modules/drafts/DraftsController.ts"],"names":[],"mappings":";;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AM,CAAC,KAAK,CAAC,CAAA;QAC/B,OAAO,KAAK,CAAA;IAChB,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,KAAY;QACjC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAA;QAC5D,IAAI,CAAC,QAAQ,EAAE;YACX,MAAM,IAAI,mCAAgB,CAAC,iBAAiB,CAAC,CAAA;SAChD;QACD,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAC7C,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,KAAY;QACjC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACnC,CAAC;CACJ;AA/CD,4CA+CC"}
|
|
@@ -33,6 +33,7 @@ let Draft = class Draft extends transport_1.CoreSynchronizable {
|
|
|
33
33
|
return this.fromAny(value);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
+
exports.Draft = Draft;
|
|
36
37
|
__decorate([
|
|
37
38
|
(0, ts_serval_1.validate)(),
|
|
38
39
|
(0, ts_serval_1.serialize)(),
|
|
@@ -63,8 +64,7 @@ __decorate([
|
|
|
63
64
|
(0, ts_serval_1.serialize)(),
|
|
64
65
|
__metadata("design:type", transport_1.CoreDate)
|
|
65
66
|
], Draft.prototype, "metadataModifiedAt", void 0);
|
|
66
|
-
Draft = __decorate([
|
|
67
|
+
exports.Draft = Draft = __decorate([
|
|
67
68
|
(0, ts_serval_1.type)("Draft")
|
|
68
69
|
], Draft);
|
|
69
|
-
exports.Draft = Draft;
|
|
70
70
|
//# sourceMappingURL=Draft.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Draft.js","sourceRoot":"","sources":["../../../../src/modules/drafts/local/Draft.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA2F;AAC3F,gDAA+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.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./attributeListeners"), exports);
|
|
18
18
|
__exportStar(require("./attributes"), exports);
|
|
19
19
|
__exportStar(require("./drafts"), exports);
|
|
20
|
+
__exportStar(require("./notifications"), exports);
|
|
20
21
|
__exportStar(require("./requests"), exports);
|
|
21
22
|
__exportStar(require("./settings"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC;AACpC,+CAA4B;AAC5B,2CAAwB;AACxB,6CAA0B;AAC1B,6CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC;AACpC,+CAA4B;AAC5B,2CAAwB;AACxB,kDAA+B;AAC/B,6CAA0B;AAC1B,6CAA0B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EventBus } from "@js-soft/ts-utils";
|
|
2
|
+
import { CoreId, Message, SynchronizedCollection } from "@nmshd/transport";
|
|
3
|
+
import { ConsumptionBaseController } from "../../consumption/ConsumptionBaseController";
|
|
4
|
+
import { ConsumptionController } from "../../consumption/ConsumptionController";
|
|
5
|
+
import { NotificationItemProcessorRegistry } from "./itemProcessors/NotificationItemProcessorRegistry";
|
|
6
|
+
import { LocalNotification } from "./local/LocalNotification";
|
|
7
|
+
export declare class NotificationsController extends ConsumptionBaseController {
|
|
8
|
+
private readonly localNotifications;
|
|
9
|
+
private readonly processorRegistry;
|
|
10
|
+
private readonly eventBus;
|
|
11
|
+
private readonly device;
|
|
12
|
+
constructor(localNotifications: SynchronizedCollection, processorRegistry: NotificationItemProcessorRegistry, parent: ConsumptionController, eventBus: EventBus, device: {
|
|
13
|
+
id: CoreId;
|
|
14
|
+
});
|
|
15
|
+
sent(message: Message): Promise<LocalNotification>;
|
|
16
|
+
received(message: Message): Promise<LocalNotification>;
|
|
17
|
+
private extractNotificationFromMessage;
|
|
18
|
+
processOpenNotifactionsReceivedByCurrentDevice(): Promise<void>;
|
|
19
|
+
process(notification: LocalNotification): Promise<LocalNotification>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationsController = void 0;
|
|
4
|
+
const content_1 = require("@nmshd/content");
|
|
5
|
+
const ConsumptionBaseController_1 = require("../../consumption/ConsumptionBaseController");
|
|
6
|
+
const ConsumptionControllerName_1 = require("../../consumption/ConsumptionControllerName");
|
|
7
|
+
const LocalNotification_1 = require("./local/LocalNotification");
|
|
8
|
+
const LocalNotificationSource_1 = require("./local/LocalNotificationSource");
|
|
9
|
+
class NotificationsController extends ConsumptionBaseController_1.ConsumptionBaseController {
|
|
10
|
+
constructor(localNotifications, processorRegistry, parent, eventBus, device) {
|
|
11
|
+
super(ConsumptionControllerName_1.ConsumptionControllerName.NotificationsController, parent);
|
|
12
|
+
this.localNotifications = localNotifications;
|
|
13
|
+
this.processorRegistry = processorRegistry;
|
|
14
|
+
this.eventBus = eventBus;
|
|
15
|
+
this.device = device;
|
|
16
|
+
}
|
|
17
|
+
async sent(message) {
|
|
18
|
+
if (!message.isOwn)
|
|
19
|
+
throw new Error("Cannot send a Notification from a foreign message.");
|
|
20
|
+
const content = this.extractNotificationFromMessage(message);
|
|
21
|
+
const recipients = message.cache.recipients;
|
|
22
|
+
if (recipients.length > 1)
|
|
23
|
+
throw new Error("Message contains more than one recipient.");
|
|
24
|
+
const notification = LocalNotification_1.LocalNotification.from({
|
|
25
|
+
id: content.id,
|
|
26
|
+
content,
|
|
27
|
+
status: LocalNotification_1.LocalNotificationStatus.Sent,
|
|
28
|
+
isOwn: true,
|
|
29
|
+
createdAt: message.cache.createdAt,
|
|
30
|
+
peer: recipients[0].address,
|
|
31
|
+
source: LocalNotificationSource_1.LocalNotificationSource.message(message.id)
|
|
32
|
+
});
|
|
33
|
+
await this.localNotifications.create(notification);
|
|
34
|
+
return notification;
|
|
35
|
+
}
|
|
36
|
+
async received(message) {
|
|
37
|
+
if (message.isOwn)
|
|
38
|
+
throw new Error("Cannot receive a Notification from an own message.");
|
|
39
|
+
const content = this.extractNotificationFromMessage(message);
|
|
40
|
+
const notification = LocalNotification_1.LocalNotification.from({
|
|
41
|
+
id: content.id,
|
|
42
|
+
content,
|
|
43
|
+
status: LocalNotification_1.LocalNotificationStatus.Open,
|
|
44
|
+
isOwn: false,
|
|
45
|
+
createdAt: message.cache.createdAt,
|
|
46
|
+
peer: message.cache.createdBy,
|
|
47
|
+
source: LocalNotificationSource_1.LocalNotificationSource.message(message.id),
|
|
48
|
+
receivedByDevice: this.device.id
|
|
49
|
+
});
|
|
50
|
+
await this.localNotifications.create(notification);
|
|
51
|
+
return notification;
|
|
52
|
+
}
|
|
53
|
+
extractNotificationFromMessage(message) {
|
|
54
|
+
if (!(message.cache.content instanceof content_1.Notification)) {
|
|
55
|
+
throw new Error("Message does not contain a Notification.");
|
|
56
|
+
}
|
|
57
|
+
return message.cache.content;
|
|
58
|
+
}
|
|
59
|
+
async processOpenNotifactionsReceivedByCurrentDevice() {
|
|
60
|
+
const notifications = await this.localNotifications.find({
|
|
61
|
+
receivedByDevice: this.device.id.toString(),
|
|
62
|
+
isOwn: false,
|
|
63
|
+
status: LocalNotification_1.LocalNotificationStatus.Open
|
|
64
|
+
});
|
|
65
|
+
const parsed = this.parseArray(notifications, LocalNotification_1.LocalNotification);
|
|
66
|
+
for (const notification of parsed) {
|
|
67
|
+
await this.process(notification);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async process(notification) {
|
|
71
|
+
if (notification.isOwn)
|
|
72
|
+
throw new Error("Cannot process own notification.");
|
|
73
|
+
if (!notification.receivedByDevice?.equals(this.device.id)) {
|
|
74
|
+
throw new Error("Notification is not received by current device.");
|
|
75
|
+
}
|
|
76
|
+
if (![LocalNotification_1.LocalNotificationStatus.Open, LocalNotification_1.LocalNotificationStatus.Error].includes(notification.status)) {
|
|
77
|
+
throw new Error(`Cannot process notification with status ${notification.status}.`);
|
|
78
|
+
}
|
|
79
|
+
const oldDoc = await this.localNotifications.findOne({ id: notification.id.toString() });
|
|
80
|
+
const processedItems = [];
|
|
81
|
+
const events = [];
|
|
82
|
+
try {
|
|
83
|
+
for (const item of notification.content.items) {
|
|
84
|
+
const processor = this.processorRegistry.getProcessorForItem(item);
|
|
85
|
+
const prerequisitesMatched = await processor.checkPrerequisitesOfIncomingNotificationItem(item);
|
|
86
|
+
if (!prerequisitesMatched) {
|
|
87
|
+
const index = notification.content.items.indexOf(item);
|
|
88
|
+
throw new Error(`Prerequisites of notificationItem with index '${index}' of Notification ${notification.id} not met.`);
|
|
89
|
+
}
|
|
90
|
+
// we should also rollback the item that failed, therefore we need to push before processing
|
|
91
|
+
processedItems.push(item);
|
|
92
|
+
const event = await processor.process(item);
|
|
93
|
+
if (event)
|
|
94
|
+
events.push(event);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
this._log.error(`Error while processing notification ${notification.id}: ${e}`);
|
|
99
|
+
for (const item of processedItems.reverse()) {
|
|
100
|
+
const processor = this.processorRegistry.getProcessorForItem(item);
|
|
101
|
+
await processor.rollback(item);
|
|
102
|
+
}
|
|
103
|
+
notification.status = LocalNotification_1.LocalNotificationStatus.Error;
|
|
104
|
+
await this.localNotifications.update(oldDoc, notification);
|
|
105
|
+
return notification;
|
|
106
|
+
}
|
|
107
|
+
notification.status = LocalNotification_1.LocalNotificationStatus.Completed;
|
|
108
|
+
await this.localNotifications.update(oldDoc, notification);
|
|
109
|
+
for (const event of events)
|
|
110
|
+
this.eventBus.publish(event);
|
|
111
|
+
return notification;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.NotificationsController = NotificationsController;
|
|
115
|
+
//# sourceMappingURL=NotificationsController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationsController.js","sourceRoot":"","sources":["../../../src/modules/notifications/NotificationsController.ts"],"names":[],"mappings":";;;AACA,4CAA+D;AAE/D,2FAAuF;AAEvF,2FAAuF;AAEvF,iEAAsF;AACtF,6EAAyE;AAEzE,MAAa,uBAAwB,SAAQ,qDAAyB;IAClE,YACqB,kBAA0C,EAC1C,iBAAoD,EACrE,MAA6B,EACZ,QAAkB,EAClB,MAAsB;QAEvC,KAAK,CAAC,qDAAyB,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAA;QAN/C,uBAAkB,GAAlB,kBAAkB,CAAwB;QAC1C,sBAAiB,GAAjB,iBAAiB,CAAmC;QAEpD,aAAQ,GAAR,QAAQ,CAAU;QAClB,WAAM,GAAN,MAAM,CAAgB;IAG3C,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,OAAgB;QAC9B,IAAI,CAAC,OAAO,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;QAEzF,MAAM,OAAO,GAAG,IAAI,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAA;QAE5D,MAAM,UAAU,GAAG,OAAO,CAAC,KAAM,CAAC,UAAU,CAAA;QAC5C,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;QAEvF,MAAM,YAAY,GAAG,qCAAiB,CAAC,IAAI,CAAC;YACxC,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,OAAO;YACP,MAAM,EAAE,2CAAuB,CAAC,IAAI;YACpC,KAAK,EAAE,IAAI;YACX,SAAS,EAAE,OAAO,CAAC,KAAM,CAAC,SAAS;YACnC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO;YAC3B,MAAM,EAAE,iDAAu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@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./NotificationsController";
|
|
2
|
+
export * from "./itemProcessors/AbstractNotificationItemProcessor";
|
|
3
|
+
export * from "./itemProcessors/NotificationItemConstructor";
|
|
4
|
+
export * from "./itemProcessors/NotificationItemProcessorConstructor";
|
|
5
|
+
export * from "./itemProcessors/NotificationItemProcessorRegistry";
|
|
6
|
+
export * from "./itemProcessors/attributeSucceeded/AttributeSucceededNotificationItemProcessor";
|
|
7
|
+
export * from "./local/LocalNotification";
|
|
8
|
+
export * from "./local/LocalNotificationSource";
|
|
@@ -14,9 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./NotificationsController"), exports);
|
|
18
|
+
__exportStar(require("./itemProcessors/AbstractNotificationItemProcessor"), exports);
|
|
19
|
+
__exportStar(require("./itemProcessors/NotificationItemConstructor"), exports);
|
|
20
|
+
__exportStar(require("./itemProcessors/NotificationItemProcessorConstructor"), exports);
|
|
21
|
+
__exportStar(require("./itemProcessors/NotificationItemProcessorRegistry"), exports);
|
|
22
|
+
__exportStar(require("./itemProcessors/attributeSucceeded/AttributeSucceededNotificationItemProcessor"), exports);
|
|
23
|
+
__exportStar(require("./local/LocalNotification"), exports);
|
|
24
|
+
__exportStar(require("./local/LocalNotificationSource"), exports);
|
|
22
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/notifications/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAyC;AACzC,qFAAkE;AAClE,+EAA4D;AAC5D,wFAAqE;AACrE,qFAAkE;AAClE,kHAA+F;AAC/F,4DAAyC;AACzC,kEAA+C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Event } from "@js-soft/ts-utils";
|
|
2
|
+
import { NotificationItem } from "@nmshd/content";
|
|
3
|
+
import { AccountController, CoreAddress } from "@nmshd/transport";
|
|
4
|
+
import { ConsumptionController } from "../../../consumption/ConsumptionController";
|
|
5
|
+
export interface INotificationItemProcessor<TNotificationItem extends NotificationItem = NotificationItem> {
|
|
6
|
+
checkPrerequisitesOfIncomingNotificationItem(notificationItem: TNotificationItem): boolean | Promise<boolean>;
|
|
7
|
+
process(notificationItem: TNotificationItem): Event | void | Promise<Event | void>;
|
|
8
|
+
rollback(notificationItem: TNotificationItem): void | Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class AbstractNotificationItemProcessor<TNotificationItem extends NotificationItem = NotificationItem> implements INotificationItemProcessor<TNotificationItem> {
|
|
11
|
+
protected readonly consumptionController: ConsumptionController;
|
|
12
|
+
protected accountController: AccountController;
|
|
13
|
+
protected currentIdentityAddress: CoreAddress;
|
|
14
|
+
constructor(consumptionController: ConsumptionController);
|
|
15
|
+
abstract checkPrerequisitesOfIncomingNotificationItem(notificationItem: TNotificationItem): boolean | Promise<boolean>;
|
|
16
|
+
abstract process(notificationItem: TNotificationItem): Event | void | Promise<Event | void>;
|
|
17
|
+
/**
|
|
18
|
+
* In case of an error during process() of the notification
|
|
19
|
+
* items in a notification, rollback() is called on
|
|
20
|
+
* (1) the notification item that caused the error
|
|
21
|
+
* (2) the previously processed notification items, in inverse order
|
|
22
|
+
* Beware that for notification items with non-atomic process methods, (1)
|
|
23
|
+
* requires rollback() to detect and clean up any partial work.
|
|
24
|
+
*/
|
|
25
|
+
abstract rollback(notificationItem: TNotificationItem): void | Promise<void>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractNotificationItemProcessor = void 0;
|
|
4
|
+
class AbstractNotificationItemProcessor {
|
|
5
|
+
constructor(consumptionController) {
|
|
6
|
+
this.consumptionController = consumptionController;
|
|
7
|
+
this.accountController = this.consumptionController.accountController;
|
|
8
|
+
this.currentIdentityAddress = this.accountController.identity.address;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.AbstractNotificationItemProcessor = AbstractNotificationItemProcessor;
|
|
12
|
+
//# sourceMappingURL=AbstractNotificationItemProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractNotificationItemProcessor.js","sourceRoot":"","sources":["../../../../src/modules/notifications/itemProcessors/AbstractNotificationItemProcessor.ts"],"names":[],"mappings":";;;AAWA,MAAsB,iCAAiC;IAMnD,YAAsC,qBAA4C;QAA5C,0BAAqB,GAArB,qBAAqB,CAAuB;QAC9E,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,CAAA;QACrE,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAA;IACzE,CAAC;CAiBJ;AA1BD,8EA0BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationItemConstructor.js","sourceRoot":"","sources":["../../../../src/modules/notifications/itemProcessors/NotificationItemConstructor.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ConsumptionController } from "../../../consumption/ConsumptionController";
|
|
2
|
+
import { INotificationItemProcessor } from "./AbstractNotificationItemProcessor";
|
|
3
|
+
export type NotificationItemProcessorConstructor = new (consumptionController: ConsumptionController) => INotificationItemProcessor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationItemProcessorConstructor.js","sourceRoot":"","sources":["../../../../src/modules/notifications/itemProcessors/NotificationItemProcessorConstructor.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NotificationItem } from "@nmshd/content";
|
|
2
|
+
import { ConsumptionController } from "../../../consumption/ConsumptionController";
|
|
3
|
+
import { INotificationItemProcessor } from "./AbstractNotificationItemProcessor";
|
|
4
|
+
import { NotificationItemConstructor } from "./NotificationItemConstructor";
|
|
5
|
+
import { NotificationItemProcessorConstructor } from "./NotificationItemProcessorConstructor";
|
|
6
|
+
export declare class NotificationItemProcessorRegistry {
|
|
7
|
+
private readonly consumptionController;
|
|
8
|
+
private readonly processors;
|
|
9
|
+
constructor(consumptionController: ConsumptionController, processors?: Map<NotificationItemConstructor, NotificationItemProcessorConstructor>);
|
|
10
|
+
registerProcessor(itemConstructor: NotificationItemConstructor, processorConstructor: NotificationItemProcessorConstructor): void;
|
|
11
|
+
registerOrReplaceProcessor(itemConstructor: NotificationItemConstructor, processorConstructor: NotificationItemProcessorConstructor): void;
|
|
12
|
+
getProcessorForItem(item: NotificationItem): INotificationItemProcessor;
|
|
13
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationItemProcessorRegistry = void 0;
|
|
4
|
+
const ConsumptionError_1 = require("../../../consumption/ConsumptionError");
|
|
5
|
+
class NotificationItemProcessorRegistry {
|
|
6
|
+
constructor(consumptionController, processors = new Map()) {
|
|
7
|
+
this.consumptionController = consumptionController;
|
|
8
|
+
this.processors = processors;
|
|
9
|
+
}
|
|
10
|
+
registerProcessor(itemConstructor, processorConstructor) {
|
|
11
|
+
if (this.processors.has(itemConstructor)) {
|
|
12
|
+
throw new ConsumptionError_1.ConsumptionError(`There is already a processor registered for '${itemConstructor.name}'. Use 'replaceProcessorForType' if you want to replace it.`);
|
|
13
|
+
}
|
|
14
|
+
this.processors.set(itemConstructor, processorConstructor);
|
|
15
|
+
}
|
|
16
|
+
registerOrReplaceProcessor(itemConstructor, processorConstructor) {
|
|
17
|
+
this.processors.set(itemConstructor, processorConstructor);
|
|
18
|
+
}
|
|
19
|
+
getProcessorForItem(item) {
|
|
20
|
+
const constructor = this.processors.get(item.constructor);
|
|
21
|
+
if (!constructor) {
|
|
22
|
+
throw new ConsumptionError_1.ConsumptionError(`There was no processor registered for '${item.constructor.name}'.`);
|
|
23
|
+
}
|
|
24
|
+
return new constructor(this.consumptionController);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.NotificationItemProcessorRegistry = NotificationItemProcessorRegistry;
|
|
28
|
+
//# sourceMappingURL=NotificationItemProcessorRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationItemProcessorRegistry.js","sourceRoot":"","sources":["../../../../src/modules/notifications/itemProcessors/NotificationItemProcessorRegistry.ts"],"names":[],"mappings":";;;AAEA,4EAAwE;AAKxE,MAAa,iCAAiC;IAC1C,YACqB,qBAA4C,EAC5C,aAAa,IAAI,GAAG,EAAqE;QADzF,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,eAAU,GAAV,UAAU,CAA+E;IAC3G,CAAC;IAEG,iBAAiB,CACpB,eAA4C,EAC5C,oBAA0D;QAE1D,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE;YACtC,MAAM,IAAI,mCAAgB,CACtB,gDAAgD,eAAe,CAAC,IAAI,6DAA6D,CACpI,CAAA;SACJ;QACD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAA;IAC9D,CAAC;IAEM,0BAA0B,CAC7B,eAA4C,EAC5C,oBAA0D;QAE1D,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAA;IAC9D,CAAC;IAEM,mBAAmB,CAAC,IAAsB;QAC7C,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,WAA0C,CAAC,CAAA;QACxF,IAAI,CAAC,WAAW,EAAE;YACd,MAAM,IAAI,mCAAgB,CAAC,0CAA0C,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,CAAA;SAClG;QACD,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;IACtD,CAAC;CACJ;AAhCD,8EAgCC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AttributeSucceededNotificationItem } from "@nmshd/content";
|
|
2
|
+
import { AttributeSucceededEvent } from "../../../attributes";
|
|
3
|
+
import { AbstractNotificationItemProcessor } from "../AbstractNotificationItemProcessor";
|
|
4
|
+
export declare class AttributeSucceededNotificationItemProcessor extends AbstractNotificationItemProcessor<AttributeSucceededNotificationItem> {
|
|
5
|
+
checkPrerequisitesOfIncomingNotificationItem(_notificationItem: AttributeSucceededNotificationItem): boolean | Promise<boolean>;
|
|
6
|
+
process(_notificationItem: AttributeSucceededNotificationItem): Promise<AttributeSucceededEvent>;
|
|
7
|
+
rollback(): void | Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AttributeSucceededNotificationItemProcessor = void 0;
|
|
4
|
+
const AbstractNotificationItemProcessor_1 = require("../AbstractNotificationItemProcessor");
|
|
5
|
+
class AttributeSucceededNotificationItemProcessor extends AbstractNotificationItemProcessor_1.AbstractNotificationItemProcessor {
|
|
6
|
+
checkPrerequisitesOfIncomingNotificationItem(_notificationItem) {
|
|
7
|
+
throw new Error("Method not implemented.");
|
|
8
|
+
}
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
10
|
+
async process(_notificationItem) {
|
|
11
|
+
throw new Error("Method not implemented.");
|
|
12
|
+
}
|
|
13
|
+
rollback() {
|
|
14
|
+
throw new Error("Method not implemented.");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.AttributeSucceededNotificationItemProcessor = AttributeSucceededNotificationItemProcessor;
|
|
18
|
+
//# sourceMappingURL=AttributeSucceededNotificationItemProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttributeSucceededNotificationItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/notifications/itemProcessors/attributeSucceeded/AttributeSucceededNotificationItemProcessor.ts"],"names":[],"mappings":";;;AAEA,4FAAwF;AAExF,MAAa,2CAA4C,SAAQ,qEAAqE;IAClH,4CAA4C,CACxD,iBAAqD;QAErD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC9C,CAAC;IAED,4DAA4D;IAC5C,KAAK,CAAC,OAAO,CACzB,iBAAqD;QAErD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC9C,CAAC;IAEe,QAAQ;QACpB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC9C,CAAC;CACJ;AAjBD,kGAiBC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Serializable } from "@js-soft/ts-serval";
|
|
2
|
+
import { INotification, Notification } from "@nmshd/content";
|
|
3
|
+
import { CoreAddress, CoreDate, CoreId, CoreSynchronizable, ICoreAddress, ICoreDate, ICoreId, ICoreSynchronizable } from "@nmshd/transport";
|
|
4
|
+
import { ILocalNotificationSource, LocalNotificationSource } from "./LocalNotificationSource";
|
|
5
|
+
export declare enum LocalNotificationStatus {
|
|
6
|
+
Open = "Open",
|
|
7
|
+
Sent = "Sent",
|
|
8
|
+
Completed = "Completed",
|
|
9
|
+
Error = "Error"
|
|
10
|
+
}
|
|
11
|
+
export interface ILocalNotification extends ICoreSynchronizable {
|
|
12
|
+
isOwn: boolean;
|
|
13
|
+
peer: ICoreAddress;
|
|
14
|
+
createdAt: ICoreDate;
|
|
15
|
+
receivedByDevice?: ICoreId;
|
|
16
|
+
content: INotification;
|
|
17
|
+
status: LocalNotificationStatus;
|
|
18
|
+
source: ILocalNotificationSource;
|
|
19
|
+
}
|
|
20
|
+
export declare class LocalNotification extends CoreSynchronizable implements ILocalNotification {
|
|
21
|
+
readonly technicalProperties: string[];
|
|
22
|
+
readonly userdataProperties: string[];
|
|
23
|
+
isOwn: boolean;
|
|
24
|
+
peer: CoreAddress;
|
|
25
|
+
createdAt: CoreDate;
|
|
26
|
+
receivedByDevice?: CoreId;
|
|
27
|
+
content: Notification;
|
|
28
|
+
status: LocalNotificationStatus;
|
|
29
|
+
source: LocalNotificationSource;
|
|
30
|
+
protected static postFrom<T extends Serializable>(value: T): T;
|
|
31
|
+
static from(value: ILocalNotification): LocalNotification;
|
|
32
|
+
}
|