Skip to content

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Oct 9, 2025

Resolves #18646

Summary by CodeRabbit

  • New Features

    • Added a task scheduling backend to improve event scheduling and management.
    • Upcoming Event Alert now accepts a new secret "Pipedream API Key" prop for configurable scheduling; previous pipedream prop removed.
    • Improved alert message formatting (cleaner spacing when summaries exist).
  • Chores

    • Bumped component and package versions.
    • Updated platform dependency to a newer minor release.

Copy link

vercel bot commented Oct 9, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Oct 9, 2025 4:36pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Oct 9, 2025 4:36pm

Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

Walkthrough

Adds a new taskScheduler utility for Google Calendar sources, replaces a connected Pipedream prop with a secret pipedreamApiKey prop in the upcoming-event-alert source, updates its description and version, adjusts scheduling calls to pass the API key, and bumps package and dependency versions.

Changes

Cohort / File(s) Summary of Changes
Version bump
components/google_calendar/package.json
Bump package 0.5.11 → 0.5.12; update dependency @pipedream/platform ^3.0.0 → ^3.1.0.
New task scheduler utility
components/google_calendar/sources/common/taskScheduler.mjs
Add new default-exported task scheduler with API helper (_makeAPIRequest), channel helpers (selfChannel, queuedEventsChannel), subscription helpers (subscribe, selfSubscribe), scheduling APIs (emitScheduleEvent, emitEvent, listEvents, deleteEvent, deleteScheduledEvent); uses axios from @pipedream/platform and uuid.
Upcoming event alert refactor
components/google_calendar/sources/upcoming-event-alert/upcoming-event-alert.mjs
Import shorter common scheduler path; description condensed; version 0.0.10 → 0.1.0; remove pipedream connected-account prop and add pipedreamApiKey secret string prop; pass pipedreamApiKey to selfSubscribe and deleteScheduledEvent; adjust message formatting when emitting events.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Source as UpcomingEventAlert Source
  participant Scheduler as TaskScheduler (common)
  participant PDAPI as Pipedream API

  rect rgba(220,235,255,0.4)
    note over Source,Scheduler: Setup
    User->>Source: Deploy / Enable
    Source->>Scheduler: selfSubscribe(pipedreamApiKey)
    Scheduler->>PDAPI: POST /subscriptions (self channel)
    PDAPI-->>Scheduler: Subscription created / exists
    Scheduler-->>Source: Ack
  end

  rect rgba(220,255,220,0.35)
    note over Source,Scheduler: Emit upcoming event
    Source->>Scheduler: emitScheduleEvent(event, timestamp)
    Scheduler->>PDAPI: POST /events (channel=self, metadata.id=UUID)
    PDAPI-->>Scheduler: Event queued
    Scheduler-->>Source: Emission logged
  end
Loading
sequenceDiagram
  autonumber
  participant Source as UpcomingEventAlert Source
  participant Scheduler as TaskScheduler (common)
  participant PDAPI as Pipedream API

  rect rgba(255,245,200,0.5)
    note over Source,Scheduler: Cancel scheduled event
    Source->>Scheduler: deleteScheduledEvent(event, pipedreamApiKey)
    Scheduler->>PDAPI: GET /events (channel=$in)
    PDAPI-->>Scheduler: Event summaries
    alt Match by metadata.id
      Scheduler->>PDAPI: DELETE /events?start_id=ID&end_id=ID
      PDAPI-->>Scheduler: Deleted
      Scheduler-->>Source: true
    else No match
      Scheduler-->>Source: false
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A rabbit taps the calendar tree,
New keys in paw, no accounts to see.
It queues a hop, then cancels light—
Events line up, then take to flight.
Version crumbs along the trail—schedules set, we sail. 🐇📆

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning The implementation adds the new secret prop and updates scheduling calls as specified, but it does not appear to refactor the deactivate hook required by issue #18646. Ensure that the deactivate hook is refactored according to the linked issue and verify that all scheduling API requests are correctly ported into the trigger logic.
Out of Scope Changes Check ⚠️ Warning The pull request includes a version bump in package.json and an update to the @pipedream/platform dependency, which are not mentioned in the linked issue objectives and are unrelated to adding the API key prop. Remove or separate the dependency and version updates into a different PR so that this change remains focused solely on implementing the Pipedream API key prop.
Description Check ⚠️ Warning The description only contains “Resolves #18646” and does not follow the repository’s template by omitting the required WHY section, rationale, and any context explaining the change. Please update the PR description to include the WHY section from the template, detailing the motivation behind replacing the connected account and how the new secret prop solves the problem.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and concisely summarizes the main change by indicating that the Google Calendar component now uses the Pipedream API key as a prop, which directly reflects the core feature implemented in the pull request.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-18646

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (3)
components/google_calendar/sources/common/taskScheduler.mjs (3)

