-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Google Calendar - Pipedream API Key as a prop #18699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds 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
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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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 withconst
.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
⛔ 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 addingpipedreamApiKey
), 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.
components/google_calendar/sources/upcoming-event-alert/upcoming-event-alert.mjs
Show resolved
Hide resolved
components/google_calendar/sources/upcoming-event-alert/upcoming-event-alert.mjs
Show resolved
Hide resolved
There was a problem hiding this 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
andlistener_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
📒 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
There was a problem hiding this 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!
Resolves #18646
Summary by CodeRabbit
New Features
Chores