@xyzblocks/web-notifications-domain
TypeScript icon, indicating that this package has built-in type declarations

2.0.8 • Public • Published

@xyzblocks/web-notifications-domain

Web Notifications Domain

Build Status

Installation

npm install @xyzblocks/web-notifications-domain --save

API

INotification

Properties

  • image: string
  • message: string
  • timestamp: string
  • title: string
  • url: string

INotificationRepository

Methods

  • create(subscriptionId: string, notification: INotification): Promise<void>
  • findAll(subscriptionId: string, timestamp: number): Promise<Array<INotification>>
  • markAsRead(subscriptionId: string, timestamp: number): Promise<void>

ISubscription

Properties

  • channels: Array<string>
  • id: string
  • webPushSubscription: IWebPushSubscription

ISubscriptionRepository

Methods

  • create(subscription: ISubscription): Promise<void>
  • delete(id: string): Promise<void>
  • find(id: string): Promise<ISubscription>
  • findAll(channel: string): Promise<Array<ISubscription>>
  • update(subscription: ISubscription): Promise<void>

IWebPushSubscription

Properties

  • endpoint: string
  • expirationTime: number
  • keys: { auth: string, p256dh: string }

SubscriptionService

Methods

  • create(subscription: ISubscription): Promise<void>
  • delete(id: string): Promise<void>
  • find(id: string): Promise<ISubscription>
  • generatePrivateKeyAndPublicKey(): { publicKey: string; privateKey: string }
  • readNotifications(id: string, timestamp: number): Promise<Array<INotification>>
  • sendNotification(channel: string, notification: INotification): Promise<void>
  • subscribeToChannel(id: string, channel: string): Promise<void>
  • unsubscribeFromChannel(id: string, channel: string): Promise<void>

Readme

Keywords

none

Package Sidebar

Install

npm i @xyzblocks/web-notifications-domain

Weekly Downloads

0

Version

2.0.8

License

MIT

Unpacked Size

74.2 kB

Total Files

44

Last publish

Collaborators

  • xyzblocks