podverse-notifications 5.1.20-alpha.0 → 5.1.21-alpha.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/config/index.d.ts +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -0
- package/dist/services/notifications/notificationOrchestrator.d.ts +2 -1
- package/dist/services/notifications/notificationOrchestrator.d.ts.map +1 -1
- package/dist/services/notifications/notificationOrchestrator.js +7 -4
- package/dist/services/unifiedpush/unifiedpushNotification.d.ts +0 -1
- package/dist/services/unifiedpush/unifiedpushNotification.d.ts.map +1 -1
- package/dist/services/unifiedpush/unifiedpushNotification.js +3 -2
- package/dist/services/unifiedpush/unifiedpushNotificationOrchestrator.d.ts +2 -1
- package/dist/services/unifiedpush/unifiedpushNotificationOrchestrator.d.ts.map +1 -1
- package/dist/services/unifiedpush/unifiedpushNotificationOrchestrator.js +3 -3
- package/dist/services/webpush/webpushNotification.d.ts +0 -1
- package/dist/services/webpush/webpushNotification.d.ts.map +1 -1
- package/dist/services/webpush/webpushNotification.js +3 -2
- package/dist/services/webpush/webpushNotificationOrchestrator.d.ts +2 -1
- package/dist/services/webpush/webpushNotificationOrchestrator.d.ts.map +1 -1
- package/dist/services/webpush/webpushNotificationOrchestrator.js +3 -3
- package/package.json +3 -3
package/dist/config/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;CAalB,CAAC;AAEF,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI1D;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C"}
|
package/dist/config/index.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.getWebBaseUrl = getWebBaseUrl;
|
|
|
5
5
|
exports.getWebBaseUrlWithPath = getWebBaseUrlWithPath;
|
|
6
6
|
exports.getWebIconImageUrl = getWebIconImageUrl;
|
|
7
7
|
exports.config = {
|
|
8
|
+
brandName: process.env.BRAND_NAME || "Podverse",
|
|
8
9
|
web: {
|
|
9
10
|
protocol: process.env.WEB_PROTOCOL || "http",
|
|
10
11
|
host: process.env.WEB_DOMAIN || "localhost",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../src/services/notifications/notificationOrchestrator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAqB,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;AAC7D,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AAmCzE,KAAK,kCAAkC,GAAG;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,uBAAuB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAGF,KAAK,sCAAsC,GAAG,kCAAkC,GAAG;IACjF,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,KAAK,qCAAqC,GAAG,kCAAkC,GAAG;IAChF,OAAO,EAAE,SAAS,CAAC;IACnB,aAAa,EAAE,mBAAmB,EAAE,CAAC;CACtC,CAAC;AAGF,KAAK,yCAAyC,GAAG,kCAAkC,GAAG;IACpF,OAAO,EAAE,aAAa,CAAC;IACvB,aAAa,EAAE,cAAc,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GACtC,sCAAsC,GACtC,qCAAqC,GACrC,yCAAyC,CAAC;AAS9C,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,8BAA8B,
|
|
1
|
+
{"version":3,"file":"notificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../src/services/notifications/notificationOrchestrator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAqB,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;AAC7D,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AAmCzE,KAAK,kCAAkC,GAAG;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,uBAAuB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAGF,KAAK,sCAAsC,GAAG,kCAAkC,GAAG;IACjF,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,KAAK,qCAAqC,GAAG,kCAAkC,GAAG;IAChF,OAAO,EAAE,SAAS,CAAC;IACnB,aAAa,EAAE,mBAAmB,EAAE,CAAC;CACtC,CAAC;AAGF,KAAK,yCAAyC,GAAG,kCAAkC,GAAG;IACpF,OAAO,EAAE,aAAa,CAAC;IACvB,aAAa,EAAE,cAAc,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GACtC,sCAAsC,GACtC,qCAAqC,GACrC,yCAAyC,CAAC;AAS9C,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,8BAA8B,kBAuDpF"}
|
|
@@ -54,7 +54,7 @@ function getFinalText(messageText, messageType, locale) {
|
|
|
54
54
|
}
|
|
55
55
|
function notificationOrchestrator(params) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
const { service, messageText, messageType, locale, linkIdText, mediumId,
|
|
57
|
+
const { service, messageText, messageType, locale, body, linkIdText, mediumId, image, data } = params;
|
|
58
58
|
const finalText = getFinalText(messageText, messageType, locale);
|
|
59
59
|
// Construct the link from messageType, mediumId, and linkIdText
|
|
60
60
|
let link;
|
|
@@ -69,8 +69,9 @@ function notificationOrchestrator(params) {
|
|
|
69
69
|
tokens: firebaseParams.tokens,
|
|
70
70
|
platform: firebaseParams.platform,
|
|
71
71
|
finalText,
|
|
72
|
+
body,
|
|
72
73
|
link,
|
|
73
|
-
|
|
74
|
+
image,
|
|
74
75
|
channelId: firebaseParams.channelId,
|
|
75
76
|
badge: firebaseParams.badge,
|
|
76
77
|
sound: firebaseParams.sound,
|
|
@@ -82,8 +83,9 @@ function notificationOrchestrator(params) {
|
|
|
82
83
|
return yield (0, webpush_1.webpushNotificationBatchOrchestrator)({
|
|
83
84
|
subscriptions: webpushParams.subscriptions,
|
|
84
85
|
finalText,
|
|
86
|
+
body,
|
|
85
87
|
link,
|
|
86
|
-
|
|
88
|
+
image,
|
|
87
89
|
data,
|
|
88
90
|
});
|
|
89
91
|
}
|
|
@@ -92,8 +94,9 @@ function notificationOrchestrator(params) {
|
|
|
92
94
|
return yield (0, unifiedpush_1.unifiedpushNotificationBatchOrchestrator)({
|
|
93
95
|
subscriptions: upParams.subscriptions,
|
|
94
96
|
finalText,
|
|
97
|
+
body,
|
|
95
98
|
link,
|
|
96
|
-
|
|
99
|
+
image,
|
|
97
100
|
data,
|
|
98
101
|
});
|
|
99
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unifiedpushNotification.d.ts","sourceRoot":"","sources":["../../../src/services/unifiedpush/unifiedpushNotification.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,KAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,
|
|
1
|
+
{"version":3,"file":"unifiedpushNotification.d.ts","sourceRoot":"","sources":["../../../src/services/unifiedpush/unifiedpushNotification.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,KAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,aAAa,EAAE,cAAc,EAAE,EAC/B,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,QAAQ,EAAE,CAAC,CA0ErB"}
|
|
@@ -33,10 +33,11 @@ function sendUPNotificationBatch(subscriptions, payload) {
|
|
|
33
33
|
const headers = {
|
|
34
34
|
'Content-Type': 'text/plain',
|
|
35
35
|
'X-Title': payload.title,
|
|
36
|
+
'X-Tags': config_1.config.brandName,
|
|
36
37
|
'X-Click': payload.link ? (0, config_1.getWebBaseUrlWithPath)(payload.link) : (0, config_1.getWebBaseUrl)(),
|
|
37
|
-
'X-Icon':
|
|
38
|
+
'X-Icon': (0, config_1.getWebIconImageUrl)(), // Always use app icon for branding
|
|
38
39
|
};
|
|
39
|
-
// Add
|
|
40
|
+
// Add item/channel artwork as image attachment for preview
|
|
40
41
|
if (payload.image) {
|
|
41
42
|
headers['X-Attach'] = payload.image;
|
|
42
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unifiedpushNotificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../src/services/unifiedpush/unifiedpushNotificationOrchestrator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,KAAK,oBAAoB,GAAG;IAC1B,aAAa,EAAE,cAAc,EAAE,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,wBAAsB,wCAAwC,CAAC,MAAM,EAAE,oBAAoB;;;;KAc1F"}
|
|
1
|
+
{"version":3,"file":"unifiedpushNotificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../src/services/unifiedpush/unifiedpushNotificationOrchestrator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,KAAK,oBAAoB,GAAG;IAC1B,aAAa,EAAE,cAAc,EAAE,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,wBAAsB,wCAAwC,CAAC,MAAM,EAAE,oBAAoB;;;;KAc1F"}
|
|
@@ -13,11 +13,11 @@ exports.unifiedpushNotificationBatchOrchestrator = unifiedpushNotificationBatchO
|
|
|
13
13
|
const unifiedpushNotification_1 = require("./unifiedpushNotification");
|
|
14
14
|
function unifiedpushNotificationBatchOrchestrator(params) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const { subscriptions, finalText,
|
|
16
|
+
const { subscriptions, finalText, body, image, link, data } = params;
|
|
17
17
|
const payload = {
|
|
18
18
|
title: finalText,
|
|
19
|
-
body
|
|
20
|
-
|
|
19
|
+
body,
|
|
20
|
+
image,
|
|
21
21
|
link,
|
|
22
22
|
data,
|
|
23
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpushNotification.d.ts","sourceRoot":"","sources":["../../../src/services/webpush/webpushNotification.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,
|
|
1
|
+
{"version":3,"file":"webpushNotification.d.ts","sourceRoot":"","sources":["../../../src/services/webpush/webpushNotification.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,4BAA4B,CAChD,aAAa,EAAE,mBAAmB,EAAE,EACpC,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,EAAE,CAAC,CA4D1B"}
|
|
@@ -26,8 +26,8 @@ function sendWebPushNotificationBatch(subscriptions, payload) {
|
|
|
26
26
|
const notificationPayload = JSON.stringify({
|
|
27
27
|
title: payload.title,
|
|
28
28
|
body: payload.body || "",
|
|
29
|
-
icon:
|
|
30
|
-
image: payload.image,
|
|
29
|
+
icon: (0, config_1.getWebIconImageUrl)(), // Always use app icon for branding
|
|
30
|
+
image: payload.image, // Item/channel artwork
|
|
31
31
|
link: payload.link ? (0, config_1.getWebBaseUrlWithPath)(payload.link) : (0, config_1.getWebBaseUrl)(),
|
|
32
32
|
data: payload.data,
|
|
33
33
|
});
|
|
@@ -41,6 +41,7 @@ function sendWebPushNotificationBatch(subscriptions, payload) {
|
|
|
41
41
|
urgency: 'normal',
|
|
42
42
|
});
|
|
43
43
|
return { success: true, endpoint: subscription.endpoint };
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
45
|
}
|
|
45
46
|
catch (error) {
|
|
46
47
|
console.error(`Web Push send failed for ${subscription.endpoint}:`, error.message);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpushNotificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../src/services/webpush/webpushNotificationOrchestrator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,KAAK,yBAAyB,GAAG;IAC/B,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,wBAAsB,oCAAoC,CAAC,MAAM,EAAE,yBAAyB;;;;KAc3F"}
|
|
1
|
+
{"version":3,"file":"webpushNotificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../src/services/webpush/webpushNotificationOrchestrator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,KAAK,yBAAyB,GAAG;IAC/B,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,wBAAsB,oCAAoC,CAAC,MAAM,EAAE,yBAAyB;;;;KAc3F"}
|
|
@@ -13,11 +13,11 @@ exports.webpushNotificationBatchOrchestrator = webpushNotificationBatchOrchestra
|
|
|
13
13
|
const webpushNotification_1 = require("./webpushNotification");
|
|
14
14
|
function webpushNotificationBatchOrchestrator(params) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const { subscriptions, finalText,
|
|
16
|
+
const { subscriptions, finalText, body, image, link, data } = params;
|
|
17
17
|
const payload = {
|
|
18
18
|
title: finalText,
|
|
19
|
-
body
|
|
20
|
-
|
|
19
|
+
body,
|
|
20
|
+
image,
|
|
21
21
|
link,
|
|
22
22
|
data,
|
|
23
23
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podverse-notifications",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.21-alpha.0",
|
|
4
4
|
"description": "Push notification helper module for Podverse use cases",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"license": "AGPLv3",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"module-alias": "^2.2.3",
|
|
20
|
-
"podverse-external-services": "^5.1.
|
|
21
|
-
"podverse-helpers": "^5.1.
|
|
20
|
+
"podverse-external-services": "^5.1.21-alpha.0",
|
|
21
|
+
"podverse-helpers": "^5.1.21-alpha.0",
|
|
22
22
|
"web-push": "^3.6.7"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|