Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mercurius

Package Overview
Dependencies
Maintainers
2
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mercurius - npm Package Compare versions

Comparing version 16.0.0 to 16.0.1

18

index.d.ts

@@ -26,7 +26,19 @@ import {

declare namespace mercurius {
export interface PubSub {
subscribe<TResult = any>(topics: string | string[]): Promise<Readable & AsyncIterableIterator<TResult>>;
publish<TResult = any>(event: { topic: string; payload: TResult }, callback?: () => void): void;
export interface PubSubTopics {
[topic: string]: any;
}
export interface PubSub<TPubSubTopics extends PubSubTopics = PubSubTopics> {
subscribe<TTopic extends Extract<keyof TPubSubTopics, string>>(
topics: TTopic | TTopic[],
): Promise<Readable & AsyncIterableIterator<TPubSubTopics[TTopic]>>;
publish<TTopic extends Extract<keyof TPubSubTopics, string>>(
event: {
topic: TTopic;
payload: TPubSubTopics[TTopic];
},
callback?: () => void,
): void;
}
export interface MercuriusContext {

@@ -33,0 +45,0 @@ app: FastifyInstance;

4

package.json
{
"name": "mercurius",
"version": "16.0.0",
"version": "16.0.1",
"description": "Fastify GraphQL adapter with subscription support",

@@ -42,3 +42,3 @@ "main": "index.js",

"eslint": "^9.9.1",
"fastify": "^5.0.0-alpha.4",
"fastify": "^5.0.0",
"graphql": "^16.0.0",

@@ -45,0 +45,0 @@ "graphql-tag": "^2.12.6",

@@ -2697,3 +2697,3 @@ 'use strict'

const ws = new WebSocket(`ws://127.0.0.1:${fastify.server.address().port}/graphql`, 'graphql-ws')
const ws = new WebSocket(`ws://localhost:${fastify.server.address().port}/graphql`, 'graphql-ws')

@@ -2700,0 +2700,0 @@ await once(ws, 'open')

@@ -401,3 +401,3 @@ /* eslint-disable @typescript-eslint/no-unused-expressions */

async () => {
const subscription = await app.graphql.pubsub.subscribe<{ newNotification: string }>('topic')
const subscription = await app.graphql.pubsub.subscribe('topic')

@@ -404,0 +404,0 @@ subscription.on('data', (chunk) => {

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