Skip to content

Commit

Permalink
fix(deps): update @vladfrangu/async_event_emitter (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranet authored Jul 21, 2024
1 parent 301a15d commit 26d4b68
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
"dependencies": {
"@types/ws": "^8.5.10",
"@vladfrangu/async_event_emitter": "2.4.1",
"@vladfrangu/async_event_emitter": "2.4.4",
"tldts": "^6.1.31",
"undici": "^6.19.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/lib/structures/http/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface ServerEvents {
[ServerEvent.RouterBranchMethodNotAllowed]: [request: ApiRequest, response: ApiResponse, node: RouterBranch];
[ServerEvent.RouterFound]: [request: ApiRequest, response: ApiResponse];
[ServerEvent.RouteError]: [error: Error, request: ApiRequest, response: ApiResponse];
[ServerEvent.MiddlewareFailure]: [error: Error, request: ApiRequest, response: ApiResponse];
[ServerEvent.MiddlewareFailure]: [request: ApiRequest, response: ApiResponse];
[ServerEvent.MiddlewareSuccess]: [request: Route.Request, response: Route.Response, route: Route];
[ServerEvent.MiddlewareError]: [error: Error, request: ApiRequest, response: ApiResponse];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class PluginListener extends Listener {
try {
await request.route!.run(request, response);
} catch (error) {
this.container.server.emit(ServerEvent.RouteError, error, request, response);
this.container.server.emit(ServerEvent.RouteError, error as Error, request, response);
}
}
}
4 changes: 2 additions & 2 deletions packages/api/src/listeners/PluginServerRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class PluginListener extends Listener {
// Middlewares need to be run regardless of the match, specially since browsers do an OPTIONS request first.
await this.container.server.middlewares.run(request, response);
} catch (error) {
this.container.server.emit(ServerEvent.MiddlewareError, error, request, response);
this.container.server.emit(ServerEvent.MiddlewareError, error as Error, request, response);

// If a middleware errored, it might cause undefined behavior in the routes, so we will return early.
return;
Expand All @@ -38,7 +38,7 @@ export class PluginListener extends Listener {
if (branch === null) {
this.container.server.emit(ServerEvent.RouterBranchNotFound, request, response);
} else if (route === null) {
this.container.server.emit(ServerEvent.RouterBranchMethodNotAllowed, request, response);
this.container.server.emit(ServerEvent.RouterBranchMethodNotAllowed, request, response, branch);
} else {
this.container.server.emit(ServerEvent.RouterFound, request, response);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/listeners/PluginServerRouterFound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class PluginListener extends Listener {
}

public override run(request: ApiRequest, response: ApiResponse) {
this.container.server.emit(response.writableEnded ? ServerEvent.MiddlewareFailure : ServerEvent.MiddlewareSuccess, request, response);
const event = response.writableEnded ? ServerEvent.MiddlewareFailure : ServerEvent.MiddlewareSuccess;
this.container.server.emit(event, request, response);
}
}
11 changes: 9 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ __metadata:
"@favware/cliff-jumper": "npm:^4.0.2"
"@favware/rollup-type-bundler": "npm:^3.3.0"
"@types/ws": "npm:^8.5.10"
"@vladfrangu/async_event_emitter": "npm:2.4.1"
"@vladfrangu/async_event_emitter": "npm:2.4.4"
concurrently: "npm:^8.2.2"
tldts: "npm:^6.1.31"
tsup: "npm:^8.1.0"
Expand Down Expand Up @@ -1684,7 +1684,14 @@ __metadata:
languageName: node
linkType: hard

"@vladfrangu/async_event_emitter@npm:2.4.1, @vladfrangu/async_event_emitter@npm:^2.2.4":
"@vladfrangu/async_event_emitter@npm:2.4.4":
version: 2.4.4
resolution: "@vladfrangu/async_event_emitter@npm:2.4.4"
checksum: 10/634c2d656fb3a3b47584865b5bf2b92f06f19a0018324340c29f2215a82fc96b4997dc2a78c6aeefcb29b6b2f8c03e8f06234b45965b706f7bde5b997b7d8be2
languageName: node
linkType: hard

"@vladfrangu/async_event_emitter@npm:^2.2.4":
version: 2.4.1
resolution: "@vladfrangu/async_event_emitter@npm:2.4.1"
checksum: 10/f8212e81c56d4994b1d5bf23f66bb47d4254c80f1dee7437a411a0b9cd942ae53bb3f21400590c3c70121b299457a77241535567a1de35822a35044740ccb48e
Expand Down

0 comments on commit 26d4b68

Please sign in to comment.