-
Notifications
You must be signed in to change notification settings - Fork 5.6k
13266 components announcekit #19593
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
13266 components announcekit #19593
Conversation
- Added prop definitions for project ID, labels, and locale in the AnnounceKit app. - Implemented methods for listing projects, labels, locales, and creating posts. - Introduced new sources for tracking new comments and posts, along with their respective test events. - Added utility functions for object parsing. - Bumped version to 0.1.0 in package.json.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
WalkthroughAdds an AnnounceKit integration: GraphQL app client, Create Post action, three polling sources (new-post, new-comment, new-reaction) built on a shared paginated polling base, GraphQL queries and utilities, test events, and package version bumped to 0.1.0 with a platform dependency. Changes
Sequence Diagram(s)sequenceDiagram
participant Action as Create Post Action
participant App as AnnounceKit App
participant API as AnnounceKit API
participant Error as Error Handler
Action->>App: createPost({ projectId, content, labels, locale_id, isDraft })
App->>App: _getAuth() & _baseUrl()
App->>API: POST /gq/v2 (GraphQL mutation)
API-->>App: { data, errors }
alt errors present
App->>Error: throw ConfigurationError(first error message)
Error-->>Action: Error thrown
else success
App-->>Action: created post response
Action-->>Action: return summary + response
end
sequenceDiagram
participant Source as Polling Source
participant DB as DB (lastItemId)
participant App as AnnounceKit App
participant API as AnnounceKit API
Note over Source: deploy/run -> poll for activities
Source->>DB: _getLastItemId()
DB-->>Source: lastItemId (or null)
Source->>App: paginate(listActivities, { projectId, after: lastItemId })
loop per page
App->>API: POST /gq/v2 (GraphQL query with cursor)
API-->>App: activities page + cursor
end
App-->>Source: aggregated activities
Source->>Source: filter items with id > lastItemId
Source->>Source: sort chronologically (oldest first)
Source->>DB: _setLastItemId(newestId)
loop emit each new item
Source-->>Source: emit({ id, summary, ts, payload })
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing touches
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: 12
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (12)
components/announcekit/actions/create-post/create-post.mjscomponents/announcekit/announcekit.app.mjscomponents/announcekit/common/queries.mjscomponents/announcekit/common/utils.mjscomponents/announcekit/package.jsoncomponents/announcekit/sources/common/base.mjscomponents/announcekit/sources/new-comment/new-comment.mjscomponents/announcekit/sources/new-comment/test-event.mjscomponents/announcekit/sources/new-post/new-post.mjscomponents/announcekit/sources/new-post/test-event.mjscomponents/announcekit/sources/new-reaction/new-reaction.mjscomponents/announcekit/sources/new-reaction/test-event.mjs
🧰 Additional context used
🧠 Learnings (4)
📚 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/announcekit/sources/new-post/test-event.mjscomponents/announcekit/sources/new-reaction/test-event.mjs
📚 Learning: 2024-07-24T02:06:47.016Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
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/announcekit/sources/new-post/new-post.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/announcekit/package.json
📚 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/announcekit/sources/common/base.mjs
🧬 Code graph analysis (1)
components/announcekit/actions/create-post/create-post.mjs (1)
components/announcekit/common/utils.mjs (2)
parseObject(1-24)parseObject(1-24)
⏰ 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 (8)
components/announcekit/package.json (1)
1-18: LGTM! Version bump is appropriate.The version bump to 0.1.0 correctly reflects the addition of new actions and sources in this PR. The dependency on
@pipedream/platformis appropriate for Pipedream components.components/announcekit/common/utils.mjs (1)
1-24: LGTM! Robust input parsing with proper error handling.The
parseObjectutility correctly handles multiple input types (falsy values, arrays, strings, objects) with appropriate JSON parsing and error recovery. The try-catch blocks ensure the function never throws and returns sensible fallback values.components/announcekit/sources/new-comment/test-event.mjs (1)
1-35: LGTM! Test event payload structure is comprehensive.The sample event includes all relevant fields for a "new-feedback" activity with proper nesting of post and feedback entities. This provides a clear example of the expected event shape for testing and development.
components/announcekit/sources/new-post/test-event.mjs (1)
1-35: LGTM! Comprehensive test event for post creation.The sample post includes all relevant fields (metadata, flags, status, contents) and demonstrates both draft and content structure. This aligns well with the post schema defined in the GraphQL queries.
components/announcekit/sources/new-reaction/test-event.mjs (1)
1-35: LGTM! Test event properly demonstrates reaction structure.The sample reaction event (line 27:
"reaction": ":|") clearly distinguishes a reaction from a comment (line 28:"feedback": null), which helps illustrate the different activity types in the AnnounceKit activity feed.components/announcekit/sources/new-reaction/new-reaction.mjs (1)
1-28: LGTM! Source correctly extends base with appropriate filters.The new-reaction source properly:
- Extends the base polling source functionality
- Overrides
getSummaryto format reaction-specific messages- Overrides
getVariablesto filter for "new-reaction" activity types (lines 20-22)- Includes the sample event for testing
The implementation follows the established pattern for AnnounceKit sources.
components/announcekit/common/queries.mjs (1)
1-175: Define missinglistCommentsquery.The file references
queries.listCommentsinannouncekit.app.mjs(via thelistComments()method), but the query is not defined or exported inqueries.mjs. This will cause a runtime error. Add thelistCommentsGraphQL query definition toqueries.mjsand include it in the export statement.components/announcekit/sources/new-post/new-post.mjs (1)
4-23: Missing optional post status filter per PR objectives.The PR objectives specify an optional prop for post status (Draft/Published) to filter posts, but this component doesn't define such a prop or pass filtering parameters.
Consider adding a
postStatusprop and passing it throughgetVariables:🔎 Suggested implementation
Add to the export object after line 11:
dedupe: "unique", + props: { + ...base.props, + postStatus: { + type: "string", + label: "Post Status", + description: "Filter posts by status", + options: ["draft", "published"], + optional: true, + }, + }, methods: { ...base.methods, getSummary(post) { return `New Post with ID: ${post.id}`; }, + getVariables(variables) { + return { + ...variables, + ...(this.postStatus && { status: this.postStatus }), + }; + }, getFn() { return this.app.listPosts; },Note: Ensure the GraphQL
listPostsquery incommon/queries.mjsaccepts a status filter parameter.
- Updated project and label value assignments to use string IDs instead of parsed integers. - Moved the GraphQL query for listing projects to a separate constant for better maintainability. - Cleaned up unused code by removing the unimplemented generateMeta method.
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: 4
♻️ Duplicate comments (3)
components/announcekit/sources/common/base.mjs (2)
49-53: ID comparison may fail for string identifiers.The comparison
item.id <= lastItemIdassumes numeric IDs. GraphQL APIs typically return string IDs, which would use lexicographic ordering rather than numeric ordering, potentially causing incorrect filtering or missed events.🔎 Proposed fix
for await (const item of response) { - if (item.id <= lastItemId) break; + if (lastItemId && item.id === lastItemId) break; items.push(item); }Alternatively, if numeric comparison is intended, convert both to numbers:
- if (item.id <= lastItemId) break; + if (lastItemId && Number(item.id) <= Number(lastItemId)) break;
59-65: Guard against undefinedcreated_at.
Date.parse(item.created_at)will returnNaNifcreated_atis undefined or malformed, causing the event timestamp to be invalid.🔎 Proposed fix
for (const item of items.reverse()) { this.$emit(item, { id: item.id, summary: this.getSummary(item), - ts: Date.parse(item.created_at), + ts: item.created_at ? Date.parse(item.created_at) : Date.now(), }); }components/announcekit/announcekit.app.mjs (1)
157-172: Add null safety checks inpaginate.Lines 160 and 170 access nested properties without verifying that
data[itemsField]exists. This will throw if the API returns an unexpected structure or an error response.🔎 Proposed fix
do { variables.page = page++; const { data } = await fn(variables); + + if (!data?.[itemsField]) { + break; + } + const items = data[itemsField].items || data[itemsField].list; + + if (!items?.length) { + break; + } for (const d of items) { yield d; if (maxResults && ++count === maxResults) { return count; } } - hasMore = data[itemsField].page < data[itemsField].pages; + hasMore = (data[itemsField]?.page ?? 0) < (data[itemsField]?.pages ?? 0); } while (hasMore);
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
components/announcekit/announcekit.app.mjscomponents/announcekit/common/queries.mjscomponents/announcekit/sources/common/base.mjs
🧰 Additional context used
🧠 Learnings (5)
📚 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/announcekit/sources/common/base.mjs
📚 Learning: 2025-01-29T22:59:38.825Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 15436
File: components/printful/printful.app.mjs:55-63
Timestamp: 2025-01-29T22:59:38.825Z
Learning: Console.log statements should be removed before merging PRs to maintain code quality and prevent potential security risks from exposing sensitive information in logs.
Applied to files:
components/announcekit/sources/common/base.mjs
📚 Learning: 2025-07-09T18:07:12.426Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 17538
File: components/aircall/sources/new-sms/new-sms.mjs:19-25
Timestamp: 2025-07-09T18:07:12.426Z
Learning: In Aircall API webhook payloads, the `created_at` field is returned as an ISO 8601 string format (e.g., "2020-02-18T20:52:22.000Z"), not as milliseconds since epoch. For Pipedream components, this needs to be converted to milliseconds using `Date.parse()` before assigning to the `ts` field in `generateMeta()`.
Applied to files:
components/announcekit/sources/common/base.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/announcekit/announcekit.app.mjs
📚 Learning: 2025-08-27T17:25:10.425Z
Learnt from: jverce
Repo: PipedreamHQ/pipedream PR: 18187
File: packages/connect-react/src/utils/type-guards.ts:23-33
Timestamp: 2025-08-27T17:25:10.425Z
Learning: In the connect-react package, the isOptionWithLabel type guard intentionally restricts value types to string|number for runtime filtering purposes, even though LabelValueOption<T> allows any T. This runtime behavior should be preserved over type safety improvements.
Applied to files:
components/announcekit/announcekit.app.mjs
🧬 Code graph analysis (1)
components/announcekit/sources/common/base.mjs (2)
components/announcekit/actions/create-post/create-post.mjs (1)
response(68-79)components/announcekit/announcekit.app.mjs (1)
items(160-160)
⏰ 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: Publish TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (3)
components/announcekit/common/queries.mjs (1)
1-69: LGTM!The GraphQL query definitions are well-structured with proper variable types and field selections. The use of fragments for
activityandfeedbackinlistActivitiespromotes reusability.components/announcekit/sources/common/base.mjs (1)
4-20: LGTM!The base source structure follows Pipedream's polling source patterns correctly with proper prop definitions, timer configuration, and project ID integration.
components/announcekit/announcekit.app.mjs (1)
49-82: LGTM!The HTTP layer with
_baseUrl,_getAuth,_makeRequest, andquerymethods is well-structured and follows consistent patterns for GraphQL API integration.
- Changed project and label value assignments to parse IDs as integers for consistency and improved data handling.
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 (3)
components/announcekit/announcekit.app.mjs (3)
8-20: Type mismatch and unnecessary parseInt still present.GraphQL IDs are strings. The prop type should be
"string"instead of"integer", andparseInt()on line 17 should be removed.
21-35: Type mismatch and unnecessary parseInt still present.Same issue as
projectId- GraphQL label IDs are strings. Change type to"string[]"and removeparseInt()on line 32.
142-165: Null safety checks still missing in paginate.Lines 152 and 162 access nested properties without null checks. If the API returns an unexpected structure, this will throw a runtime error.
🔎 Proposed fix
do { variables.page = page++; const { data } = await fn(variables); + + if (!data?.[itemsField]) { + break; + } + const items = data[itemsField].items || data[itemsField].list; + + if (!Array.isArray(items)) { + break; + } for (const d of items) { yield d; if (maxResults && ++count === maxResults) { return count; } } - hasMore = data[itemsField].page < data[itemsField].pages; + hasMore = (data[itemsField]?.page ?? 0) < (data[itemsField]?.pages ?? 0); } while (hasMore);
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
components/announcekit/announcekit.app.mjs
🧰 Additional context used
🧠 Learnings (3)
📚 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/announcekit/announcekit.app.mjs
📚 Learning: 2025-08-27T17:25:10.425Z
Learnt from: jverce
Repo: PipedreamHQ/pipedream PR: 18187
File: packages/connect-react/src/utils/type-guards.ts:23-33
Timestamp: 2025-08-27T17:25:10.425Z
Learning: In the connect-react package, the isOptionWithLabel type guard intentionally restricts value types to string|number for runtime filtering purposes, even though LabelValueOption<T> allows any T. This runtime behavior should be preserved over type safety improvements.
Applied to files:
components/announcekit/announcekit.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/announcekit/announcekit.app.mjs
🧬 Code graph analysis (1)
components/announcekit/announcekit.app.mjs (1)
components/announcekit/sources/common/base.mjs (1)
items(49-49)
⏰ 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 (3)
components/announcekit/announcekit.app.mjs (3)
1-3: LGTM!Imports are clean and appropriate - using the Pipedream platform's axios wrapper and centralizing GraphQL queries in a separate module.
50-69: LGTM!Base HTTP methods are well-structured with proper separation of concerns. The centralized
_makeRequestpattern with axios wrapper is clean.
83-128: LGTM!All data-fetching methods are now consistent, using GraphQL queries from the centralized
queries.mjsmodule. The previous concern about inline query inlistProjectshas been addressed.
lcaresia
left a 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.
LGTM!
For Integration QA: |
|
Hi everyone, all test cases are passed! Ready for release! Test reports
|
Resolves #13266
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.