Skip to content

Refactor Firebase Functions into logical modules#18

Open
yasu-hide wants to merge 2 commits into
masterfrom
refactor-modules-4422354086956148172
Open

Refactor Firebase Functions into logical modules#18
yasu-hide wants to merge 2 commits into
masterfrom
refactor-modules-4422354086956148172

Conversation

@yasu-hide

Copy link
Copy Markdown
Owner

The monolithic structure of the Firebase Functions has been refactored into several logical modules:

  • models.js: Handles all Firestore and Realtime Database interactions.
  • intents.js: Contains the logic for Google Smart Home intents (SYNC, QUERY, EXECUTE).
  • utils.js: Common utility functions like valuniq, flatten, and showError.
  • server.js: Configures the Express application and routes.
  • oauth2.js & oauth2_store.js: Refactored to use async/await.

The code has been modernized to use async/await syntax, improving readability and error handling. Compatibility issues with firebase-functions v7+ were addressed by explicitly using the v1 API where necessary. An ESLint configuration was added to maintain code quality.


PR created automatically by Jules for task 4422354086956148172 started by @yasu-hide

- Extracted data access layer to models.js
- Extracted Smart Home intent handlers to intents.js
- Extracted utility functions to utils.js
- Separated Express app configuration to server.js
- Modernized code using async/await
- Updated to use firebase-functions/v1 for compatibility with v7+
- Added ESLint configuration and fixed warnings

Co-authored-by: yasu-hide <5038337+yasu-hide@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Comment thread functions/server.js Fixed
Comment thread functions/server.js Fixed
Comment thread functions/server.js Fixed
Comment thread functions/server.js Fixed
- Added express-rate-limit dependency
- Applied rate limiting middleware to authentication and Smart Home endpoints
- Fixed CodeQL high severity vulnerabilities related to missing rate limiting on auth routes

Co-authored-by: yasu-hide <5038337+yasu-hide@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants