fix: rename publilishEvent to publishEvent across codebase#6
fix: rename publilishEvent to publishEvent across codebase#6Erebuzzz wants to merge 3 commits intoatithi4dev:mainfrom
Conversation
- Fixed typo in function name from publilishEvent to publishEvent - Updated 11 files with 38+ usages - Fixed docker-compose.dev.yml double slash path - Removed unused options variable in auth.controller.ts
There was a problem hiding this comment.
Pull request overview
This PR fixes a misspelled event publishing function name (publilishEvent → publishEvent) across the TypeScript services/workers and the builder image scripts, plus a small docker-compose path cleanup and minor auth controller cleanup.
Changes:
- Renamed
publilishEventtopublishEventand updated imports/exports/usages across the repo. - Fixed an invalid double-slash env_file path in
docker-compose.dev.yml. - Removed an unused variable and did formatting cleanup in
auth.controller.ts.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/domain/src/publisher.ts | Renames exported event publisher to publishEvent. |
| packages/domain/src/index.ts | Re-exports publishEvent from the domain package entrypoint. |
| docker-compose.dev.yml | Fixes double-slash path in env_file. |
| api-gateway/src/controllers/deployment.controller.ts | Updates import and call site to publishEvent. |
| api-gateway/src/controllers/auth.controller.ts | Removes unused variable and reformats refresh token handler. |
| WORKERS/clone-worker/src/workers/clone.ts | Updates domain import and calls to publishEvent. |
| WORKERS/build-worker/src/workers/build.ts | Updates domain import and calls to publishEvent. |
| WORKERS/build-worker/src/services/distributionHandler/buildFrontend.ts | Updates domain import and calls to publishEvent. |
| WORKERS/build-worker/src/services/distributionHandler/buildBackend.ts | Updates domain import and calls to publishEvent. |
| BUILDER_IMAGES/builder-image-frontend/script.js | Updates require and calls to publishEvent. |
| BUILDER_IMAGES/builder-image-frontend/publisher.js | Renames function/export to publishEvent. |
| BUILDER_IMAGES/build-image-backend/script.js | Updates require/calls to publishEvent. |
| BUILDER_IMAGES/build-image-backend/publisher.js | Renames function/export to publishEvent (but retains some problematic debug/export code). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) as { tokenVersion: number, sub: string }; | ||
|
|
||
| const user = await User.findById(decodedToken?.sub); | ||
| if(!user){ | ||
| if (!user) { | ||
| throw new ApiError(404, "Invalid refresh Token"); | ||
| } | ||
|
|
||
| if(decodedToken?.tokenVersion! != user?.tokenVersion){ | ||
| if (decodedToken?.tokenVersion! != user?.tokenVersion) { | ||
| throw new ApiError(404, "Invalid Refresh Token"); |
There was a problem hiding this comment.
decodedToken.tokenVersion and user.tokenVersion are numbers; using != introduces type coercion and can mask unexpected types. Prefer a strict comparison (!==) (and you likely don’t need the optional chaining / non-null assertion here since jwt.verify is typed to return the required fields).
| } catch (error) { | ||
| throw new ApiError(404, "Failed to refresh refresh-token"); | ||
| } |
There was a problem hiding this comment.
The catch-all error path throws a 404 (Not Found) for any refresh failure, including JWT verification errors and server issues. Consider returning a 401/403 for invalid/expired refresh tokens and a 500 for unexpected failures, and avoid the duplicated wording in the message ("refresh refresh-token").
| module.exports = { publishEvent }; | ||
|
|
||
|
|
||
| console.log("publilishEvent type:", typeof publilishEvent); | ||
| console.log("publishEvent type:", typeof publishEvent); | ||
|
|
||
| module.exports = { publilishEvent }; No newline at end of file | ||
| module.exports = { publishEvent }; No newline at end of file |
There was a problem hiding this comment.
module.exports is assigned twice and there's a top-level console.log that will run on every require/import. This creates noisy logs in production and makes the module harder to reason about; keep a single export assignment and remove the debug log (or gate it behind an explicit debug flag).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
⏰ PR Update Needed This PR has been waiting for 14 days. Please:
If this PR is no longer needed, please close it. Thank you! |
Summary
Fixed typo in function name
publilishEvent→ publishEvent across the codebase.Changes
optionsvariable in auth.controller.tsVerification