Skip to content

Commit

Permalink
feat: deprecate the sspichallenge event
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurschreiber authored Sep 28, 2021
1 parent 91c7701 commit aa0f790
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,18 @@ class Connection extends EventEmitter {
*/
on(event: 'secure', listener: (cleartext: import('tls').TLSSocket) => void): this

/**
* A SSPI token was send by the server.
*
* @deprecated
*/
on(event: 'sspichallenge', listener: (token: import('./token/token').SSPIToken) => void): this

on(event: string | symbol, listener: (...args: any[]) => void) {
if (event === 'sspichallenge') {
emitSSPIChallengeEventDeprecationWarning();
}

return super.on(event, listener);
}

Expand Down Expand Up @@ -3117,6 +3128,21 @@ class Connection extends EventEmitter {
}
}

let sspichallengeEventDeprecationWarningEmitted = false;
function emitSSPIChallengeEventDeprecationWarning() {
if (sspichallengeEventDeprecationWarningEmitted) {
return;
}

sspichallengeEventDeprecationWarningEmitted = true;

process.emitWarning(
'The `sspichallenge` event is deprecated and will be removed.',
'DeprecationWarning',
Connection.prototype.on
);
}

export default Connection;
module.exports = Connection;

Expand Down

0 comments on commit aa0f790

Please sign in to comment.