Skip to content

Commit

Permalink
Merge pull request #1459 from markgaylard/fix-custom-authenticator-types
Browse files Browse the repository at this point in the history
Fix saslAuthenticate parameter type definitions
  • Loading branch information
Nevon committed Oct 13, 2022
2 parents fd28b46 + 8816d9b commit b5db7ab
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
8 changes: 6 additions & 2 deletions docs/CustomAuthenticationMechanism.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ configure your brokers.
A custom authentication mechanism needs to fulfill the following interface:

```ts
type SaslAuthenticateArgs<ParseResult> = {
request: SaslAuthenticationRequest
response?: SaslAuthenticationResponse<ParseResult>
}

type AuthenticationProviderArgs = {
host: string
port: number
logger: Logger
saslAuthenticate: <ParseResult>(
request: SaslAuthenticationRequest,
response?: SaslAuthenticationResponse<ParseResult>
args: SaslAuthenticateArgs<ParseResult>
) => Promise<ParseResult | void>
}

Expand Down
15 changes: 11 additions & 4 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ export type Authenticator = {
authenticate: () => Promise<void>
}

export type SaslAuthenticateArgs<ParseResult> = {
request: SaslAuthenticationRequest
response?: SaslAuthenticationResponse<ParseResult>
}

export type AuthenticationProviderArgs = {
host: string
port: number
logger: Logger
saslAuthenticate: <ParseResult>(
request: SaslAuthenticationRequest,
response?: SaslAuthenticationResponse<ParseResult>
args: SaslAuthenticateArgs<ParseResult>
) => Promise<ParseResult | void>
}

Expand Down Expand Up @@ -259,7 +263,7 @@ export interface ReplicaAssignment {
}

export interface PartitionReassignment {
topic: string,
topic: string
partitionAssignment: Array<ReplicaAssignment>
}

Expand Down Expand Up @@ -694,7 +698,10 @@ export type Broker = {
topics: PartitionReassignment[]
timeout?: number
}): Promise<any>
listPartitionReassignments(request: { topics?: TopicPartitions[]; timeout?: number }): Promise<ListPartitionReassignmentsResponse>
listPartitionReassignments(request: {
topics?: TopicPartitions[]
timeout?: number
}): Promise<ListPartitionReassignmentsResponse>
}

interface MessageSetEntry {
Expand Down

0 comments on commit b5db7ab

Please sign in to comment.