-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New Components - teamwork #17721
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
New Components - teamwork #17721
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
""" WalkthroughThis update introduces new actions and sources for Teamwork user management, including creating, updating, retrieving, and listing users, as well as sources for user-related events. The Teamwork app gains CRUD methods for people and companies. Supporting utilities and common event-handling logic are added, and several existing actions and sources receive minor version bumps and metadata updates. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant TeamworkApp
participant TeamworkAPI
User->>Action: Trigger (e.g., Create User)
Action->>TeamworkApp: Call createPerson(data)
TeamworkApp->>TeamworkAPI: POST /people.json (with data)
TeamworkAPI-->>TeamworkApp: Response (user details)
TeamworkApp-->>Action: Return response
Action-->>User: Summary and user details
sequenceDiagram
participant TeamworkAPI
participant WebhookSource
participant CommonSource
participant Consumer
TeamworkAPI->>WebhookSource: Send event (e.g., USER.CREATED)
WebhookSource->>CommonSource: run(event)
CommonSource->>CommonSource: Validate HMAC
CommonSource->>WebhookSource: generateMeta(body)
CommonSource-->>Consumer: Emit event with metadata
Estimated code review effort4 (~90 minutes) Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/teamwork/actions/create-user/create-user.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/teamwork/actions/list-users/list-users.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ 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). (3)
✨ 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
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: 6
🧹 Nitpick comments (5)
components/teamwork/common/utils.mjs (1)
1-25
: Well-implemented recursive object parser with minor considerations.The
parseObject
function correctly handles the recursive parsing of nested data structures. The implementation properly handles edge cases like falsy values and JSON parsing failures.Consider these potential improvements:
- Add protection against circular references to prevent stack overflow
- Consider performance implications for deeply nested structures
- Document the intended use cases and limitations
+/** + * Recursively parses an object, attempting to JSON.parse string values + * while preserving the original structure for arrays and objects. + * @param {any} obj - The value to parse + * @returns {any} - The parsed value + */ export const parseObject = (obj) => {components/teamwork/sources/new-user-created/new-user-created.mjs (1)
16-22
: Consider defensive programming for name concatenation.The name concatenation in line 19 could fail if
User.FirstName
orUser.LastName
are null/undefined. Consider adding null checks or default values.generateMeta(body) { return { id: body["User.ID"], - summary: body["User.FirstName"] + " " + body["User.LastName"], + summary: `${body["User.FirstName"] || ""} ${body["User.LastName"] || ""}`.trim() || "Unknown User", ts: Date.parse(body["User.DateCreated"]), }; },components/teamwork/actions/list-users/list-users.mjs (1)
45-72
: Consider optimizing pagination logic.The current implementation may fetch more records than needed when approaching the
maxResults
limit. Consider adjusting thepageSize
parameter based on remaining needed records.async run({ $ }) { let total, count = 0, page = 1; let users = []; const params = { sort: this.sort, sortOrder: this.sortDirection, - pageSize: 100, }; do { + const remaining = this.maxResults - count; + params.pageSize = Math.min(100, remaining); const items = await this.app.listPeople(page, $, params); total = items?.length; if (!total) { break; } users.push(...items); count += items.length; page++; } while (count < this.maxResults); - if (users.length > this.maxResults) { - users = users.slice(0, this.maxResults); - } $.export("$summary", `Found ${users.length} user${users.length === 1 ? "" : "s"}`); return users; },components/teamwork/actions/update-user/update-user.mjs (1)
203-203
: Fix typo in working hours description.There's a double period in the description.
- description: "Object containing working hours information. . [See the documentation](https://apidocs.teamwork.com/docs/teamwork/v1/people/post-people-json) for more information.", + description: "Object containing working hours information. [See the documentation](https://apidocs.teamwork.com/docs/teamwork/v1/people/post-people-json) for more information.",components/teamwork/actions/create-user/create-user.mjs (1)
192-192
: Fix typo in working hours description.There's a double period in the description, same as in the update-user action.
- description: "Object containing working hours information. . [See the documentation](https://apidocs.teamwork.com/docs/teamwork/v1/people/post-people-json) for more information.", + description: "Object containing working hours information. [See the documentation](https://apidocs.teamwork.com/docs/teamwork/v1/people/post-people-json) for more information.",
📜 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 (17)
components/teamwork/actions/create-task/create-task.mjs
(1 hunks)components/teamwork/actions/create-user/create-user.mjs
(1 hunks)components/teamwork/actions/delete-task/delete-task.mjs
(1 hunks)components/teamwork/actions/get-user/get-user.mjs
(1 hunks)components/teamwork/actions/list-project-tasks/list-project-tasks.mjs
(1 hunks)components/teamwork/actions/list-users/list-users.mjs
(1 hunks)components/teamwork/actions/update-task/update-task.mjs
(1 hunks)components/teamwork/actions/update-user/update-user.mjs
(1 hunks)components/teamwork/common/utils.mjs
(1 hunks)components/teamwork/package.json
(2 hunks)components/teamwork/sources/common/common-sources.mjs
(2 hunks)components/teamwork/sources/new-task/new-task.mjs
(1 hunks)components/teamwork/sources/new-user-created/new-user-created.mjs
(1 hunks)components/teamwork/sources/task-deleted/task-deleted.mjs
(1 hunks)components/teamwork/sources/task-updated/task-updated.mjs
(1 hunks)components/teamwork/sources/user-updated/user-updated.mjs
(1 hunks)components/teamwork/teamwork.app.mjs
(2 hunks)
🧰 Additional context used
🧠 Learnings (13)
components/teamwork/actions/create-task/create-task.mjs (1)
Learnt from: jcortes
PR: #14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In components/gainsight_px/actions/create-account/create-account.mjs
, the action name should be "Create Account" instead of "Create Memory".
components/teamwork/package.json (1)
Learnt from: jcortes
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.
components/teamwork/sources/common/common-sources.mjs (4)
Learnt from: GTFalcao
PR: #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.
Learnt from: GTFalcao
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.
Learnt from: GTFalcao
PR: #12697
File: components/salesforce_rest_api/sources/common.mjs:97-98
Timestamp: 2024-07-24T02:05:59.531Z
Learning: The processTimerEvent
method in the components/salesforce_rest_api/sources/common.mjs
file is intentionally left unimplemented to enforce that subclasses must implement this method, similar to an abstract class in object-oriented programming.
Learnt from: GTFalcao
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.
components/teamwork/sources/new-user-created/new-user-created.mjs (4)
Learnt from: GTFalcao
PR: #15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
Learnt from: GTFalcao
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.
Learnt from: GTFalcao
PR: #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.
Learnt from: GTFalcao
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.
components/teamwork/actions/list-users/list-users.mjs (3)
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the run
method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members
action, the correct format is Successfully retrieved ${response.data.length} members
.
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the run
method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members
action, the correct format is Successfully retrieved ${response.data.length} members
.
Learnt from: GTFalcao
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.
components/teamwork/sources/new-task/new-task.mjs (3)
Learnt from: GTFalcao
PR: #15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
Learnt from: GTFalcao
PR: #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.
Learnt from: GTFalcao
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.
components/teamwork/sources/task-updated/task-updated.mjs (5)
Learnt from: GTFalcao
PR: #15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
Learnt from: GTFalcao
PR: #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.
Learnt from: GTFalcao
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.
Learnt from: GTFalcao
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.
Learnt from: GTFalcao
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()
.
components/teamwork/actions/create-user/create-user.mjs (3)
Learnt from: jcortes
PR: #14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In components/gainsight_px/actions/create-account/create-account.mjs
, the action name should be "Create Account" instead of "Create Memory".
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the run
method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members
action, the correct format is Successfully retrieved ${response.data.length} members
.
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the run
method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members
action, the correct format is Successfully retrieved ${response.data.length} members
.
components/teamwork/sources/user-updated/user-updated.mjs (4)
Learnt from: GTFalcao
PR: #15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
Learnt from: GTFalcao
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.
Learnt from: GTFalcao
PR: #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.
Learnt from: GTFalcao
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.
components/teamwork/teamwork.app.mjs (1)
Learnt from: GTFalcao
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.
components/teamwork/actions/get-user/get-user.mjs (2)
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the run
method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members
action, the correct format is Successfully retrieved ${response.data.length} members
.
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the run
method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members
action, the correct format is Successfully retrieved ${response.data.length} members
.
components/teamwork/actions/update-user/update-user.mjs (2)
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the run
method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members
action, the correct format is Successfully retrieved ${response.data.length} members
.
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the run
method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members
action, the correct format is Successfully retrieved ${response.data.length} members
.
components/teamwork/sources/task-deleted/task-deleted.mjs (4)
Learnt from: GTFalcao
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.
Learnt from: GTFalcao
PR: #15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
Learnt from: GTFalcao
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.
Learnt from: GTFalcao
PR: #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.
🧬 Code Graph Analysis (2)
components/teamwork/actions/create-user/create-user.mjs (2)
components/teamwork/actions/update-user/update-user.mjs (1)
data
(420-484)components/teamwork/common/utils.mjs (2)
parseObject
(1-25)parseObject
(1-25)
components/teamwork/actions/update-user/update-user.mjs (2)
components/teamwork/actions/create-user/create-user.mjs (1)
data
(409-474)components/teamwork/common/utils.mjs (2)
parseObject
(1-25)parseObject
(1-25)
⏰ 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). (3)
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (24)
components/teamwork/actions/delete-task/delete-task.mjs (1)
8-8
: Version bump looks good.The version increment aligns with the coordinated updates across task-related actions mentioned in the PR summary.
components/teamwork/package.json (2)
3-3
: Appropriate version bump for new features.The minor version increment from 0.0.2 to 0.1.0 is appropriate given the addition of new user management actions and enhanced app methods.
16-16
: No breaking changes detected foraxios
usageI’ve verified that the Teamwork component:
- Imports axios from
@pipedream/platform
- Awaits
axios(ctx, params)
and treats the result as the HTTP response body (e.g.res.projects
)- Uses no other APIs whose behavior changed in v3
Since v3’s
axios
still returns the response body directly (same as v1.x) and the import path and component definitions are unchanged, the upgrade to@pipedream/platform@^3.1.0
won’t break existing code.components/teamwork/actions/list-project-tasks/list-project-tasks.mjs (1)
8-8
: Version bump is consistent with other task actions.The version increment aligns with the coordinated updates across task-related actions in this PR.
components/teamwork/actions/update-task/update-task.mjs (1)
8-8
: Version bump completes the coordinated task action updates.The version increment is consistent with the other task-related actions updated in this PR.
components/teamwork/actions/create-task/create-task.mjs (1)
6-6
: Version bump looks good.The version increment from "0.0.1" to "0.0.2" aligns with similar updates across other Teamwork task-related actions and maintains consistency without introducing functional changes.
components/teamwork/sources/common/common-sources.mjs (2)
30-32
: Good use of abstract method pattern.The
generateMeta()
method properly enforces implementation in subclasses, following established patterns for extensible base components. This ensures consistent metadata generation across different event types.
68-72
: Excellent standardization of event processing flow.The new
run()
method centralizes HMAC validation and event emission logic, reducing code duplication across event sources. The security validation with_checkHmac()
ensures webhook authenticity before processing events.components/teamwork/sources/new-user-created/new-user-created.mjs (1)
1-24
: Well-implemented user creation source.The source properly extends the common base and implements the required abstract methods. The event name "USER.CREATED" and metadata extraction using User fields are appropriate.
components/teamwork/sources/new-task/new-task.mjs (2)
8-10
: Good alignment with the new source architecture.The name update to include "(Instant)" and version bump properly reflect the refactoring to use the new common source pattern.
16-22
: Well-implemented generateMeta method.The metadata generation correctly uses Task fields and follows the established pattern from the common base. This refactoring eliminates code duplication while maintaining the same functionality.
components/teamwork/sources/task-updated/task-updated.mjs (1)
15-21
: Use the task’s update timestamp and convert it to millisecondsFor an “updated” event, you should emit when the change occurred (not when the task was created), and convert the ISO-8601 string into a numeric timestamp. Please confirm which field the webhook actually returns (e.g.
Task.DateUpdated
orTask.LastModified
) so you can reference it below.• File: components/teamwork/sources/task-updated/task-updated.mjs
• Lines: 15–21Suggested diff:
generateMeta(body) { return { id: body["Task.ID"], summary: body["Task.Name"], - ts: body["Task.DateCreated"], + ts: Date.parse( + body["Task.DateUpdated"] + ?? body["Task.LastModified"] + ?? body["Task.DateCreated"] + ), }; },– Replace
Task.DateUpdated
/Task.LastModified
with the actual update field.
– Fallback to creation date only if no update timestamp is available.
–Date.parse()
ensurests
is a number, not a string.components/teamwork/sources/user-updated/user-updated.mjs (1)
16-23
: Use update timestamp for user-updated eventsThe
user-updated
source is currently usingUser.DateCreated
as the event timestamp. For updates, you should prefer the actual update time (if provided by the webhook) and fall back to creation or now if not:• File: components/teamwork/sources/user-updated/user-updated.mjs
Lines: 16–23Suggested diff:
generateMeta(body) { - const ts = Date.parse(body["User.DateCreated"]); + // Prefer update time; fall back to creation date or current time + const rawTs = + body["User.DateUpdated"] || + body["User.LastModified"] || + body["User.DateCreated"]; + const ts = Date.parse(rawTs) || Date.now(); return { id: `${body["User.ID"]}-${ts}`, summary: body["User.FirstName"] + " " + body["User.LastName"], ts, }; },Please verify that the Teamwork webhook payload for user updates includes a
User.DateUpdated
orUser.LastModified
field. If not, confirm with the API spec or add appropriate field mapping.components/teamwork/teamwork.app.mjs (1)
79-91
: Well-structured API method implementationsThe new methods for user and company management are properly implemented following the existing patterns:
- Consistent error handling with empty defaults
- Proper HTTP methods and endpoint structure
- Backward-compatible extension of
listPeople
Also applies to: 173-218
components/teamwork/actions/update-user/update-user.mjs (5)
1-2
: LGTM - Clean imports.Proper imports of the app and parseObject utility function.
4-9
: LGTM - Well-structured action definition.The action metadata is properly defined with appropriate key, name, description, version, and type.
12-19
: LGTM - Proper user ID property definition.The peopleId property correctly uses propDefinition from the app and provides clear labeling for the user update context.
419-484
: LGTM - Comprehensive data mapping with proper object parsing.The data object construction correctly maps all properties to their API field names and properly uses parseObject for complex fields like address and working hours. The API call structure is appropriate.
485-487
: LGTM - Clear and informative summary message.The summary message follows the established pattern from the learnings and provides clear feedback about the operation result.
components/teamwork/actions/create-user/create-user.mjs (5)
1-2
: LGTM - Clean imports.Proper imports of the app and parseObject utility function.
4-9
: LGTM - Well-structured action definition.The action metadata is properly defined with appropriate key, name, description, version, and type.
12-32
: LGTM - Required fields properly defined.The essential user creation fields (email, first name, last name, company) are correctly defined with appropriate types and descriptions.
476-481
: LGTM - Proper cleanup of undefined values.The logic to remove undefined values from the data object before sending to the API is appropriate and prevents sending unnecessary null/undefined values.
409-474
: Add missing allowEmailNotifications field to data object.The data object is missing the
allowEmailNotifications
field that exists in the properties and is present in the update-user action."removeAvatar": this.removeAvatar, + "allowEmailNotifications": this.allowEmailNotifications, "user-type": this.userType,
Likely an incorrect or invalid review 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.
Hi @michelle0927, LGTM! Ready for QA!
Resolves #17464
Sources
Actions
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Chores