From c9aff0893336dab3e440825f56c3e94aa39d9ecc Mon Sep 17 00:00:00 2001 From: Jason Walton Date: Thu, 11 Aug 2022 16:23:30 -0400 Subject: [PATCH] fix: Upgrade promise-breaker to 6.0.0 to fix typescript imports. fix #234 --- package.json | 2 +- src/AmqpConnectionManager.ts | 10 +++++----- src/ChannelWrapper.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index d0d51baa..101672c9 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "dist/**/*" ], "dependencies": { - "promise-breaker": "^5.0.0" + "promise-breaker": "^6.0.0" }, "peerDependencies": { "amqplib": "*" diff --git a/src/AmqpConnectionManager.ts b/src/AmqpConnectionManager.ts index 2cd1f621..35453d71 100644 --- a/src/AmqpConnectionManager.ts +++ b/src/AmqpConnectionManager.ts @@ -1,4 +1,4 @@ -import amqp, { Connection } from 'amqplib'; +import * as amqp from 'amqplib'; import { EventEmitter, once } from 'events'; import { TcpSocketConnectOpts } from 'net'; import pb from 'promise-breaker'; @@ -16,7 +16,7 @@ export type ConnectionUrl = | { url: string; connectionOptions?: AmpqConnectionOptions }; export interface ConnectListener { - (arg: { connection: Connection; url: string | amqp.Options.Connect }): void; + (arg: { connection: amqp.Connection; url: string | amqp.Options.Connect }): void; } export interface ConnectFailedListener { @@ -131,7 +131,7 @@ export interface IAmqpConnectionManager { isConnected(): boolean; /** The current connection. */ - readonly connection: Connection | undefined; + readonly connection: amqp.Connection | undefined; /** Returns the number of registered channels. */ readonly channelCount: number; @@ -151,7 +151,7 @@ export default class AmqpConnectionManager extends EventEmitter implements IAmqp private _closed = false; private _cancelRetriesHandler?: () => void; private _connectPromise?: Promise; - private _currentConnection?: Connection; + private _currentConnection?: amqp.Connection; private _findServers: | ((callback: (urls: ConnectionUrl | ConnectionUrl[]) => void) => void) | (() => Promise); @@ -322,7 +322,7 @@ export default class AmqpConnectionManager extends EventEmitter implements IAmqp } /** The current connection. */ - get connection(): Connection | undefined { + get connection(): amqp.Connection | undefined { return this._currentConnection; } diff --git a/src/ChannelWrapper.ts b/src/ChannelWrapper.ts index 63a83bb0..53ff87a4 100644 --- a/src/ChannelWrapper.ts +++ b/src/ChannelWrapper.ts @@ -1,6 +1,6 @@ import type * as amqplib from 'amqplib'; import { Options } from 'amqplib'; -import crypto from 'crypto'; +import * as crypto from 'crypto'; import { EventEmitter } from 'events'; import pb from 'promise-breaker'; import { promisify } from 'util';