@nmshd/consumption 3.4.0 → 3.4.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.
- package/dist/buildInformation.js +4 -4
- package/dist/modules/notifications/NotificationsController.d.ts +2 -1
- package/dist/modules/notifications/NotificationsController.js +13 -5
- package/dist/modules/notifications/NotificationsController.js.map +1 -1
- package/lib-web/nmshd.consumption.js +17 -9
- 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 +1 -1
package/dist/buildInformation.js
CHANGED
|
@@ -6,10 +6,10 @@ const content_1 = require("@nmshd/content");
|
|
|
6
6
|
const crypto_1 = require("@nmshd/crypto");
|
|
7
7
|
const transport_1 = require("@nmshd/transport");
|
|
8
8
|
exports.buildInformation = {
|
|
9
|
-
version: "3.4.
|
|
10
|
-
build: "
|
|
11
|
-
date: "2023-10-
|
|
12
|
-
commit: "
|
|
9
|
+
version: "3.4.1",
|
|
10
|
+
build: "109",
|
|
11
|
+
date: "2023-10-12T13:14:50+00:00",
|
|
12
|
+
commit: "f0f88ace5c1343e2eb1ec422d58342a8676926c4",
|
|
13
13
|
dependencies: {"@js-soft/docdb-querytranslator":"^1.1.1","@nmshd/iql":"^0.0.4","ts-simple-nameof":"^1.3.1"},
|
|
14
14
|
libraries: {
|
|
15
15
|
transport: transport_1.buildInformation,
|
|
@@ -16,5 +16,6 @@ export declare class NotificationsController extends ConsumptionBaseController {
|
|
|
16
16
|
received(message: Message): Promise<LocalNotification>;
|
|
17
17
|
private extractNotificationFromMessage;
|
|
18
18
|
processOpenNotifactionsReceivedByCurrentDevice(): Promise<void>;
|
|
19
|
-
|
|
19
|
+
processNotificationById(notificationId: CoreId): Promise<LocalNotification>;
|
|
20
|
+
private process;
|
|
20
21
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NotificationsController = void 0;
|
|
4
4
|
const content_1 = require("@nmshd/content");
|
|
5
|
+
const transport_1 = require("@nmshd/transport");
|
|
5
6
|
const ConsumptionBaseController_1 = require("../../consumption/ConsumptionBaseController");
|
|
6
7
|
const ConsumptionControllerName_1 = require("../../consumption/ConsumptionControllerName");
|
|
7
8
|
const LocalNotification_1 = require("./local/LocalNotification");
|
|
@@ -62,12 +63,20 @@ class NotificationsController extends ConsumptionBaseController_1.ConsumptionBas
|
|
|
62
63
|
isOwn: false,
|
|
63
64
|
status: LocalNotification_1.LocalNotificationStatus.Open
|
|
64
65
|
});
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
await this.process(notification);
|
|
66
|
+
for (const notificationDoc of notifications) {
|
|
67
|
+
const notification = LocalNotification_1.LocalNotification.from(notificationDoc);
|
|
68
|
+
await this.process(notificationDoc, notification);
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
|
-
async
|
|
71
|
+
async processNotificationById(notificationId) {
|
|
72
|
+
const notificationDoc = await this.localNotifications.findOne({ id: notificationId.toString() });
|
|
73
|
+
if (!notificationDoc) {
|
|
74
|
+
throw transport_1.CoreErrors.general.recordNotFound(LocalNotification_1.LocalNotification, notificationId.toString());
|
|
75
|
+
}
|
|
76
|
+
const parsed = LocalNotification_1.LocalNotification.from(notificationDoc);
|
|
77
|
+
return await this.process(notificationDoc, parsed);
|
|
78
|
+
}
|
|
79
|
+
async process(oldDoc, notification) {
|
|
71
80
|
if (notification.isOwn)
|
|
72
81
|
throw new Error("Cannot process own notification.");
|
|
73
82
|
if (!notification.receivedByDevice?.equals(this.device.id)) {
|
|
@@ -76,7 +85,6 @@ class NotificationsController extends ConsumptionBaseController_1.ConsumptionBas
|
|
|
76
85
|
if (![LocalNotification_1.LocalNotificationStatus.Open, LocalNotification_1.LocalNotificationStatus.Error].includes(notification.status)) {
|
|
77
86
|
throw new Error(`Cannot process notification with status ${notification.status}.`);
|
|
78
87
|
}
|
|
79
|
-
const oldDoc = await this.localNotifications.findOne({ id: notification.id.toString() });
|
|
80
88
|
const processedItems = [];
|
|
81
89
|
const events = [];
|
|
82
90
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsController.js","sourceRoot":"","sources":["../../../src/modules/notifications/NotificationsController.ts"],"names":[],"mappings":";;;AACA,4CAA+D;
|
|
1
|
+
{"version":3,"file":"NotificationsController.js","sourceRoot":"","sources":["../../../src/modules/notifications/NotificationsController.ts"],"names":[],"mappings":";;;AACA,4CAA+D;AAC/D,gDAA6G;AAC7G,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;YACp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CAAA;aACjC;YAED,YAAY,CAAC,MAAM,GAAG,2CAAuB,CAAC,KAAK,CAAA;YACnD,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;YAE1D,OAAO,YAAY,CAAA;SACtB;QAED,YAAY,CAAC,MAAM,GAAG,2CAAuB,CAAC,SAAS,CAAA;QACvD,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;QAE1D,KAAK,MAAM,KAAK,IAAI,MAAM;YAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAExD,OAAO,YAAY,CAAA;IACvB,CAAC;CACJ;AAzID,0DAyIC"}
|
|
@@ -17,10 +17,10 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
17
17
|
const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
18
18
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
19
19
|
exports.buildInformation = {
|
|
20
|
-
version: "3.4.
|
|
21
|
-
build: "
|
|
22
|
-
date: "2023-10-
|
|
23
|
-
commit: "
|
|
20
|
+
version: "3.4.1",
|
|
21
|
+
build: "109",
|
|
22
|
+
date: "2023-10-12T13:14:50+00:00",
|
|
23
|
+
commit: "f0f88ace5c1343e2eb1ec422d58342a8676926c4",
|
|
24
24
|
dependencies: {"@js-soft/docdb-querytranslator":"^1.1.1","@nmshd/iql":"^0.0.4","ts-simple-nameof":"^1.3.1"},
|
|
25
25
|
libraries: {
|
|
26
26
|
transport: transport_1.buildInformation,
|
|
@@ -1804,6 +1804,7 @@ __exportStar(__webpack_require__(/*! ./settings */ "./dist/modules/settings/inde
|
|
|
1804
1804
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1805
1805
|
exports.NotificationsController = void 0;
|
|
1806
1806
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
1807
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
1807
1808
|
const ConsumptionBaseController_1 = __webpack_require__(/*! ../../consumption/ConsumptionBaseController */ "./dist/consumption/ConsumptionBaseController.js");
|
|
1808
1809
|
const ConsumptionControllerName_1 = __webpack_require__(/*! ../../consumption/ConsumptionControllerName */ "./dist/consumption/ConsumptionControllerName.js");
|
|
1809
1810
|
const LocalNotification_1 = __webpack_require__(/*! ./local/LocalNotification */ "./dist/modules/notifications/local/LocalNotification.js");
|
|
@@ -1864,12 +1865,20 @@ class NotificationsController extends ConsumptionBaseController_1.ConsumptionBas
|
|
|
1864
1865
|
isOwn: false,
|
|
1865
1866
|
status: LocalNotification_1.LocalNotificationStatus.Open
|
|
1866
1867
|
});
|
|
1867
|
-
const
|
|
1868
|
-
|
|
1869
|
-
await this.process(notification);
|
|
1868
|
+
for (const notificationDoc of notifications) {
|
|
1869
|
+
const notification = LocalNotification_1.LocalNotification.from(notificationDoc);
|
|
1870
|
+
await this.process(notificationDoc, notification);
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
async processNotificationById(notificationId) {
|
|
1874
|
+
const notificationDoc = await this.localNotifications.findOne({ id: notificationId.toString() });
|
|
1875
|
+
if (!notificationDoc) {
|
|
1876
|
+
throw transport_1.CoreErrors.general.recordNotFound(LocalNotification_1.LocalNotification, notificationId.toString());
|
|
1870
1877
|
}
|
|
1878
|
+
const parsed = LocalNotification_1.LocalNotification.from(notificationDoc);
|
|
1879
|
+
return await this.process(notificationDoc, parsed);
|
|
1871
1880
|
}
|
|
1872
|
-
async process(notification) {
|
|
1881
|
+
async process(oldDoc, notification) {
|
|
1873
1882
|
if (notification.isOwn)
|
|
1874
1883
|
throw new Error("Cannot process own notification.");
|
|
1875
1884
|
if (!notification.receivedByDevice?.equals(this.device.id)) {
|
|
@@ -1878,7 +1887,6 @@ class NotificationsController extends ConsumptionBaseController_1.ConsumptionBas
|
|
|
1878
1887
|
if (![LocalNotification_1.LocalNotificationStatus.Open, LocalNotification_1.LocalNotificationStatus.Error].includes(notification.status)) {
|
|
1879
1888
|
throw new Error(`Cannot process notification with status ${notification.status}.`);
|
|
1880
1889
|
}
|
|
1881
|
-
const oldDoc = await this.localNotifications.findOne({ id: notification.id.toString() });
|
|
1882
1890
|
const processedItems = [];
|
|
1883
1891
|
const events = [];
|
|
1884
1892
|
try {
|