Skip to content

Commit b76e8e6

Browse files
committed
fix: correct a few definition errors
1 parent c881d08 commit b76e8e6

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adonisjs/transmit",
3-
"version": "0.0.1",
3+
"version": "0.0.4",
44
"description": "A Server-Sent-Event module for AdonisJS.",
55
"keywords": [
66
"sse",
@@ -15,8 +15,8 @@
1515
"main": "build/index.js",
1616
"exports": {
1717
".": "./build/index.js",
18-
"./providers": "./build/providers/transmit_provider.js",
19-
"./services/transmit": "./build/src/services/transmit.js",
18+
"./providers/transmit_provider": "./build/providers/transmit_provider.js",
19+
"./services/transmit": "./build/services/transmit.js",
2020
"./types": "./build/src/types.js"
2121
},
2222
"scripts": {
@@ -66,7 +66,7 @@
6666
"index.ts",
6767
"build/src",
6868
"build/providers",
69-
"build/stubs",
69+
"build/services",
7070
"build/index.d.ts",
7171
"build/index.d.ts.map",
7272
"build/index.js"

providers/transmit_provider.ts

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,38 @@ export default class TransmitProvider {
1010
})
1111
}
1212

13-
boot() {
14-
this.app.container.resolving('router', async (router) => {
15-
const transmit = await this.app.container.make('transmit')
13+
async boot() {
14+
const router = await this.app.container.make('router')
15+
const transmit = await this.app.container.make('transmit')
1616

17-
router.get('__transmit/events', ({ request, response }) => {
18-
transmit.createStream(request, response)
19-
})
17+
router.get('__transmit/events', ({ request, response }) => {
18+
transmit.createStream(request, response)
19+
})
2020

21-
router.post('__transmit/subscribe', (ctx) => {
22-
const uid = ctx.request.input('uid')
23-
const channel = ctx.request.input('channel')
21+
router.post('__transmit/subscribe', (ctx) => {
22+
const uid = ctx.request.input('uid')
23+
const channel = ctx.request.input('channel')
2424

25-
const success = transmit.subscribeToChannel(uid, channel, ctx)
25+
const success = transmit.subscribeToChannel(uid, channel, ctx)
2626

27-
if (!success) {
28-
return ctx.response.badRequest()
29-
}
27+
if (!success) {
28+
return ctx.response.badRequest()
29+
}
3030

31-
return ctx.response.noContent()
32-
})
31+
return ctx.response.noContent()
32+
})
3333

34-
router.post('__transmit/unsubscribe', ({ request, response }) => {
35-
const uid = request.input('uid')
36-
const channel = request.input('channel')
34+
router.post('__transmit/unsubscribe', ({ request, response }) => {
35+
const uid = request.input('uid')
36+
const channel = request.input('channel')
3737

38-
const success = transmit.unsubscribeFromChannel(uid, channel)
38+
const success = transmit.unsubscribeFromChannel(uid, channel)
3939

40-
if (!success) {
41-
return response.badRequest()
42-
}
40+
if (!success) {
41+
return response.badRequest()
42+
}
4343

44-
return response.noContent()
45-
})
44+
return response.noContent()
4645
})
4746
}
4847
}

0 commit comments

Comments
 (0)