Skip to content

Commit

Permalink
chore: Upgrade Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
thalesog committed Feb 17, 2022
1 parent 55ca43c commit 3718f2d
Show file tree
Hide file tree
Showing 5 changed files with 1,297 additions and 1,019 deletions.
2 changes: 1 addition & 1 deletion adonis-typings/bull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ declare module '@ioc:Rocketseat/Bull' {
}

export interface EventListener {
eventName: string
eventName: keyof Bullmq.WorkerListener
method: string
}

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"ts-node": "^9.0.0",
"typescript": "^3.9.7"
"typescript": "^4.5.5"
},
"repository": {
"type": "git",
Expand All @@ -111,8 +111,8 @@
"@adonisjs/core": "^5.3.4"
},
"dependencies": {
"@bull-board/express": "^3.6.0",
"bullmq": "^1.48.3"
"@bull-board/express": "^3.9.4",
"bullmq": "^1.73.0"
},
"files": [
"build/adonis-typings",
Expand Down
6 changes: 5 additions & 1 deletion src/BullManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
Worker,
WorkerOptions,
Processor,
WorkerListener,
} from 'bullmq'
import { createBullBoard } from '@bull-board/api'
import { ExpressAdapter } from '@bull-board/express'
Expand Down Expand Up @@ -73,7 +74,10 @@ export class BullManager implements BullManagerContract {
if (method.startsWith('on')) {
const eventName = method
.replace(/^on(\w)/, (_, group) => group.toLowerCase())
.replace(/([A-Z]+)/, (_, group) => ` ${group.toLowerCase()}`)
.replace(
/([A-Z]+)/,
(_, group) => ` ${group.toLowerCase()}`
) as keyof WorkerListener

events.push({ eventName, method })
}
Expand Down
26 changes: 13 additions & 13 deletions test/unit/queue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { fs, MyFakeLogger } from '../../test-helpers'

const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))

const CONNECTION_CONFIG = ({
const CONNECTION_CONFIG = {
connection: 'local',
connections: {
local: {
Expand All @@ -22,7 +22,7 @@ const CONNECTION_CONFIG = ({
password: process.env.REDIS_PASSWORD || '',
},
},
} as unknown) as BullConfig
} as unknown as BullConfig

test.group('Bull', (group) => {
group.beforeEach(async () => {
Expand All @@ -38,7 +38,7 @@ test.group('Bull', (group) => {
async handle() {},
}))

const logger = (new FakeLogger({} as any) as unknown) as LoggerContract
const logger = new FakeLogger({} as any) as unknown as LoggerContract

const bull = new BullManager(ioc, logger, CONNECTION_CONFIG, [
'App/Jobs/TestBull',
Expand Down Expand Up @@ -75,7 +75,7 @@ test.group('Bull', (group) => {
})()
})

const logger = (new FakeLogger({} as any) as unknown) as LoggerContract
const logger = new FakeLogger({} as any) as unknown as LoggerContract

const bull = new BullManager(ioc, logger, CONNECTION_CONFIG, [
'App/Jobs/TestBull',
Expand Down Expand Up @@ -109,7 +109,7 @@ test.group('Bull', (group) => {
},
}))

const logger = (new FakeLogger({} as any) as unknown) as LoggerContract
const logger = new FakeLogger({} as any) as unknown as LoggerContract

const bull = new BullManager(ioc, logger, CONNECTION_CONFIG, [
'App/Jobs/TestBull',
Expand Down Expand Up @@ -138,7 +138,7 @@ test.group('Bull', (group) => {
})()
})

const logger = (new FakeLogger({} as any) as unknown) as LoggerContract
const logger = new FakeLogger({} as any) as unknown as LoggerContract

const bull = new BullManager(ioc, logger, CONNECTION_CONFIG, [
'App/Jobs/TestBull',
Expand Down Expand Up @@ -176,7 +176,7 @@ test.group('Bull', (group) => {
})()
})

const logger = (new FakeLogger({} as any) as unknown) as LoggerContract
const logger = new FakeLogger({} as any) as unknown as LoggerContract

class FakeExceptionHandler extends BullExceptionHandler {
constructor() {
Expand Down Expand Up @@ -223,7 +223,7 @@ test.group('Bull', (group) => {
})()
)

const logger = (new FakeLogger({} as any) as unknown) as LoggerContract
const logger = new FakeLogger({} as any) as unknown as LoggerContract

const bull = new BullManager(ioc, logger, CONNECTION_CONFIG, [
'App/Jobs/TestBull',
Expand Down Expand Up @@ -254,7 +254,7 @@ test.group('Bull', (group) => {
})()
)

const logger = (new FakeLogger({} as any) as unknown) as LoggerContract
const logger = new FakeLogger({} as any) as unknown as LoggerContract

const bull = new BullManager(ioc, logger, CONNECTION_CONFIG, [
'App/Jobs/TestBull',
Expand Down Expand Up @@ -285,7 +285,7 @@ test.group('Bull', (group) => {
async handle() {},
}))

const logger = (new FakeLogger({} as any) as unknown) as LoggerContract
const logger = new FakeLogger({} as any) as unknown as LoggerContract

const bull = new BullManager(ioc, logger, CONNECTION_CONFIG, [
'App/Jobs/TestBull',
Expand All @@ -309,7 +309,7 @@ test.group('Bull', (group) => {
async handle() {},
}))

const logger = (new FakeLogger({} as any) as unknown) as LoggerContract
const logger = new FakeLogger({} as any) as unknown as LoggerContract

const bull = new BullManager(ioc, logger, CONNECTION_CONFIG, [
'App/Jobs/TestBull',
Expand Down Expand Up @@ -342,10 +342,10 @@ test.group('Bull', (group) => {
})()
})

const logger = (new MyFakeLogger(
const logger = new MyFakeLogger(
assert,
{} as any
) as unknown) as LoggerContract
) as unknown as LoggerContract

const bull = new BullManager(ioc, logger, CONNECTION_CONFIG, [
'App/Jobs/TestBull',
Expand Down
Loading

0 comments on commit 3718f2d

Please sign in to comment.