15-18: Simplify URL construction logic.

The URL construction can be simplified for better readability.

Apply this diff:

-  opts.url = `https://api.pipedream.com/v1${path[0] === "/"
-    ? ""
-    : "/"
-  }${path}`;
+  const normalizedPath = path.startsWith("/") ? path : `/${path}`;
+  opts.url = `https://api.pipedream.com/v1${normalizedPath}`;

27-41: Use const instead of let for immutable variable.

The params variable is never reassigned, so it should be declared with const.

Apply this diff:

-  let params = {
+  const params = {
     emitter_id,
     listener_id,
   };

54-75: Add input validation for timestamp and event parameters.

The emitScheduleEvent method should validate its inputs before processing.

Apply this diff:

 emitScheduleEvent(event, timestamp) {
+  if (!event) {
+    throw new Error("event is required");
+  }
+  if (!timestamp) {
+    throw new Error("timestamp is required");
+  }
+  
   const selfChannel = this.selfChannel();
   const epoch = Date.parse(timestamp);
+  
+  if (isNaN(epoch)) {
+    throw new Error("Invalid timestamp format");
+  }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1744391 and 6c38c5d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • components/google_calendar/package.json (2 hunks)
  • components/google_calendar/sources/common/taskScheduler.mjs (1 hunks)
  • components/google_calendar/sources/upcoming-event-alert/upcoming-event-alert.mjs (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
components/google_calendar/sources/common/taskScheduler.mjs (2)
components/spotify/actions/get-album-tracks/get-album-tracks.mjs (1)
  • axios (53-56)
components/google_calendar/sources/upcoming-event-alert/upcoming-event-alert.mjs (2)
  • params (96-100)
  • params (102-106)
components/google_calendar/sources/upcoming-event-alert/upcoming-event-alert.mjs (1)
components/google_calendar/sources/common/taskScheduler.mjs (1)
  • event (82-82)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (6)
components/google_calendar/package.json (1)

3-3: LGTM! Version bumps are appropriate.

The package version increment and platform dependency update align with the new task scheduling functionality introduced in this PR.

Also applies to: 14-14

components/google_calendar/sources/upcoming-event-alert/upcoming-event-alert.mjs (4)

2-2: LGTM! Import path updated correctly.

The import path now references the new common task scheduler utility introduced in this PR.


8-9: LGTM! Version and description updates are appropriate.

The version bump to 0.1.0 correctly reflects the breaking change in the public API (removing pipedream prop and adding pipedreamApiKey), and the description is now more concise.


15-20: LGTM! API key prop is properly configured.

The pipedreamApiKey prop is correctly defined as a secret string with clear documentation linking to where users can find their API key. This aligns with the PR objectives to replace the connected account with a configured prop.


127-129: LGTM! Message formatting improved.

The conditional formatting now correctly produces "Upcoming [summary] event" when a summary exists and "Upcoming event" when it doesn't, eliminating unnecessary whitespace.

components/google_calendar/sources/common/taskScheduler.mjs (1)

135-145: LGTM! Event emission logic is clean.

The emitEvent method correctly cleans up internal fields before emission and provides appropriate defaults.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
components/google_calendar/sources/common/taskScheduler.mjs (1)

27-41: Consider validating required subscription parameters.

The emitter_id and listener_id parameters are required for the subscription to succeed, but are not validated before the API call.

Add validation at the start of the method:

 async subscribe(emitter_id, listener_id, event_name = null, apiKey) {
+  if (!emitter_id || !listener_id) {
+    throw new Error("emitter_id and listener_id are required");
+  }
   let params = {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c38c5d and 153947f.

📒 Files selected for processing (1)
  • components/google_calendar/sources/common/taskScheduler.mjs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/google_calendar/sources/common/taskScheduler.mjs (1)
components/google_calendar/sources/upcoming-event-alert/upcoming-event-alert.mjs (2)
  • params (96-100)
  • params (102-106)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish

Copy link
Collaborator

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @michelle0927, LGTM! Ready for QA!

@vunguyenhung vunguyenhung merged commit 0b409f1 into master Oct 10, 2025
10 checks passed
@vunguyenhung vunguyenhung deleted the issue-18646 branch October 10, 2025 07:21
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.

[FEATURE] Google Calendar - Pipedream API Key as a prop, not connected account

3 participants