-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Pipedrive - new components #18281
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
Pipedrive - new components #18281
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughIntroduces two new Pipedrive actions to merge deals and persons, adds a new instant source for general webhook events, updates common source ID construction for safer fallback, and bumps versions for several existing sources and the package. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Action as Pipedrive Action
participant SDK as pipedriveApp API Client
participant PD as Pipedrive API
rect rgba(220,245,255,0.5)
note over User,Action: Merge Deals / Merge Persons
User->>Action: Run with {sourceId, targetId}
Action->>SDK: api("<Entity>Api")
Action->>PD: merge<Entities>({ id: sourceId, merge_with_id: targetId })
PD-->>Action: { data }
Action-->>User: Export summary + return data
end
sequenceDiagram
autonumber
participant PD as Pipedrive Webhooks
participant Source as New Event (Instant) Source
participant Base as Common Base
participant App as Subscriber
rect rgba(240,255,240,0.6)
note over PD,Source: Webhook delivery
PD-->>Source: POST { meta: { action, entity, id }, data? }
Source->>Base: getExtraData() => { event_action, event_object }
Source->>Base: getSummary(body) => "New action.entity event"
Base-->>App: emit { id: (data.id || meta.id)-ts, summary, ts }
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 2
🧹 Nitpick comments (10)
components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs (2)
21-23: Harden getSummary against missing body.data.Base now tolerates missing body.data; getSummary should too to avoid
Cannot read properties of undefined.Apply:
- getSummary(body) { - return `Person successfully updated: ${body.data.id}`; - }, + getSummary(body) { + const id = body?.data?.id ?? body?.meta?.id ?? "unknown"; + return `Person successfully updated: ${id}`; + },
24-30: Guard parseData for cases with no data payload.If webhooks arrive without
body.data,parseDatamay not have the ID it needs. Consider early-returning raw body or skipping custom field enrichment when no ID is present.components/pipedrive/sources/updated-lead-instant/updated-lead-instant.mjs (2)
21-23: Avoid potential crash when body.data is absent.Mirror base behavior with a safe fallback.
Apply:
- getSummary(body) { - return `Lead successfully updated: ${body.data.id}`; - }, + getSummary(body) { + const id = body?.data?.id ?? body?.meta?.id ?? "unknown"; + return `Lead successfully updated: ${id}`; + },
24-29: Confirm custom fields source for Leads.Using
getDealCustomFieldsfor a lead looks suspicious. If agetLeadCustomFieldshelper exists (or leads use a different schema), switch to it; otherwise add a comment explaining the intentional reuse.- fn: this.pipedrive.getDealCustomFields, + // If available, prefer a lead-specific custom fields fetcher + fn: this.pipedrive.getLeadCustomFields ?? this.pipedrive.getDealCustomFields,components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs (1)
20-22: Make summary resilient to missing data.Use optional chaining and meta fallback.
- getSummary(body) { - return `New Deal successfully created: ${body.data.id}`; - }, + getSummary(body) { + const id = body?.data?.id ?? body?.meta?.id ?? "unknown"; + return `New Deal successfully created: ${id}`; + },components/pipedrive/sources/new-person-instant/new-person-instant.mjs (1)
20-22: Handle missing body.data in summary.Align with base’s safer ID logic.
- getSummary(body) { - return `New Person successfully created: ${body.data.id}`; - }, + getSummary(body) { + const id = body?.data?.id ?? body?.meta?.id ?? "unknown"; + return `New Person successfully created: ${id}`; + },components/pipedrive/sources/common/base.mjs (1)
42-42: Safer ID and timestamp handling for v2 webhooksGood fallback. Two optional hardening tweaks:
- Prefer entity_id before event id to keep grouping by entity when data is null: meta.entity_id exists in v2. (pipedrive.readme.io)
- Make timestamp parsing resilient to both RFC3339 strings and legacy UNIX seconds (notably v2 user webhooks pre–June 30, 2025). (developers.pipedrive.com)
Apply:
- this.$emit(await this.parseData(body), { - id: `${body.data?.id || body.meta?.id}-${ts}`, - summary: this.getSummary(body), - ts, - }); + const rawTs = body?.meta?.timestamp; + const tsParsed = typeof rawTs === "number" + ? rawTs * 1000 + : Date.parse(rawTs || ""); + const tsSafe = Number.isFinite(tsParsed) ? tsParsed : Date.now(); + + const entityId = body?.data?.id ?? body?.meta?.entity_id; + const eventId = body?.meta?.id; // UUID in v2 + + this.$emit(await this.parseData(body), { + id: `${entityId ?? eventId}-${tsSafe}`, + summary: this.getSummary(body), + ts: tsSafe, + });components/pipedrive/sources/new-event-instant/new-event-instant.mjs (2)
7-7: Link to v2 docs instead of v1This source targets webhooks v2; point users to the v2 guide. (pipedrive.readme.io)
- description: "Emit new event when a new webhook event is received. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Webhooks#addWebhook)", + description: "Emit new event when a new webhook event is received. See the Webhooks v2 guide.",Additional (outside diff): consider linking to the v2 guide URL used in docs.
12-41: Default to “.” to match issue requirement and v2 patternSetting defaults improves UX and aligns with “receive notifications for all events”. v2 supports create/change/delete and listed objects incl. lead/user. (pipedrive.readme.io)
eventAction: { type: "string", label: "Event Action", description: "The type of action to receive notifications about. Wildcard (*) will match all supported actions.", + default: "*", options: [ "*", "create", "change", "delete", ], }, eventObject: { type: "string", label: "Event Object", description: "The type of object to receive notifications about. Wildcard (*) will match all supported objects.", + default: "*", options: [ "*", "activity", "deal", "lead", "note", "organization", "person", "pipeline", "product", "stage", "user", ], },components/pipedrive/actions/merge-deals/merge-deals.mjs (1)
6-6: Docstring is fine; optionally mention target precedenceYou may mirror Persons wording to note the target’s data is prioritized on conflicts for consistency. (github.com)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (10)
components/pipedrive/actions/merge-deals/merge-deals.mjs(1 hunks)components/pipedrive/actions/merge-persons/merge-persons.mjs(1 hunks)components/pipedrive/package.json(1 hunks)components/pipedrive/sources/common/base.mjs(1 hunks)components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs(1 hunks)components/pipedrive/sources/new-event-instant/new-event-instant.mjs(1 hunks)components/pipedrive/sources/new-person-instant/new-person-instant.mjs(1 hunks)components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs(1 hunks)components/pipedrive/sources/updated-lead-instant/updated-lead-instant.mjs(1 hunks)components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-10-10T19:18:27.998Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In `components/the_magic_drip/sources/common.mjs`, when processing items in `getAndProcessData`, `savedIds` is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.
Applied to files:
components/pipedrive/sources/common/base.mjs
📚 Learning: 2024-10-08T15:33:38.240Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Applied to files:
components/pipedrive/sources/new-event-instant/new-event-instant.mjs
⏰ 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: pnpm publish
- GitHub Check: Lint Code Base
🔇 Additional comments (7)
components/pipedrive/package.json (1)
3-3: Package version bump looks consistent with new components.Confirm CHANGELOG and release notes reflect 0.10.0 and that any publishing automation picks up the new actions/sources.
components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs (1)
10-10: Version bump only — OK.components/pipedrive/sources/updated-lead-instant/updated-lead-instant.mjs (1)
10-10: Version bump only — OK.components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs (1)
9-9: Version bump only — OK.components/pipedrive/sources/new-person-instant/new-person-instant.mjs (1)
9-9: Version bump only — OK.components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs (1)
10-10: Version bump only — LGTMNo functional changes. Safe patch release.
components/pipedrive/sources/new-event-instant/new-event-instant.mjs (1)
51-53: Summary format — LGTMv2 uses meta.action and meta.entity; this is accurate. (pipedrive.readme.io)
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.
LGTM!
Resolves #18168
Summary by CodeRabbit
New Features
Bug Fixes
Chores