Skip to content

Commit 4b40938

Browse files
Sunny  TyagiSunny  Tyagi
authored andcommitted
feat(pkg): remove unexpected use of any and add prettier fix
remove unexpected use of any and add prettier fix gh-3
1 parent 6ebdff9 commit 4b40938

File tree

26 files changed

+153
-164
lines changed

26 files changed

+153
-164
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ about: Create a report to help us improve
44
title: ''
55
labels: ''
66
assignees: ''
7-
87
---
98

109
**Describe the bug**
1110
A clear and concise description of what the bug is.
1211

1312
**To Reproduce**
1413
Steps to reproduce the behavior:
14+
1515
1. Go to '...'
1616
2. Click on '....'
1717
3. Scroll down to '....'

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ about: Suggest an idea for this project
44
title: ''
55
labels: ''
66
assignees: ''
7-
87
---
98

109
**Is your feature request related to a problem? Please describe.**

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ jobs:
4949
GH_TOKEN: ${{ secrets.RELEASE_COMMIT_GH_PAT }}
5050
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5151
- name: Changelog 📝
52-
run: cd src/release_notes && HUSKY=0 node release-notes.js
52+
run: cd src/release_notes && HUSKY=0 node release-notes.js

README.md

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Install EventStreamConnectorComponent using `npm`;
1212
```sh
1313
$ [npm install | yarn add] @sourceloop/message-bus-queue-connectors
1414
```
15+
1516
## Flow Diagram
1617

1718
<img width="659" alt="Screenshot 2025-06-06 at 10 53 06 AM" src="https://github.com/user-attachments/assets/baf1bcaa-5f67-44bb-a01a-b8d1c41644bc" />
@@ -22,9 +23,7 @@ Configure and load EventStreamConnectorComponent in the application constructor
2223
as shown below.
2324

