-
Notifications
You must be signed in to change notification settings - Fork 5.6k
13281 components surveybot #18940
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
13281 components surveybot #18940
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughThe PR adds three new action modules for SurveyBot (get-survey-respondent, get-survey-responses, list-surveys), a polling source component (new-survey-response), and enhances the SurveyBot app module with API helpers, pagination support, and propDefinitions. Package version incremented to 0.7.0. Changes
Sequence DiagramsequenceDiagram
participant Timer as Scheduler/Timer
participant Source as new-survey-response
participant DB as $.service.db
participant API as SurveyBot API
participant Pipedream as Pipedream Event System
Timer->>Source: Trigger (on interval)
Source->>DB: _getLastDate()
DB-->>Source: lastDate (or null on first run)
Source->>API: getSurveyResponses({ surveyId, $ })
API-->>Source: responses array
Source->>Source: Filter responses where started_at > lastDate
loop For each new response (reverse order)
Source->>Pipedream: $.emit() with id, summary, ts
end
alt New responses found
Source->>DB: _setLastDate(first_response.started_at)
end
DB-->>Source: lastDate updated
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (1 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: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
components/surveybot/actions/get-survey-respondent/get-survey-respondent.mjs(1 hunks)components/surveybot/actions/get-survey-responses/get-survey-responses.mjs(1 hunks)components/surveybot/actions/list-surveys/list-surveys.mjs(1 hunks)components/surveybot/package.json(2 hunks)components/surveybot/surveybot.app.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
Applied to files:
components/surveybot/package.json
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
Applied to files:
components/surveybot/surveybot.app.mjs
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.
Applied to files:
components/surveybot/surveybot.app.mjs
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: The Salesloft API list endpoints (listPeople, listCadences, listUsers, listAccounts) return arrays directly in the response body, not wrapped in a metadata object with a nested data property. The _makeRequest method correctly returns response.data which contains the arrays that can be mapped over directly in propDefinitions.
Applied to files:
components/surveybot/surveybot.app.mjs
🧬 Code graph analysis (1)
components/surveybot/surveybot.app.mjs (2)
components/surveybot/actions/list-surveys/list-surveys.mjs (1)
surveys(25-30)components/surveybot/actions/get-survey-responses/get-survey-responses.mjs (1)
responses(24-27)
⏰ 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: Publish TypeScript components
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (7)
components/surveybot/actions/get-survey-responses/get-survey-responses.mjs (1)
1-32: LGTM! Action is well-structured.The action correctly uses the surveybot app's
getSurveyResponsesmethod, properly defines the surveyId prop via propDefinition, and includes appropriate annotations for a read-only operation.components/surveybot/surveybot.app.mjs (2)
6-45: LGTM! PropDefinitions are well-structured.The propDefinitions correctly implement:
surveyIdwith async options that fetch and map surveysrespondentIdwith proper dependency onsurveyIdto fetch respondents from a specific survey's responsesThe dependency pattern follows Pipedream conventions.
47-63: LGTM! API helper methods are correctly implemented.The internal API methods properly:
- Define the base URL
- Construct headers with the API key from auth
- Use the Pipedream platform's axios instance with proper configuration
components/surveybot/actions/get-survey-respondent/get-survey-respondent.mjs (1)
1-41: LGTM! Action properly implements respondent retrieval.The action correctly:
- Defines both
surveyIdandrespondentIdprops with proper dependency- Uses
surveyIdto populate the respondentId dropdown options- Calls
getSurveyRespondentwith the respondentId- Returns the respondent data with an appropriate summary
components/surveybot/actions/list-surveys/list-surveys.mjs (2)
24-30: Action structure is correct, but note parameter mismatch.The pagination implementation is well-structured with proper async iteration. However, there's a parameter name mismatch between this file (passing
max) and thepaginatemethod insurveybot.app.mjs(expectingmaxResults). This issue has been flagged in the app file review.Once the parameter name is fixed in
surveybot.app.mjs, verify that pagination works correctly with the max results limit.
37-40: Nice touch on pluralization handling.The summary message properly handles singular/plural forms for the survey count, improving user experience.
components/surveybot/package.json (1)
3-3: Version downgrade confirmed—please verify intentionality.The version is being changed from 0.6.0 to 0.1.0, which is a confirmed downgrade. This violates semantic versioning conventions, especially since this PR adds new actions (get-survey-responses, get-survey-respondent, list-surveys) and upgrades the platform dependency from ^3.0.0 to ^3.1.0—both indicators of forward progress.
Please confirm whether this downgrade is intentional (e.g., due to a versioning reset or refactoring strategy) or if the version should be incremented to 0.7.0 or higher instead.
…h event emission capabilities
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
♻️ Duplicate comments (1)
components/surveybot/surveybot.app.mjs (1)
86-112: Fix parameter name mismatch in paginate method.The
paginatemethod expects amaxResultsparameter (line 87), but callers passmax(seelist-surveys.mjsline 27). This mismatch causes the max results limit to be ignored.Apply this diff to rename the parameter:
async *paginate({ - fn, params = {}, maxResults = null, dataField, ...opts + fn, params = {}, max = null, dataField, ...opts }) { let hasMore = false; let count = 0; let page = 0; do { params.page = ++page; const response = await fn({ params, ...opts, }); const data = response[dataField]; for (const d of data) { yield d; - if (maxResults && ++count === maxResults) { + if (max && ++count === max) { return count; } } hasMore = data.length; } while (hasMore); },
🧹 Nitpick comments (1)
components/surveybot/sources/new-survey-response/test-event.mjs (1)
31-87: Consider cleaning up test data for clarity.The test event includes several answers with "content removed" and null content. For test data clarity, consider either removing these entries entirely or using placeholder text like "Sample question text" to make the test event more representative and easier to understand.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
components/surveybot/sources/new-survey-response/new-survey-response.mjs(1 hunks)components/surveybot/sources/new-survey-response/test-event.mjs(1 hunks)components/surveybot/surveybot.app.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
Applied to files:
components/surveybot/surveybot.app.mjs
📚 Learning: 2024-10-08T15:33:38.240Z
Learnt from: LucBerge
Repo: PipedreamHQ/pipedream PR: 14080
File: components/nocodb/nocodb.app.mjs:133-133
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When implementing pagination with an offset, incrementing `args.params.offset` within the loop ensures correct tracking of the offset, particularly when a maximum count limit (`max`) is used.
Applied to files:
components/surveybot/surveybot.app.mjs
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.
Applied to files:
components/surveybot/surveybot.app.mjs
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: The Salesloft API list endpoints (listPeople, listCadences, listUsers, listAccounts) return arrays directly in the response body, not wrapped in a metadata object with a nested data property. The _makeRequest method correctly returns response.data which contains the arrays that can be mapped over directly in propDefinitions.
Applied to files:
components/surveybot/surveybot.app.mjs
📚 Learning: 2024-10-10T19:18:27.998Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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/surveybot/sources/new-survey-response/new-survey-response.mjs
🧬 Code graph analysis (2)
components/surveybot/surveybot.app.mjs (3)
components/surveybot/actions/list-surveys/list-surveys.mjs (1)
surveys(25-30)components/surveybot/sources/new-survey-response/new-survey-response.mjs (2)
responses(41-41)data(37-39)components/surveybot/actions/get-survey-responses/get-survey-responses.mjs (1)
responses(24-27)
components/surveybot/sources/new-survey-response/new-survey-response.mjs (1)
components/surveybot/surveybot.app.mjs (2)
data(100-100)response(95-98)
⏰ 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: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (7)
components/surveybot/surveybot.app.mjs (3)
7-24: LGTM!The surveyId propDefinition correctly fetches surveys with pagination and maps them to label-value options.
47-63: LGTM!The HTTP client implementation correctly constructs the base URL, headers with API key, and request wrapper using axios from @pipedream/platform.
64-85: LGTM!The API methods properly destructure required parameters and spread additional args into the request. The path construction for each endpoint is correct.
components/surveybot/sources/new-survey-response/new-survey-response.mjs (4)
1-27: LGTM!The component structure is well-defined with appropriate props including the surveybot app reference, db for state persistence, timer for polling, and surveyId from the app's propDefinition.
28-34: LGTM!The lastDate helper methods correctly use
db.get()anddb.set()for persistent state management, with a sensible default of 0 to include all responses on first run.
35-59: LGTM!The emitEvent logic correctly:
- Fetches survey responses
- Filters for items newer than lastDate
- Updates lastDate to the most recent response
- Emits events in chronological order (oldest first) with proper metadata
The date parsing using
Date.parse()should handle the API's date format reliably.
61-68: LGTM!The deploy hook properly emits up to 25 historical events, and the run hook triggers the polling logic. This follows Pipedream's standard polling source pattern.
For Integration QA: |
For Integration QA: |
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: 0
🧹 Nitpick comments (2)
components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs (1)
44-51: Remove redundant filtering.The
responseArrayis filtered twice by the same condition:
- Lines 46-48: Items are only pushed if
Date.parse(lead.date) > lastDate- Line 51: The array is filtered again by the same condition
The second filter on line 51 is redundant and can be removed.
Apply this diff to remove the redundant filter:
let responseArray = []; for await (const lead of leads) { if (Date.parse(lead.date) > lastDate) { responseArray.push(lead); } } - - responseArray = responseArray.filter((item) => Date.parse(item.date) > lastDate);components/popupsmart/popupsmart.app.mjs (1)
32-57: Consider minor pagination refinements.The pagination logic works correctly but has two minor points to consider:
- Line 50 returns
countfrom the generator, but this value may not be captured by typical for-await-of loops that consume the generator.- Line 54's
hasMore = leads.lengthwill make one extra API request when the last page contains exactlyLIMITitems. ConsiderhasMore = leads.length === LIMITfor more efficiency.These are minor issues and the current implementation is functional.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
components/popupsmart/package.json(2 hunks)components/popupsmart/popupsmart.app.mjs(1 hunks)components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs(1 hunks)components/popupsmart/sources/new-popup-form-data/test-event.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2024-10-10T19:18:27.998Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjscomponents/popupsmart/sources/new-popup-form-data/test-event.mjs
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.
Applied to files:
components/popupsmart/sources/new-popup-form-data/test-event.mjs
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
Applied to files:
components/popupsmart/popupsmart.app.mjs
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.
Applied to files:
components/popupsmart/popupsmart.app.mjs
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: The Salesloft API list endpoints (listPeople, listCadences, listUsers, listAccounts) return arrays directly in the response body, not wrapped in a metadata object with a nested data property. The _makeRequest method correctly returns response.data which contains the arrays that can be mapped over directly in propDefinitions.
Applied to files:
components/popupsmart/popupsmart.app.mjs
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
Applied to files:
components/popupsmart/package.json
🧬 Code graph analysis (2)
components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs (1)
components/the_magic_drip/actions/add-lead-to-campaign/add-lead-to-campaign.mjs (1)
lead(59-61)
components/popupsmart/popupsmart.app.mjs (1)
components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs (1)
leads(36-42)
⏰ 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: Verify TypeScript components
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
🔇 Additional comments (8)
components/popupsmart/package.json (1)
3-3: LGTM!The version bump to 0.1.0 is appropriate for the new features being added, and the
@pipedream/platformdependency is correctly included to support the axios import and polling utilities used in the new sources.Also applies to: 15-16
components/popupsmart/sources/new-popup-form-data/test-event.mjs (1)
1-31: LGTM!The test event data is comprehensive and includes all the necessary fields for testing the popup form data source.
components/popupsmart/sources/new-popup-form-data/new-popup-form-data.mjs (4)
1-26: LGTM!The component metadata and props are correctly configured for a polling source.
28-33: LGTM!Standard pattern for persisting the last processed date.
53-62: LGTM!The emission logic correctly sets the last processed date and emits events in chronological order (oldest first).
65-72: LGTM!The deploy hook and run method follow the standard polling source pattern.
components/popupsmart/popupsmart.app.mjs (2)
1-2: LGTM!The base URL and headers methods are correctly implemented for API authentication.
Also applies to: 8-16
17-31: LGTM!The request methods are correctly structured and follow Pipedream's axios patterns.
d25cf31 to
e7729b8
Compare
|
Hi everyone, all test cases are passed! Ready for release! Test reports
|
|
/approve |
Resolves #13281
Summary by CodeRabbit