From 6f18c6cb7553efb32e3e4f331b6ca5c64cd0fe09 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Mon, 9 Sep 2024 17:19:19 +0200 Subject: [PATCH] Bumped v15.0.0 Signed-off-by: Matteo Collina --- index.d.ts | 17 ++++++++++++++--- package.json | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index 13396202..efccf214 100644 --- a/index.d.ts +++ b/index.d.ts @@ -23,9 +23,20 @@ import { Readable } from 'stream' type Mercurius = typeof mercurius declare namespace mercurius { - export interface PubSub { - subscribe(topics: string | string[]): Promise>; - publish(event: { topic: string; payload: TResult }, callback?: () => void): void; + export type PubSubPublishArgsByKey = { + [key: string]: any; + }; + + export interface PubSub< + TPubSubPublishArgsByKey extends PubSubPublishArgsByKey, + > { + subscribe>( + topics: TKey | TKey[], + ): Promise>; + publish>( + event: { topic: TKey; payload: TPubSubPublishArgsByKey[TKey] }, + callback?: () => void, + ): void; } export interface MercuriusContext { diff --git a/package.json b/package.json index b214dca9..58568ddb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mercurius", - "version": "14.1.0", + "version": "15.0.0", "description": "Fastify GraphQL adapter with subscription support", "main": "index.js", "types": "index.d.ts",