From 8816d9ba9638f75d8793a5810cedcbbabd13a73e Mon Sep 17 00:00:00 2001 From: Mark Gaylard Date: Thu, 13 Oct 2022 17:31:29 +1100 Subject: [PATCH 1/2] fix saslAuthenticate parameter type definitions --- docs/CustomAuthenticationMechanism.md | 8 ++++++-- types/index.d.ts | 15 +++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/docs/CustomAuthenticationMechanism.md b/docs/CustomAuthenticationMechanism.md index f02eced77..e4ecbfc27 100644 --- a/docs/CustomAuthenticationMechanism.md +++ b/docs/CustomAuthenticationMechanism.md @@ -24,13 +24,17 @@ configure your brokers. A custom authentication mechanism needs to fulfill the following interface: ```ts +type SaslAuthenticateArgs = { + request: SaslAuthenticationRequest + response?: SaslAuthenticationResponse +} + type AuthenticationProviderArgs = { host: string port: number logger: Logger saslAuthenticate: ( - request: SaslAuthenticationRequest, - response?: SaslAuthenticationResponse + args: SaslAuthenticateArgs ) => Promise } diff --git a/types/index.d.ts b/types/index.d.ts index c046a0188..26bcbfea3 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -28,13 +28,17 @@ export type Authenticator = { authenticate: () => Promise } +export type SaslAuthenticateArgs = { + request: SaslAuthenticationRequest + response?: SaslAuthenticationResponse +} + export type AuthenticationProviderArgs = { host: string port: number logger: Logger saslAuthenticate: ( - request: SaslAuthenticationRequest, - response?: SaslAuthenticationResponse + args: SaslAuthenticateArgs ) => Promise } @@ -259,7 +263,7 @@ export interface ReplicaAssignment { } export interface PartitionReassignment { - topic: string, + topic: string partitionAssignment: Array } @@ -694,7 +698,10 @@ export type Broker = { topics: PartitionReassignment[] timeout?: number }): Promise - listPartitionReassignments(request: { topics?: TopicPartitions[]; timeout?: number }): Promise + listPartitionReassignments(request: { + topics?: TopicPartitions[] + timeout?: number + }): Promise } interface MessageSetEntry { From 2bca3f9ea30f3991fe29a264b1211fb0b20a41ab Mon Sep 17 00:00:00 2001 From: Tommy Brunn Date: Thu, 13 Oct 2022 16:08:12 +0200 Subject: [PATCH 2/2] Bump version (v2.2.1) and update changelog --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbc4f8dc1..5b728be56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [2.2.1] - 2022-10-13 + +### Fixed + - Fixed Typescript definitions for custom authentication mechanisms #1459 + ## [2.2.0] - 2022-08-16 ### Added diff --git a/package.json b/package.json index 55f75ff79..2d2f3f9d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kafkajs", - "version": "2.2.0", + "version": "2.2.1", "description": "A modern Apache Kafka client for node.js", "author": "Tulio Ornelas ", "main": "index.js",