New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@notifi-network/notifi-graphql

Package Overview
Dependencies
Maintainers
0
Versions
356
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@notifi-network/notifi-graphql - npm Package Compare versions

Comparing version 2.2.1-alpha.14 to 2.2.1-alpha.15

2

lib/NotifiEventEmitter.ts

@@ -27,3 +27,3 @@ import { Client as WebSocketClient } from 'graphql-ws';

type NotifiSubscriptionEvents = {
export type NotifiSubscriptionEvents = {
tenantActiveAlertChanged: [TenantActiveAlertChangeEvent];

@@ -30,0 +30,0 @@ stateChanged: [StateChangedEvent];

@@ -7,8 +7,8 @@ import {

import { Observable, Subscription } from 'relay-runtime';
import { NotifiEventEmitter, NotifiEmitterEvents } from './NotifiEventEmitter';
import {
NotifiEventEmitter,
NotifiEmitterEvents,
NotifiSubscriptionEvents,
} from './NotifiEventEmitter';
import { stateChangedSubscriptionQuery } from './gql';
import {
StateChangedEvent,
TenantActiveAlertChangeEvent,
} from './gql/generated';
import { tenantActiveAlertChangedSubscriptionQuery } from './gql/subscriptions/tenantActiveAlertChanged.gql';

@@ -143,8 +143,19 @@

case stateChangedSubscriptionQuery:
this.eventEmitter.emit('stateChanged', data as StateChangedEvent);
const stateChangedData = getSubscriptionData('stateChanged', data);
if (!stateChangedData) {
throw new Error('Invalid stateChanged event data');
}
this.eventEmitter.emit('stateChanged', stateChangedData);
break;
case tenantActiveAlertChangedSubscriptionQuery:
const tenantActiveAlertChangedData = getSubscriptionData(
'tenantActiveAlertChanged',
data,
);
if (!tenantActiveAlertChangedData) {
throw new Error('Invalid tenantActiveAlertChanged event data');
}
this.eventEmitter.emit(
'tenantActiveAlertChanged',
data as TenantActiveAlertChangeEvent,
tenantActiveAlertChangedData,
);

@@ -219,1 +230,23 @@ break;

}
// Utils
const getSubscriptionData = <T extends keyof NotifiSubscriptionEvents>(
subscriptionEvent: T,
data: unknown,
) => {
// NOTE: The raw data from the subscription is in the format { data: { subscriptionEvent: T } }
if (typeof data !== 'object' || data === null) return null;
if (!('data' in data)) return null;
const subscriptionData = data.data;
if (
typeof subscriptionData === 'object' &&
subscriptionData !== null &&
subscriptionEvent in subscriptionData
) {
return (subscriptionData as Record<keyof NotifiSubscriptionEvents, any>)[
subscriptionEvent
] as NotifiSubscriptionEvents[T][0];
}
return null;
};
{
"name": "@notifi-network/notifi-graphql",
"version": "2.2.1-alpha.14+8de158d1",
"version": "2.2.1-alpha.15+ef3fed3b",
"description": "The GraphQL API for Notifi",

@@ -49,3 +49,3 @@ "main": "./dist/index.js",

},
"gitHead": "8de158d1077066c906350c8ba7d49e7785b9f68d"
"gitHead": "ef3fed3bf7163352c537cfcef1829b30e805e973"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc