@equinor/fusion
Advanced tools
Comparing version 0.1.85 to 0.1.86
@@ -13,2 +13,4 @@ import EventEmitter, { useEventEmitterValue } from "../utils/EventEmitter"; | ||
const existingApp = this.get(appKey); | ||
// Ensure app key on the manifest | ||
manifest = Object.assign({}, manifest, { key: appKey }); | ||
if (existingApp === null) { | ||
@@ -15,0 +17,0 @@ const newApp = manifest; |
@@ -8,2 +8,3 @@ import ReliableDictionary from '../utils/ReliableDictionary'; | ||
export declare type NotificationRequest = { | ||
id?: string; | ||
/** The level of the notification */ | ||
@@ -56,2 +57,3 @@ level: NotificationLevel; | ||
getAllNotificationsAsync(): Promise<Notification[]>; | ||
private shouldPresentNotificationAsync; | ||
private createNotification; | ||
@@ -58,0 +60,0 @@ private getTimeoutForLevel; |
@@ -10,2 +10,5 @@ import uuid from 'uuid/v1'; | ||
async sendAsync(notificationRequest) { | ||
if (!await this.shouldPresentNotificationAsync(notificationRequest)) { | ||
return Promise.reject(); | ||
} | ||
const notification = this.createNotification(notificationRequest); | ||
@@ -43,5 +46,12 @@ await this.persistAsync(notification); | ||
} | ||
async shouldPresentNotificationAsync(notificationRequest) { | ||
const allNotifications = await this.getAllNotificationsAsync(); | ||
if (allNotifications.find(n => n.id === notificationRequest.id)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
createNotification(notificationRequest) { | ||
return { | ||
id: uuid(), | ||
id: notificationRequest.id || uuid(), | ||
request: notificationRequest, | ||
@@ -48,0 +58,0 @@ response: null, |
{ | ||
"name": "@equinor/fusion", | ||
"version": "0.1.85", | ||
"version": "0.1.86", | ||
"description": "Everything a Fusion app needs to communicate with the core", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164892
3897