@davinci/messaging-amqp
Advanced tools
Comparing version 1.0.0-next.2 to 1.0.0-next.3
@@ -5,3 +5,3 @@ import { App, Module } from '@davinci/core'; | ||
import amqplib from 'amqplib'; | ||
import { AmqpConnectionManager, ConnectionUrl } from 'amqp-connection-manager'; | ||
import { AmqpConnectionManager, ChannelWrapper, ConnectionUrl } from 'amqp-connection-manager'; | ||
import { AmqpConnectionManagerOptions } from 'amqp-connection-manager/dist/esm/AmqpConnectionManager'; | ||
@@ -56,3 +56,3 @@ import { AmqpSubscriptionSettings, ParameterConfiguration, Subscription } from './types'; | ||
getSubscriptions(): Subscription[]; | ||
getChannels(): import("amqp-connection-manager").ChannelWrapper[]; | ||
getChannels(): ChannelWrapper[]; | ||
private addInFlightMsg; | ||
@@ -59,0 +59,0 @@ private deleteInFlightMsg; |
@@ -232,3 +232,4 @@ "use strict"; | ||
handlerArgs: parameters, | ||
context: { channel: subscription.channel, subscription }, | ||
channel: subscription.channel, | ||
subscription, | ||
state: {} | ||
@@ -235,0 +236,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import amqplib, { Channel } from 'amqplib'; | ||
import amqplib from 'amqplib'; | ||
import type { ChannelWrapper, SetupFunc } from 'amqp-connection-manager'; | ||
@@ -6,2 +6,3 @@ import { CreateChannelOpts } from 'amqp-connection-manager'; | ||
import { SubscribeOptions } from '@davinci/messaging'; | ||
import { Interceptor, InterceptorBagDetails } from '@davinci/core'; | ||
export interface AmqpSubscribeOptions { | ||
@@ -58,9 +59,6 @@ exchange: string; | ||
}; | ||
export interface AmqpInterceptorContext { | ||
module: 'messaging-amqp'; | ||
channel: Channel; | ||
export declare type AmqpInterceptor<IBD extends InterceptorBagDetails = InterceptorBagDetails> = Interceptor<IBD, { | ||
channel: ChannelWrapper; | ||
subscription: Subscription; | ||
state: {}; | ||
handlerArgs: any[]; | ||
} | ||
}>; | ||
export type { ChannelWrapper }; |
@@ -5,3 +5,3 @@ import { App, Module } from '@davinci/core'; | ||
import amqplib from 'amqplib'; | ||
import { AmqpConnectionManager, ConnectionUrl } from 'amqp-connection-manager'; | ||
import { AmqpConnectionManager, ChannelWrapper, ConnectionUrl } from 'amqp-connection-manager'; | ||
import { AmqpConnectionManagerOptions } from 'amqp-connection-manager/dist/esm/AmqpConnectionManager'; | ||
@@ -56,3 +56,3 @@ import { AmqpSubscriptionSettings, ParameterConfiguration, Subscription } from './types'; | ||
getSubscriptions(): Subscription[]; | ||
getChannels(): import("amqp-connection-manager").ChannelWrapper[]; | ||
getChannels(): ChannelWrapper[]; | ||
private addInFlightMsg; | ||
@@ -59,0 +59,0 @@ private deleteInFlightMsg; |
@@ -228,3 +228,4 @@ /* | ||
handlerArgs: parameters, | ||
context: { channel: subscription.channel, subscription }, | ||
channel: subscription.channel, | ||
subscription, | ||
state: {} | ||
@@ -231,0 +232,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import amqplib, { Channel } from 'amqplib'; | ||
import amqplib from 'amqplib'; | ||
import type { ChannelWrapper, SetupFunc } from 'amqp-connection-manager'; | ||
@@ -6,2 +6,3 @@ import { CreateChannelOpts } from 'amqp-connection-manager'; | ||
import { SubscribeOptions } from '@davinci/messaging'; | ||
import { Interceptor, InterceptorBagDetails } from '@davinci/core'; | ||
export interface AmqpSubscribeOptions { | ||
@@ -58,9 +59,6 @@ exchange: string; | ||
}; | ||
export interface AmqpInterceptorContext { | ||
module: 'messaging-amqp'; | ||
channel: Channel; | ||
export declare type AmqpInterceptor<IBD extends InterceptorBagDetails = InterceptorBagDetails> = Interceptor<IBD, { | ||
channel: ChannelWrapper; | ||
subscription: Subscription; | ||
state: {}; | ||
handlerArgs: any[]; | ||
} | ||
}>; | ||
export type { ChannelWrapper }; |
@@ -6,2 +6,13 @@ # Change Log | ||
# [1.0.0-next.3](https://github.com/HPInc/davinci/compare/@davinci/messaging-amqp@1.0.0-next.2...@davinci/messaging-amqp@1.0.0-next.3) (2022-10-25) | ||
### Features | ||
* **interceptors:** standardized usage, added specific types ([b07022e](https://github.com/HPInc/davinci/commit/b07022e482fe1dbf92b9190d34f065fb8254dde8)) | ||
# [1.0.0-next.2](https://github.com/HPInc/davinci/compare/@davinci/messaging-amqp@1.0.0-next.1...@davinci/messaging-amqp@1.0.0-next.2) (2022-10-25) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@davinci/messaging-amqp", | ||
"version": "1.0.0-next.2", | ||
"version": "1.0.0-next.3", | ||
"description": "AMQP module", | ||
@@ -23,3 +23,3 @@ "author": "HP", | ||
"dependencies": { | ||
"@davinci/core": "^2.0.0-next.2", | ||
"@davinci/core": "^2.0.0-next.3", | ||
"@davinci/messaging": "^1.0.0-next.2", | ||
@@ -41,3 +41,3 @@ "@davinci/reflector": "^2.0.0-next.2", | ||
}, | ||
"gitHead": "725e0a54c485871cc702c9c6b7564e072b6f1d53" | ||
"gitHead": "6b5d17664e93136a77218499cc42d3b503d773de" | ||
} |
@@ -19,3 +19,3 @@ /* | ||
import amqplib, { Message } from 'amqplib'; | ||
import amqpConnectionManager, { AmqpConnectionManager, ConnectionUrl } from 'amqp-connection-manager'; | ||
import amqpConnectionManager, { AmqpConnectionManager, ChannelWrapper, ConnectionUrl } from 'amqp-connection-manager'; | ||
import { EventEmitter } from 'events'; | ||
@@ -350,7 +350,8 @@ import { AmqpConnectionManagerOptions } from 'amqp-connection-manager/dist/esm/AmqpConnectionManager'; | ||
parameters: any[]; | ||
}): InterceptorBag { | ||
}): InterceptorBag<{}, { channel: ChannelWrapper; subscription: Subscription }> { | ||
return { | ||
module: 'messaging-amqp', | ||
handlerArgs: parameters, | ||
context: { channel: subscription.channel, subscription }, | ||
channel: subscription.channel, | ||
subscription, | ||
state: {} | ||
@@ -357,0 +358,0 @@ }; |
@@ -6,3 +6,3 @@ /* | ||
import amqplib, { Channel } from 'amqplib'; | ||
import amqplib from 'amqplib'; | ||
import type { ChannelWrapper, SetupFunc } from 'amqp-connection-manager'; | ||
@@ -12,2 +12,3 @@ import { CreateChannelOpts } from 'amqp-connection-manager'; | ||
import { SubscribeOptions } from '@davinci/messaging'; | ||
import { Interceptor, InterceptorBagDetails } from '@davinci/core'; | ||
@@ -72,10 +73,7 @@ export interface AmqpSubscribeOptions { | ||
export interface AmqpInterceptorContext { | ||
module: 'messaging-amqp'; | ||
channel: Channel; | ||
subscription: Subscription; | ||
state: {}; | ||
handlerArgs: any[]; | ||
} | ||
export type AmqpInterceptor<IBD extends InterceptorBagDetails = InterceptorBagDetails> = Interceptor< | ||
IBD, | ||
{ channel: ChannelWrapper; subscription: Subscription } | ||
>; | ||
export type { ChannelWrapper }; |
@@ -6,5 +6,5 @@ /* | ||
import { createSandbox } from 'sinon'; | ||
import { App, Interceptor, interceptor, mapSeries, nextTick } from '@davinci/core'; | ||
import { App, interceptor, mapSeries, nextTick } from '@davinci/core'; | ||
import { channelParam, message, payload, subscribe } from '@davinci/messaging'; | ||
import { AmqpInterceptorContext, AmqpModule, AmqpModuleOptions, Subscription } from '../../src'; | ||
import { AmqpInterceptor, AmqpModule, AmqpModuleOptions, Subscription } from '../../src'; | ||
import { expect } from '../support/chai'; | ||
@@ -196,3 +196,3 @@ | ||
it('should process the interceptors', async () => { | ||
const interceptorStub = sinon.stub().callsFake((next => next()) as Interceptor<AmqpInterceptorContext>); | ||
const interceptorStub = sinon.stub().callsFake((next => next()) as AmqpInterceptor); | ||
class MyController { | ||
@@ -228,3 +228,4 @@ @subscribe({ | ||
module: 'messaging-amqp', | ||
context: { channel: subscription.channel, subscription }, | ||
channel: subscription.channel, | ||
subscription, | ||
state: {} | ||
@@ -231,0 +232,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
547407
4392
Updated@davinci/core@^2.0.0-next.3