2425
```ts
25-
import {
26-
EventStreamConnectorComponent
27-
} from '@sourceloop/message-bus-queue-connectors';
26+
import {EventStreamConnectorComponent} from '@sourceloop/message-bus-queue-connectors';
2827

2928
// ...
3029
export class MyApplication extends BootMixin(
@@ -47,7 +46,7 @@ To use SQS as their message queue, bind its required config and connector compon
4746
import {
4847
SQSConnector,
4948
SQSBindings,
50-
EventStreamConnectorComponent
49+
EventStreamConnectorComponent,
5150
} from '@sourceloop/message-bus-queue-connectors';
5251

5352
// ...
@@ -156,10 +155,10 @@ const config = {
156155

157156
## Integration
158157

159-
@sourceloop/message-bus-queue-connectors provides a decorator '@producer()' that can be used to access the producer of each msg queue. It expects one arguement defining the type of queue, of which producer u want to use. like
158+
@sourceloop/message-bus-queue-connectors provides a decorator '@producer()' that can be used to access the producer of each msg queue. It expects one arguement defining the type of queue, of which producer u want to use. like
160159

161-
```ts
162-
@injectable({scope: BindingScope.TRANSIENT})
160+
```ts
161+
@injectable({scope: BindingScope.TRANSIENT})
163162
export class EventConnector implements IEventConnector<PublishedEvents> {
164163
constructor(
165164
@producer(QueueType.EventBridge)
@@ -171,48 +170,55 @@ export class EventConnector implements IEventConnector<PublishedEvents> {
171170
) {}
172171

173172
// rest of implementation
174-
175173
}
176-
```
174+
```
177175

178-
Producer provider two ways of sending events - single event at a time and multiple event at a time.
176+
Producer provider two ways of sending events - single event at a time and multiple event at a time.
179177

180-
```ts
181-
export type Producer<Stream extends AnyObject = AnyObject> = {
182-
send: <Event extends keyof Stream>(data: Stream[Event], topic?: Event) => Promise<void>;
183-
sendMultiple: <Event extends keyof Stream>(data: Stream[Event][], topic?: Event) => Promise<void>;
178+
```ts
179+
export type Producer<Stream extends AnyObject = AnyObject> = {
180+
send: <Event extends keyof Stream>(
181+
data: Stream[Event],
182+
topic?: Event,
183+
) => Promise<void>;
184+
sendMultiple: <Event extends keyof Stream>(
185+
data: Stream[Event][],
186+
topic?: Event,
187+
) => Promise<void>;
184188
};
185-
```
189+
```
186190

187191
It provides '@consumer' decorator to make a service as consumer. consumer needs to follow an interface.
188192

189193
```ts
190-
export interface IConsumer<Stream extends AnyObject, Event extends keyof Stream> {
191-
event: Event;
192-
queue: QueueType;
193-
handle(data: Stream[Event]): Promise<void>;
194+
export interface IConsumer<
195+
Stream extends AnyObject,
196+
Event extends keyof Stream,
197+
> {
198+
event: Event;
199+
queue: QueueType;
200+
handle(data: Stream[Event]): Promise<void>;
194201
}
195202
```
196203

197-
and can be used as
204+
and can be used as
198205

199206
```ts
200207
import {
201208
IConsumer,
202209
QueueType,
203210
consumer,
204211
} from '@sourceloop/message-bus-queue-connectors';
205-
import { OrchestratorStream, EventTypes, ProvisioningInputs } from '../../types';
212+
import {OrchestratorStream, EventTypes, ProvisioningInputs} from '../../types';
206213

207214
@consumer
208215
export class TenantProvisioningConsumerForEventSQS
209216
implements IConsumer<OrchestratorStream, EventTypes.TENANT_PROVISIONING>
210217
{
211-
constructor(
212-
) {}
218+
constructor() {}
213219
event: EventTypes.TENANT_PROVISIONING = EventTypes.TENANT_PROVISIONING;
214220
queue: QueueType = QueueType.SQS;
215-
async handle(data: ProvisioningInputs): Promise<void> {
221+
async handle(data: ProvisioningInputs): Promise<void> {
216222
console.log(`SQS: ${this.event} Event Recieved ` + JSON.stringify(data));
217223
return;
218224
}

src/__tests__/acceptance/bullmq/fixtures/consumer-app.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import {ApplicationConfig} from '@loopback/core';
44
import {RestApplication} from '@loopback/rest';
55
import {ServiceMixin} from '@loopback/service-proxy';
66
import {EventStreamConnectorComponent} from '../../../../component';
7-
import {
8-
BullMQBindings,
9-
BullMQConnector,
10-
} from '../../../../strategies';
7+
import {BullMQBindings, BullMQConnector} from '../../../../strategies';
118
import {EventAConsumer} from './services/event-a.consumer';
129
import {EventBConsumer} from './services/event-b.consumer';
1310
import {EventBSecondConsumer} from './services/event-b-second.consumer';

src/__tests__/acceptance/bullmq/fixtures/producers-app.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import {ApplicationConfig} from '@loopback/core';
33
import {RestApplication} from '@loopback/rest';
44
import {ServiceMixin} from '@loopback/service-proxy';
55
import {EventStreamConnectorComponent} from '../../../../component';
6-
import {
7-
BullMQBindings,
8-
BullMQConnector,
9-
} from '../../../../strategies';
6+
import {BullMQBindings, BullMQConnector} from '../../../../strategies';
107

118
export class ProducerApp extends BootMixin(ServiceMixin(RestApplication)) {
129
constructor(options: ApplicationConfig = {}) {

src/__tests__/acceptance/bullmq/helpers/app-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {givenHttpServerConfig,sinon} from '@loopback/testlab';
1+
import {givenHttpServerConfig, sinon} from '@loopback/testlab';
22
import {ProducerApp} from '../fixtures/producers-app';
33
import {BullMQBindings} from '../../../../strategies';
44
import {ConsumerApp} from '../fixtures/consumer-app';

src/__tests__/acceptance/bullmq/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export type StubListener = (
66
data: AnyObject,
77
) => void;
88

9-
109
export interface BullMqQueueParams {
1110
name: string;
1211
data: Record<string, unknown>;

src/__tests__/acceptance/event-bridge/event-bridge.acceptance.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import {DEFAULT_SOURCE} from '../../../constants';
4444
sinon.assert.calledWithExactly(listenerStub, Events.A, DEFAULT_SOURCE, {
4545
name: 'Event A',
4646
data: 'test string',
47-
type: Events.A
47+
type: Events.A,
4848
});
4949
});
5050
it('should produce multiple events for a particular topic', async () => {
@@ -57,12 +57,12 @@ import {DEFAULT_SOURCE} from '../../../constants';
5757
sinon.assert.calledWithExactly(calls[0], Events.A, DEFAULT_SOURCE, {
5858
name: 'Event A',
5959
data: 'test string 1',
60-
type: Events.A
60+
type: Events.A,
6161
});
6262
sinon.assert.calledWithExactly(calls[1], Events.A, DEFAULT_SOURCE, {
6363
name: 'Event A',
6464
data: 'test string 2',
65-
type: Events.A
65+
type: Events.A,
6666
});
6767
});
6868
});

src/__tests__/acceptance/sqs/fixtures/consumer-app.ts

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import {ApplicationConfig} from '@loopback/core';
44
import {RestApplication} from '@loopback/rest';
55
import {ServiceMixin} from '@loopback/service-proxy';
66
import {EventStreamConnectorComponent} from '../../../../component';
7-
import {
8-
SQSBindings,
9-
SQSConnector,
10-
} from '../../../../strategies';
7+
import {SQSBindings, SQSConnector} from '../../../../strategies';
118
import {EventAConsumer} from './services/event-a.consumer';
129
import {EventBConsumer} from './services/event-b.consumer';
1310
import {EventBSecondConsumer} from './services/event-b-second.consumer';
@@ -21,29 +18,26 @@ export class ConsumerApp extends BootMixin(
2118
this.service(EventBConsumer);
2219
this.service(EventBSecondConsumer);
2320
this.component(EventStreamConnectorComponent);
24-
this.bind(SQSBindings.Config).to(
25-
{
26-
queueConfig: {
27-
QueueUrl: 'http://127.0.0.1:4566/000000000000/my-test-queue',
28-
MessageRetentionPeriod: 60, // at least 60 seconds
29-
MaximumMessageSize: 262144,
30-
ReceiveMessageWaitTimeSeconds: 20, // typical polling time
31-
VisibilityTimeout: 30, // 30 seconds
32-
},
33-
Credentials: {
34-
region: 'us-east-1',
35-
accessKeyId: 'test',
36-
secretAccessKey: 'test',
37-
},
38-
ConsumerConfig: {
39-
MaxNumberOfMessages: 10,
40-
WaitTimeSeconds: 20,
41-
maxConsumers: 2,
42-
},
43-
isConsumer:true,
44-
}
45-
46-
);
21+
this.bind(SQSBindings.Config).to({
22+
queueConfig: {
23+
QueueUrl: 'http://127.0.0.1:4566/000000000000/my-test-queue',
24+
MessageRetentionPeriod: 60, // at least 60 seconds
25+
MaximumMessageSize: 262144,
26+
ReceiveMessageWaitTimeSeconds: 20, // typical polling time
27+
VisibilityTimeout: 30, // 30 seconds
28+
},
29+
Credentials: {
30+
region: 'us-east-1',
31+
accessKeyId: 'test',
32+
secretAccessKey: 'test',
33+
},
34+
ConsumerConfig: {
35+
MaxNumberOfMessages: 10,
36+
WaitTimeSeconds: 20,
37+
maxConsumers: 2,
38+
},
39+
isConsumer: true,
40+
});
4741
this.component(SQSConnector);
4842

4943
this.projectRoot = __dirname;

0 commit comments

Comments
 (0)