-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - gorgias_oauth #17827
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 Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis update introduces comprehensive macro (canned response) management for the Gorgias OAuth integration, including new actions and sources for creating, updating, deleting, and listing macros. It also adds supporting constants, event types, and test events. Several version bumps are made to existing actions and sources, with no logic changes. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant GorgiasOAuthApp
participant GorgiasAPI
User->>Action: Trigger (e.g., Create Macro)
Action->>GorgiasOAuthApp: Call createMacro({ data })
GorgiasOAuthApp->>GorgiasAPI: POST /macros with data
GorgiasAPI-->>GorgiasOAuthApp: Macro created response
GorgiasOAuthApp-->>Action: Return macro data
Action-->>User: Output macro info
sequenceDiagram
participant Source
participant BasePolling
participant GorgiasOAuthApp
participant GorgiasAPI
Source->>BasePolling: run()
BasePolling->>GorgiasOAuthApp: list events (e.g., macro-updated)
GorgiasOAuthApp->>GorgiasAPI: GET /events?type=macro-updated
GorgiasAPI-->>GorgiasOAuthApp: Event list
GorgiasOAuthApp-->>BasePolling: Return events
BasePolling->>Source: For each event, getEventData(event)
Source->>GorgiasOAuthApp: getMacro({ id })
GorgiasOAuthApp->>GorgiasAPI: GET /macros/{id}
GorgiasAPI-->>GorgiasOAuthApp: Macro data
GorgiasOAuthApp-->>Source: Macro details
Source-->>BasePolling: Emit event
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ 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. 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: 2
🔭 Outside diff range comments (2)
components/gorgias_oauth/sources/ticket-message-created/ticket-message-created.mjs (2)
60-65: Potential crash when optional nested objects are missing
message.source,message.sender, ormessage.receivercan benull/undefinedfor some channels (e.g. internal notes).
Direct property access (message.source.type) throws, causing the whole poll cycle to fail.- && (!this.sourceType || message.source.type === this.sourceType) - && (!this.sender || message.sender.email === this.sender) - && (!this.receiver || message.receiver.email === this.receiver); + && (!this.sourceType || message.source?.type === this.sourceType) + && (!this.sender || message.sender?.email === this.sender) + && (!this.receiver || message.receiver?.email === this.receiver);
67-71: Minor: guard against malformed events
eventobjects without amessagefield will throw insideisRelevant. Consider a simple guard:- const { message } = event; - if (this.isRelevant(message)) { - this.emitEvent(message); + const { message } = event ?? {}; + if (message && this.isRelevant(message)) { + this.emitEvent(message); }
♻️ Duplicate comments (1)
components/gorgias_oauth/actions/update-macro/update-macro.mjs (1)
39-52: Same actions property type issue as create-macro.The
actionsproperty has the same type definition confusion as the create-macro action. Consider applying the same fix to clarify the expected input format.
🧹 Nitpick comments (5)
components/gorgias_oauth/sources/ticket-updated/ticket-updated.mjs (1)
8-9: Drop the “New” prefix – follow source-naming guidelinePer Pipedream component guidelines (and past learnings), sources that emit updates should be named
<Entity> Updated, not “New Updated ”.
Suggested:- name: "New Updated Ticket", + name: "Ticket Updated",components/gorgias_oauth/sources/ticket-message-created/ticket-message-created.mjs (2)
11-12: Version bump looks good – please reflect it in CHANGELOGThe component’s semantic version has been incremented to
0.1.8, but there’s no accompanying CHANGELOG entry in the repository (or at least not in this PR). Adding it keeps consumers informed of the change.
51-54: Unused emptydeploy()hookAn empty override silently shadows any logic that
base.hooks.deploymight contain.
If no custom boot-time work is needed, simply omit the override to inherit the base behaviour; otherwise document why it’s intentionally empty.hooks: { ...base.hooks, - deploy() {}, + // deploy() intentionally left blank – no bootstrap work required },components/gorgias_oauth/actions/create-macro/create-macro.mjs (1)
32-45: Clarify the actions property type definition.The
actionsproperty is defined astype: "string[]"but the description and example show JSON objects. This could confuse users about the expected input format. Consider updating the type to"string"with a note that it should be a JSON string array, or provide clearer documentation about the expected format.actions: { - type: "string[]", + type: "string", label: "Actions", - description: `A list of actions to be applied on tickets. [See the documentation](https://developers.gorgias.com/reference/create-macro) for more info. + description: `A JSON string array of actions to be applied on tickets. [See the documentation](https://developers.gorgias.com/reference/create-macro) for more info. \nExample: [{components/gorgias_oauth/sources/new-macro-created/new-macro-created.mjs (1)
20-29: Consider using $ context for logging instead of console.log.The error handling logic is sound, but consider using the execution context for logging instead of
console.logfor consistency with Pipedream logging practices.async getEventData(event) { try { return await this.gorgias_oauth.getMacro({ id: event.object_id, }); } catch (e) { - console.log(`Macro ${event.object_id} not found`); + // Macro not found - likely deleted after event was created return null; } },
📜 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 (25)
components/gorgias_oauth/actions/create-customer/create-customer.mjs(1 hunks)components/gorgias_oauth/actions/create-macro/create-macro.mjs(1 hunks)components/gorgias_oauth/actions/create-ticket-message/create-ticket-message.mjs(1 hunks)components/gorgias_oauth/actions/create-ticket/create-ticket.mjs(1 hunks)components/gorgias_oauth/actions/delete-macro/delete-macro.mjs(1 hunks)components/gorgias_oauth/actions/get-ticket/get-ticket.mjs(1 hunks)components/gorgias_oauth/actions/list-macros/list-macros.mjs(1 hunks)components/gorgias_oauth/actions/list-tickets/list-tickets.mjs(1 hunks)components/gorgias_oauth/actions/retrieve-customer/retrieve-customer.mjs(1 hunks)components/gorgias_oauth/actions/update-customer/update-customer.mjs(1 hunks)components/gorgias_oauth/actions/update-macro/update-macro.mjs(1 hunks)components/gorgias_oauth/actions/update-ticket/update-ticket.mjs(1 hunks)components/gorgias_oauth/common/constants.mjs(1 hunks)components/gorgias_oauth/gorgias_oauth.app.mjs(2 hunks)components/gorgias_oauth/package.json(2 hunks)components/gorgias_oauth/sources/common/base-polling.mjs(1 hunks)components/gorgias_oauth/sources/common/event-types.mjs(1 hunks)components/gorgias_oauth/sources/internal-note-created/internal-note-created.mjs(1 hunks)components/gorgias_oauth/sources/macro-updated/macro-updated.mjs(1 hunks)components/gorgias_oauth/sources/macro-updated/test-event.mjs(1 hunks)components/gorgias_oauth/sources/new-macro-created/new-macro-created.mjs(1 hunks)components/gorgias_oauth/sources/new-macro-created/test-event.mjs(1 hunks)components/gorgias_oauth/sources/ticket-created/ticket-created.mjs(1 hunks)components/gorgias_oauth/sources/ticket-message-created/ticket-message-created.mjs(1 hunks)components/gorgias_oauth/sources/ticket-updated/ticket-updated.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (15)
components/gorgias_oauth/actions/update-customer/update-customer.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/gorgias_oauth/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/gorgias_oauth/actions/create-ticket/create-ticket.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/gorgias_oauth/sources/ticket-updated/ticket-updated.mjs (1)
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.
components/gorgias_oauth/sources/common/event-types.mjs (1)
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.
components/gorgias_oauth/actions/create-customer/create-customer.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/gorgias_oauth/actions/create-ticket-message/create-ticket-message.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/gorgias_oauth/sources/macro-updated/test-event.mjs (2)
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.
components/gorgias_oauth/actions/list-macros/list-macros.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/gorgias_oauth/sources/new-macro-created/test-event.mjs (2)
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.
components/gorgias_oauth/sources/new-macro-created/new-macro-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-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.
components/gorgias_oauth/actions/update-macro/update-macro.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/gorgias_oauth/actions/create-macro/create-macro.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/gorgias_oauth/sources/common/base-polling.mjs (4)
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.
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.
components/gorgias_oauth/sources/macro-updated/macro-updated.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 (5)
components/gorgias_oauth/actions/list-macros/list-macros.mjs (2)
components/gorgias_oauth/gorgias_oauth.app.mjs (2)
params(264-264)macros(88-95)components/gorgias_oauth/actions/update-macro/update-macro.mjs (1)
macro(55-58)
components/gorgias_oauth/actions/get-ticket/get-ticket.mjs (4)
components/gorgias_oauth/actions/create-macro/create-macro.mjs (1)
response(54-57)components/gorgias_oauth/actions/delete-macro/delete-macro.mjs (1)
response(19-22)components/gorgias_oauth/actions/update-macro/update-macro.mjs (1)
response(65-69)components/gorgias_oauth/gorgias_oauth.app.mjs (1)
response(254-254)
components/gorgias_oauth/actions/update-macro/update-macro.mjs (3)
components/gorgias_oauth/actions/create-macro/create-macro.mjs (2)
data(48-53)response(54-57)components/gorgias_oauth/actions/delete-macro/delete-macro.mjs (1)
response(19-22)components/gorgias_oauth/gorgias_oauth.app.mjs (1)
response(254-254)
components/gorgias_oauth/actions/create-macro/create-macro.mjs (3)
components/gorgias_oauth/actions/update-macro/update-macro.mjs (2)
data(59-64)response(65-69)components/gorgias_oauth/actions/delete-macro/delete-macro.mjs (1)
response(19-22)components/gorgias_oauth/gorgias_oauth.app.mjs (1)
response(254-254)
components/gorgias_oauth/actions/delete-macro/delete-macro.mjs (4)
components/gorgias_oauth/actions/create-macro/create-macro.mjs (1)
response(54-57)components/gorgias_oauth/actions/get-ticket/get-ticket.mjs (1)
response(20-23)components/gorgias_oauth/actions/update-macro/update-macro.mjs (1)
response(65-69)components/gorgias_oauth/gorgias_oauth.app.mjs (1)
response(254-254)
⏰ 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: Publish TypeScript components
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (30)
components/gorgias_oauth/sources/ticket-updated/ticket-updated.mjs (1)
10-10: Confirm accompanying changelog / dependency bumpsThe version bump to
0.1.8is fine in isolation, but please ensure the change is reflected in:
•CHANGELOG.md(or equivalent)
• Any package‐level manifest/version aggregation (e.g.index.js, app definition)This keeps automated release tooling and user docs in sync.
components/gorgias_oauth/sources/internal-note-created/internal-note-created.mjs (1)
10-10: Version bump acknowledged – LGTMNo functional changes introduced in this module. The version bump to
0.0.2stays consistent with the coordinated release.components/gorgias_oauth/actions/create-ticket/create-ticket.mjs (1)
7-7: Minor version bump only – looks good
Create Ticketaction is nowv0.0.8; no logic modifications detected.components/gorgias_oauth/package.json (1)
3-3: Confirm compatibility with @pipedream/platform v3
We’ve bumped@pipedream/platformfrom^2→^3.1.0. Please verify that no v2-only or deprecated SDK methods remain in use and that all components still build and run correctly. Our quick import scan surfaced these files:
- components/gorgias_oauth/gorgias_oauth.app.mjs
- components/gorgias_oauth/actions/create-ticket-message/create-ticket-message.mjs
- components/gorgias_oauth/actions/update-customer/update-customer.mjs
- components/gorgias_oauth/sources/common/base-polling.mjs
• Ensure none of these use removed or renamed APIs.
• Run your CI/build/test suite to confirm everything works under v3.1.0.components/gorgias_oauth/sources/ticket-created/ticket-created.mjs (1)
10-10: Ticket source version bump ok
New Ticketsource moves tov0.1.8; no additional changes.components/gorgias_oauth/actions/create-customer/create-customer.mjs (1)
8-8: Create Customer version bump okAction incremented to
v0.0.7; implementation unchanged.components/gorgias_oauth/actions/update-customer/update-customer.mjs (1)
13-13: Version bump looks correctOnly the
versionfield changed from0.0.6→0.0.7. No functional impact detected. 👍components/gorgias_oauth/actions/retrieve-customer/retrieve-customer.mjs (1)
7-7: Version bump looks correct
versionupdated to0.0.7, consistent with related customer actions. No further changes. 👍components/gorgias_oauth/actions/update-ticket/update-ticket.mjs (1)
8-8: Version bump looks correctIncrement to
0.0.4aligns with ticket-related actions. No logic affected. 👍components/gorgias_oauth/actions/list-tickets/list-tickets.mjs (1)
7-7: Version bump looks correct
versionmoved to0.0.8. Matches coordinated release. 👍components/gorgias_oauth/actions/create-ticket-message/create-ticket-message.mjs (1)
10-10: Version bump looks correctUpdated to
0.0.4; no functional changes. 👍components/gorgias_oauth/sources/common/event-types.mjs (1)
9-11: LGTM! Macro event types follow established patterns.The new macro-related event types are consistently named and follow the existing kebab-case convention for string values. These additions align perfectly with the PR's objective of implementing comprehensive macro management functionality.
components/gorgias_oauth/sources/new-macro-created/test-event.mjs (1)
1-13: LGTM! Well-structured test event for macro creation.The test event provides a realistic representation of a newly created macro with appropriate field types and values. The empty
actionsarray is appropriate for a new macro, and the timestamp format follows ISO standards with timezone information.components/gorgias_oauth/sources/macro-updated/test-event.mjs (1)
1-22: LGTM! Comprehensive test event for macro updates.The test event effectively demonstrates an updated macro with a populated
actionsarray containing a realistic "addTags" action. Theupdated_datetimefield being populated and the configuredintentandlanguagefields appropriately represent a macro that has been modified after creation.components/gorgias_oauth/common/constants.mjs (2)
103-128: LGTM! Comprehensive macro intents with logical categorization.The
macroIntentsarray provides excellent coverage of customer service scenarios with a consistent category/action naming pattern. The intents span common e-commerce use cases including orders, returns, shipping, subscriptions, and general inquiries.
134-134: LGTM! Proper export of new constant.The
macroIntentsconstant is correctly added to the default export object, maintaining consistency with the existing export structure.components/gorgias_oauth/actions/list-macros/list-macros.mjs (3)
1-23: LGTM! Well-structured action definition.The action definition follows established patterns with proper imports, metadata, and prop definitions. The optional
searchparameter andlimitprop using propDefinition are appropriately configured.
24-38: LGTM! Proper pagination implementation.The pagination logic correctly uses the
paginateutility method and accumulates results in an array. This approach handles large result sets efficiently by streaming through paginated responses.
40-44: LGTM! Correct pluralization and summary formatting.The pluralization logic correctly handles both singular and plural cases for the summary message, following the established pattern from other actions. The summary message format aligns with platform conventions.
components/gorgias_oauth/actions/get-ticket/get-ticket.mjs (1)
1-27: LGTM! Clean and consistent implementation.The action follows established patterns from other Gorgias OAuth actions, correctly uses the propDefinition for
ticketId, and implements proper error context passing with$. The implementation is straightforward and consistent with the codebase standards.components/gorgias_oauth/actions/create-macro/create-macro.mjs (1)
47-60: LGTM! Proper data construction and API call pattern.The data object construction and API call follow the established patterns. The use of
parseObjectto handle the actions input and the response handling are implemented correctly.components/gorgias_oauth/actions/delete-macro/delete-macro.mjs (1)
1-26: LGTM! Clean delete action implementation.The action follows the established patterns, properly uses the propDefinition for
macroId, and implements the delete operation correctly. The implementation is minimal and focused, which is appropriate for a delete action.components/gorgias_oauth/sources/new-macro-created/new-macro-created.mjs (1)
1-32: LGTM! Well-structured event source implementation.The source properly extends the base polling source, uses appropriate event types and deduplication settings, and handles the scenario where a macro might not be found (likely due to deletion after the event was created). The overall structure follows established patterns.
components/gorgias_oauth/sources/common/base-polling.mjs (3)
44-52: LGTM! Abstract method pattern correctly implemented.The abstract methods (
getTsKey,getEventType,getEventData) properly throwConfigurationErrorwhen not implemented, enforcing that subclasses must provide these implementations. This follows the established pattern seen in other Pipedream components.
19-35: Event processing logic is well-structured.The
processEventmethod correctly:
- Fetches events with proper ordering (desc) and filtering by type
- Processes events asynchronously with Promise.all for performance
- Filters out null events (for cases where getEventData returns null)
- Emits events in chronological order using reverse()
36-43: Event emission logic is correctly implemented.The
emitEventmethod properly:
- Generates unique event IDs combining object ID and timestamp
- Uses the timestamp key from the abstract method
- Creates descriptive summaries with event type and ID
components/gorgias_oauth/sources/macro-updated/macro-updated.mjs (2)
14-19: Abstract method implementations are correct.The implementations properly override the base class methods:
getEventType()returns "macro-updated" for event filteringgetTsKey()returns "updated_datetime" for timestamp extraction
20-32: Smart event filtering and error handling.The
getEventDatamethod implements good logic:
- Filters out events where
created_datetime === updated_datetimeto avoid emitting creation events as updates- Properly handles errors when fetching macro details, logging the issue and returning null to prevent emission
- Uses the app's
getMacromethod for consistent API interactioncomponents/gorgias_oauth/gorgias_oauth.app.mjs (2)
83-106: macroId prop definition follows established patterns.The
macroIdprop definition correctly implements:
- Async options loading with pagination support via
prevContext.nextCursor- Proper mapping of macro data to label/value format
- Consistent structure with other ID prop definitions in the file
437-479: Macro CRUD methods are well-implemented.All five macro methods follow excellent patterns:
- Consistent parameter destructuring and method signatures
- Proper use of the
_makeRequesthelper for API calls- Correct HTTP methods (GET, POST, PUT, DELETE) for REST operations
- Standard endpoint patterns (
/macros,/macros/{id})- Consistent with existing methods in the app
Resolves #17430
Summary by CodeRabbit
New Features
Enhancements
Bug Fixes
Chores