MCPcopy Create free account
hub / github.com/CommE2E/comm / sendWebNotifications

Function sendWebNotifications

keyserver/src/push/send.js:1303–1328  ·  view source on GitHub ↗
(
  targetedNotifications: $ReadOnlyArray<TargetedWebNotification>,
  notificationInfo: NotificationInfo,
)

Source from the content-addressed store, hash-verified

1301 +invalidTokens?: $ReadOnlyArray<string>,
1302};
1303async function sendWebNotifications(
1304 targetedNotifications: $ReadOnlyArray<TargetedWebNotification>,
1305 notificationInfo: NotificationInfo,
1306): Promise<WebResult> {
1307 const { source, codeVersion, stateVersion } = notificationInfo;
1308
1309 const response = await webPush(targetedNotifications);
1310
1311 const deviceTokens = targetedNotifications.map(
1312 ({ deliveryID }) => deliveryID,
1313 );
1314 const delivery: WebDelivery = {
1315 source,
1316 deviceType: 'web',
1317 deviceTokens,
1318 codeVersion,
1319 errors: response.errors,
1320 stateVersion,
1321 };
1322 const result: WebResult = {
1323 info: notificationInfo,
1324 delivery,
1325 invalidTokens: response.invalidTokens,
1326 };
1327 return result;
1328}
1329
1330type WNSDelivery = {
1331 +source: NotificationInfo['source'],

Callers 1

Calls 1

webPushFunction · 0.90

Tested by

no test coverage detected