Skip to content

Conversation

@jcortes
Copy link
Collaborator

@jcortes jcortes commented Mar 20, 2025

WHY

Resolves #15841

Summary by CodeRabbit

  • New Features
    • Updated event triggers now provide clearer messaging for account and contact activities with enhanced debugging options.
    • Improved API interactions with explicit request handling and more efficient pagination for smoother data retrieval.
  • Chores
    • Standardized version updates across components.
    • Revised API endpoint paths and default limits to align with updated integration standards.

@jcortes jcortes self-assigned this Mar 20, 2025
@vercel
Copy link

vercel bot commented Mar 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Mar 21, 2025 3:05pm
pipedream-docs ⬜️ Ignored (Inspect) Mar 21, 2025 3:05pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Mar 21, 2025 3:05pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2025

Walkthrough

Multiple files across the Apollo.io component were updated. Most changes involve version number increments and renaming of exported methods. In one action file, the contact-fetch method was changed from listContacts to searchContacts. The main app file now uses HTTP method–specific names and introduces a new paginate function with revised pagination and logging. Additionally, constants and utilities were updated, and source triggers received metadata updates with added debug options.

Changes

Files Change Summary
components/apollo_io/actions/{create-account, create-contact, create-opportunity, get-opportunity, people-enrichment, search-accounts, search-contacts, search-sequences, update-account-stage, update-account, update-contact-stage, update-contact, update-opportunity, add-contacts-to-sequence}.mjs Incremented version numbers; no functional changes.
components/apollo_io/actions/create-update-contact/create-update-contact.mjs Version bump (0.0.2 → 0.0.3) and replaced listContacts with searchContacts for fetching contacts.
components/apollo_io/apollo_io.app.mjs Renamed methods to HTTP-specific names (e.g., put, post, patch), added a new paginate method, and updated pagination logic (renaming getResourcesStream to getIterations) with enhanced logging.
components/apollo_io/common/constants.mjs Updated VERSION_PATH from /v1 to /api/v1 and added a new constant DEFAULT_LIMIT = 100.
components/apollo_io/common/utils.mjs Renamed function streamIterator to iterate with updated parameter and variable names.
components/apollo_io/package.json Updated package version from "0.5.0" to "0.5.1".
components/apollo_io/sources/account-{created,updated}/*.mjs Updated trigger metadata (name/description), incremented version numbers, switched resource retrieval to use searchAccounts, and added debug: true in getResourceFnArgs.
components/apollo_io/sources/contact-{created,updated}/*.mjs Updated trigger metadata (name/description), incremented version numbers, and added debug: true in getResourceFnArgs.
components/apollo_io/sources/common/polling.mjs Modified to accept an array instead of a stream; replaced getResourcesStream with paginate and enhanced logging of fetched, emitted, and filtered resource counts.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ApolloApp
    participant HTTPServer

    Client->>ApolloApp: Invoke HTTP-specific method (e.g., put/post)
    ApolloApp->>HTTPServer: Send corresponding HTTP request
    HTTPServer-->>ApolloApp: Return response
    ApolloApp->>Client: Return processed result
Loading
sequenceDiagram
    participant App
    participant Utils
    participant Logger

    App->>App: Call paginate(args)
    App->>Utils: Invoke iterate(iterations)
    Utils-->>App: Return aggregated items
    App->>Logger: Log resource counts (fetched, emitted, filtered)
Loading

Assessment against linked issues

Objective Addressed Explanation
[#15841] Log details for fetched, emitted, and filtered events

Suggested reviewers

  • michelle0927

Poem

I’m a little rabbit, hopping through code,
With version bumps and logs lightening my load.
Methods renamed like springtime blooms,
Pagination flows and quiet logs loom.
Bugs retreat as I dance in delight,
Hopping happily through each byte!
🐰💻

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/apollo_io/actions/create-update-contact/create-update-contact.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/apollo_io/actions/create-contact/create-contact.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

  • 20 others

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e62d8d and 0109758.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (24)
  • components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs (1 hunks)
  • components/apollo_io/actions/create-account/create-account.mjs (1 hunks)
  • components/apollo_io/actions/create-contact/create-contact.mjs (1 hunks)
  • components/apollo_io/actions/create-opportunity/create-opportunity.mjs (1 hunks)
  • components/apollo_io/actions/create-update-contact/create-update-contact.mjs (2 hunks)
  • components/apollo_io/actions/get-opportunity/get-opportunity.mjs (1 hunks)
  • components/apollo_io/actions/people-enrichment/people-enrichment.mjs (1 hunks)
  • components/apollo_io/actions/search-accounts/search-accounts.mjs (1 hunks)
  • components/apollo_io/actions/search-contacts/search-contacts.mjs (1 hunks)
  • components/apollo_io/actions/search-sequences/search-sequences.mjs (1 hunks)
  • components/apollo_io/actions/update-account-stage/update-account-stage.mjs (1 hunks)
  • components/apollo_io/actions/update-account/update-account.mjs (1 hunks)
  • components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs (1 hunks)
  • components/apollo_io/actions/update-contact/update-contact.mjs (1 hunks)
  • components/apollo_io/actions/update-opportunity/update-opportunity.mjs (1 hunks)
  • components/apollo_io/apollo_io.app.mjs (10 hunks)
  • components/apollo_io/common/constants.mjs (1 hunks)
  • components/apollo_io/common/utils.mjs (2 hunks)
  • components/apollo_io/package.json (1 hunks)
  • components/apollo_io/sources/account-created/account-created.mjs (2 hunks)
  • components/apollo_io/sources/account-updated/account-updated.mjs (2 hunks)
  • components/apollo_io/sources/common/polling.mjs (1 hunks)
  • components/apollo_io/sources/contact-created/contact-created.mjs (2 hunks)
  • components/apollo_io/sources/contact-updated/contact-updated.mjs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (23)
  • components/apollo_io/actions/create-opportunity/create-opportunity.mjs
  • components/apollo_io/actions/update-account/update-account.mjs
  • components/apollo_io/actions/create-account/create-account.mjs
  • components/apollo_io/actions/create-contact/create-contact.mjs
  • components/apollo_io/actions/update-account-stage/update-account-stage.mjs
  • components/apollo_io/actions/update-opportunity/update-opportunity.mjs
  • components/apollo_io/actions/get-opportunity/get-opportunity.mjs
  • components/apollo_io/actions/search-accounts/search-accounts.mjs
  • components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs
  • components/apollo_io/package.json
  • components/apollo_io/actions/update-contact/update-contact.mjs
  • components/apollo_io/actions/people-enrichment/people-enrichment.mjs
  • components/apollo_io/actions/create-update-contact/create-update-contact.mjs
  • components/apollo_io/actions/search-contacts/search-contacts.mjs
  • components/apollo_io/common/constants.mjs
  • components/apollo_io/common/utils.mjs
  • components/apollo_io/actions/search-sequences/search-sequences.mjs
  • components/apollo_io/sources/contact-updated/contact-updated.mjs
  • components/apollo_io/sources/common/polling.mjs
  • components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs
  • components/apollo_io/sources/account-updated/account-updated.mjs
  • components/apollo_io/sources/contact-created/contact-created.mjs
  • components/apollo_io/sources/account-created/account-created.mjs
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (7)
components/apollo_io/apollo_io.app.mjs (7)

3-3: New utility import enhances code functionality

This import introduces utility functions from a common module, which helps in code organization and reuse. It's used for the new pagination functionality.


14-14: Method name updates improve HTTP operation clarity

The method names have been updated from listAccounts to searchAccounts and listContacts to searchContacts to better reflect their actual operation, which uses the search endpoints.

Also applies to: 32-32


247-252: Explicit HTTP methods increase code clarity

The put and patch methods have been updated to use the appropriate HTTP methods explicitly, improving code readability and making the API interactions more clear.

Also applies to: 253-258


272-275: Standardized HTTP method usage improves consistency

All API endpoint methods now use explicit HTTP method functions (post, put, patch) instead of the generic makeRequest. This change provides better clarity on the type of HTTP request being made for each operation.

Also applies to: 302-305, 310-313, 316-319, 322-325, 328-331, 336-339, 352-355, 358-361, 366-369, 372-375, 378-381


389-389: Method renamed and pagination parameter added

The method has been renamed from getResourcesStream to getIterations to better reflect its purpose. The addition of the explicit per_page parameter set to a constant value improves the consistency of pagination requests.

Also applies to: 404-405


425-428: Added logging addresses the non-logging issue

The new logging statement when there are no more pages to fetch directly addresses the PR objective where Apollo.io triggers were not logging anything. This provides visibility into the pagination process and helps with debugging.


433-435: New paginate method simplifies resource iteration

This new helper method leverages the utility module to standardize pagination handling across the component. It makes resource iteration more consistent and easier to use.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🔭 Outside diff range comments (1)
components/apollo_io/actions/search-accounts/search-accounts.mjs (1)

56-56: ⚠️ Potential issue

Code reference needs to be updated to match renamed utility function

The code is calling utils.streamIterator(resourcesStream), but this function has been renamed to iterate in the utils.mjs file. This will cause runtime errors when executed.

- const accounts = await utils.streamIterator(resourcesStream);
+ const accounts = await utils.iterate(resourcesStream);
🧹 Nitpick comments (3)
components/apollo_io/actions/update-account-stage/update-account-stage.mjs (1)

8-8: Version Update and Logging Inclusion.
The exported action’s version is correctly updated to "0.0.5". Additionally, the use of $.export("$summary", …) in the run method confirms that a summary message is being logged, which should help with debugging Apollo.io triggers. Please verify that the logged information meets your debugging requirements.

components/apollo_io/actions/search-sequences/search-sequences.mjs (1)

26-26: Resource Name Consistency Check.
The resourceName is set to "emailer_campaigns", yet the action is designed to search for sequences. Please verify that this naming is intentional; if not, consider renaming it (e.g., to "sequences") to better reflect the resource being queried.

components/apollo_io/sources/contact-created/contact-created.mjs (1)

21-21: Added debug property.

Enabling debug logs can be very helpful for troubleshooting. Ensure that sensitive data or PII is not inadvertently exposed in logs.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70b218c and 4005b7f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (23)
  • components/apollo_io/actions/create-account/create-account.mjs (1 hunks)
  • components/apollo_io/actions/create-contact/create-contact.mjs (1 hunks)
  • components/apollo_io/actions/create-opportunity/create-opportunity.mjs (1 hunks)
  • components/apollo_io/actions/create-update-contact/create-update-contact.mjs (2 hunks)
  • components/apollo_io/actions/get-opportunity/get-opportunity.mjs (1 hunks)
  • components/apollo_io/actions/people-enrichment/people-enrichment.mjs (1 hunks)
  • components/apollo_io/actions/search-accounts/search-accounts.mjs (1 hunks)
  • components/apollo_io/actions/search-contacts/search-contacts.mjs (1 hunks)
  • components/apollo_io/actions/search-sequences/search-sequences.mjs (1 hunks)
  • components/apollo_io/actions/update-account-stage/update-account-stage.mjs (1 hunks)
  • components/apollo_io/actions/update-account/update-account.mjs (1 hunks)
  • components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs (1 hunks)
  • components/apollo_io/actions/update-contact/update-contact.mjs (1 hunks)
  • components/apollo_io/actions/update-opportunity/update-opportunity.mjs (1 hunks)
  • components/apollo_io/apollo_io.app.mjs (10 hunks)
  • components/apollo_io/common/constants.mjs (1 hunks)
  • components/apollo_io/common/utils.mjs (2 hunks)
  • components/apollo_io/package.json (1 hunks)
  • components/apollo_io/sources/account-created/account-created.mjs (2 hunks)
  • components/apollo_io/sources/account-updated/account-updated.mjs (2 hunks)
  • components/apollo_io/sources/common/polling.mjs (1 hunks)
  • components/apollo_io/sources/contact-created/contact-created.mjs (2 hunks)
  • components/apollo_io/sources/contact-updated/contact-updated.mjs (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (54)
components/apollo_io/common/constants.mjs (2)

3-3: Added pagination limit to optimize API requests.

Adding a DEFAULT_LIMIT constant is a good practice for API interactions. This helps prevent excessive data retrieval and potential timeouts that could have been impacting logging functionality.


9-9: LGTM: Properly exported the new constant.

The DEFAULT_LIMIT constant is correctly exposed in the default export, making it available to other modules that import from this file.

components/apollo_io/package.json (1)

3-3: Version Bump Confirmed.
The version has been updated to "0.5.1" as expected. This change is a straightforward version bump without affecting functionality.

components/apollo_io/actions/search-sequences/search-sequences.mjs (1)

9-9: Version Update Verified.
The version update to "0.0.4" is consistent with the overall module versioning strategy.

components/apollo_io/actions/update-contact/update-contact.mjs (1)

9-9: Version Update Confirmed.
The action’s version is updated to "0.0.6", aligning with the coordinated version bumps across the component. The logging via $.export("$summary", …) after updating the contact is also appropriately handled.

components/apollo_io/actions/search-contacts/search-contacts.mjs (1)

9-9: Version Update Verified.
The action’s version has been correctly updated to "0.0.4". The summary logging in the run method is intact and should assist with logging trigger behavior.

components/apollo_io/actions/get-opportunity/get-opportunity.mjs (1)

8-8: Version Increment and Logging Confirmation

The version update to "0.0.4" is consistent with the coordinated release effort. The action still exports a summary log (line 24) which should help with tracing trigger execution. If Apollo.io triggers were previously not logging, please verify that the environment correctly interprets the $.export("$summary", ...) mechanism.

components/apollo_io/actions/update-opportunity/update-opportunity.mjs (1)

8-8: Consistent Version Update and Log Output

The version change to "0.0.4" appears appropriate. The summary logging on success remains intact (line 73). Ensure that your logging configuration captures the export messages so that Apollo.io triggers now correctly log information.

components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs (1)

8-8: Version Bump with Logging Verification

The version number update to "0.0.5" is in line with other modules. The summary message (lines 36–39) confirms that an update log is being generated. Please double-check that the trigger infrastructure now picks up these logs as expected.

components/apollo_io/actions/people-enrichment/people-enrichment.mjs (1)

8-8: Version Update and Enhanced Action Operation

The version is incremented to "0.0.7", and the action’s functionality (including additional properties and method calls) remains unaffected. The exported summary log on line 152 should help in verifying trigger activity. If logging issues persist, consider validating that the runtime accepts the $summary export from asynchronous actions.

components/apollo_io/actions/create-contact/create-contact.mjs (1)

8-8: Version Bump with Correct Summary Logging

The update to version "0.0.6" is consistent with the other Apollo.io actions. The summary export (line 91) confirms that logging is in place upon contact creation. As with the other actions, please ensure that these summary logs are processed by your trigger mechanism.

components/apollo_io/actions/search-accounts/search-accounts.mjs (1)

9-9: Version bump reflects dependency update

The version has been incremented from "0.0.3" to "0.0.4", which aligns with the changes made to the utility functions in the common directory.

components/apollo_io/actions/update-account/update-account.mjs (1)

9-9: Version bump looks good

The version has been incremented from "0.0.4" to "0.0.5", which is appropriate for tracking changes across the component.

components/apollo_io/actions/create-account/create-account.mjs (1)

8-8: Version bump looks good

The version has been incremented from "0.0.4" to "0.0.5", aligning with the version updates in other Apollo.io actions.

components/apollo_io/actions/create-opportunity/create-opportunity.mjs (1)

8-8: Version bump looks good

The version has been incremented from "0.0.3" to "0.0.4", keeping consistent with the versioning strategy across components.

components/apollo_io/common/utils.mjs (2)

19-19: Export updated correctly

The export has been updated to match the renamed function.


1-7:

❓ Verification inconclusive

Function rename improves clarity but requires updates to all references

The function streamIterator has been renamed to iterate with corresponding parameter and variable name changes. While this improves clarity, any files that reference the old function name will need to be updated.

The function name change is good, but please ensure all references to streamIterator across the codebase are updated to iterate. At minimum, the search-accounts.mjs file needs to be updated as it still uses the old function name.


🏁 Script executed:

#!/bin/bash
# Find all references to the old function name across the codebase
echo "Searching for references to streamIterator in the codebase:"
rg -l "streamIterator" --type js --type mjs components/apollo_io/

Length of output: 222


Below is a revised shell script that explicitly adds support for the “.mjs” file type so that we can correctly verify that no lingering references to streamIterator exist in the codebase:

#!/bin/bash
# Define file type for .mjs and search for references to 'streamIterator' in components/apollo_io
rg --type-add 'mjs:*.mjs' -l "streamIterator" components/apollo_io/

Please run this script to verify that all references to streamIterator have been updated to iterate (especially in files like search-accounts.mjs). Once you confirm that there are no remaining matches, the function renaming should be fully integrated across the codebase.

components/apollo_io/actions/create-update-contact/create-update-contact.mjs (2)

9-9: Version increment looks good.

The version has been updated from "0.0.2" to "0.0.3", which is appropriate for this bugfix change.


91-95: Method change from listContacts to searchContacts looks good.

This change aligns with the overall PR objective to fix logging issues in Apollo.io triggers. The switch to searchContacts is likely part of a consistent approach to use named methods that better reflect their HTTP operations.

components/apollo_io/sources/contact-updated/contact-updated.mjs (3)

7-7: Improved description clarity.

The description has been updated to more accurately reflect the component's behavior, changing from "Triggers when a contact is updated" to "Emit new event when a contact is updated."


9-9: Version increment is appropriate.

The version has been updated from "0.0.6" to "0.0.7" to reflect the changes in this PR.


21-21: Added debugging to resolve logging issues.

Adding debug: true is crucial for addressing the PR's main objective - fixing the issue where Apollo.io triggers weren't logging anything. This parameter will enable enhanced logging for troubleshooting and visibility.

components/apollo_io/sources/common/polling.mjs (4)

38-40: Simplified stream processing logic.

The processStreamEvents method has been updated to accept an array of resources directly instead of a stream, making the code more straightforward and easier to maintain.


41-43: Added critical logging statements.

These console.log statements directly address the PR's core objective by adding explicit logging of resource count metrics:

  1. Total resources fetched
  2. Number of resources emitted
  3. Number of resources filtered out

This will provide much-needed visibility into the trigger's operation.


47-51: Switched to pagination-based resource retrieval.

The implementation now uses this.app.paginate instead of this.app.getResourcesStream, which aligns with the updated processStreamEvents method that expects an array of resources rather than a stream.


53-53: Simplified event processing call.

This change passes resources directly to processStreamEvents, which is consistent with the method's updated signature.

components/apollo_io/sources/account-updated/account-updated.mjs (4)

8-8: Improved description clarity.

The description has been updated to more accurately reflect the component's behavior, changing from "Triggers when an account is updated" to "Emit new event when an account is updated."


10-10: Version increment is appropriate.

The version has been updated from "0.0.4" to "0.0.5" to reflect the changes in this PR.


37-37: Method change from listAccounts to searchAccounts looks good.

This change aligns with the overall PR objective and is consistent with similar changes in other files, shifting to more explicitly named methods.


41-41: Added debugging to resolve logging issues.

Adding debug: true enables enhanced logging capabilities for this trigger, directly addressing the PR's main objective of fixing the logging issues with Apollo.io triggers.

components/apollo_io/sources/contact-created/contact-created.mjs (2)

6-7: Renamed source title and description.

This updated naming convention is clearer and more descriptive.


9-9: Bumped version to 0.0.7.

Incrementing the version helps signal new functionality or fixes.

components/apollo_io/sources/account-created/account-created.mjs (4)

6-7: Updated source title and description.

This name and description now better reflect the event.


9-9: Incremented version to 0.0.5.

Version bump aligns with added functionality.


30-30: Switched from listAccounts to searchAccounts.

This change appears consistent with the broader shift to the searchAccounts method. Confirm that all uses of the old function are migrated.


34-34: Enabled debug mode.

This should facilitate improved logging visibility.

components/apollo_io/apollo_io.app.mjs (18)

3-3: Imported utils.

This import is necessary for the new pagination logic and is a welcome addition.


14-14: Using searchAccounts within prop definition.

Replacing any previous list method with searchAccounts should expand filtering and querying capabilities.


32-32: Using searchContacts within prop definition.

This similarly streamlines contact lookups with advanced filtering.


247-249: Introduced dedicated PUT method.

Defining an explicit method for PUT requests clarifies intent and HTTP usage.


253-255: Introduced dedicated PATCH method.

Having a separate PATCH method aligns with standard REST conventions.


272-275: listSequences now uses POST.

Switching from a shared listing approach to an explicit POST for searching email campaigns is consistent with the app’s new method pattern.


303-305: createContact calls POST.

This approach follows standard RESTful practices for resource creation.


310-313: updateContact now uses PUT.

A clear indication that we're fully updating a contact record.


316-319: updateContactStage calls POST.

Centralizing stage updates under POST is a logical extension of the new naming conventions.


322-325: createAccount calls POST.

Good to see explicit, consistent HTTP methods for resource creation.


328-331: createOpportunity calls POST.

Follows the pattern of using POST for resource creation.


336-339: updateOpportunity now uses PATCH.

Patch is appropriate for partial resource updates.


352-355: updateAccount uses PUT.

Adopting PUT clarifies that we’re likely making a full update.


358-361: updateAccountStage calls POST.

This standardized pattern avoids confusion by grouping update logic under similar method signatures.


366-369: addContactsToSequence calls POST.

Ensures consistency when adding resources in bulk.


372-375: searchAccounts calls POST.

Further unification of search endpoints under POST.


378-381: searchContacts calls POST.

Matches the new approach to searching resources.


389-435: Refactored iteration and pagination logic.

Introducing getIterations and paginate creates a more scalable, modular way to handle multi-page data. Verify that logs won’t expose sensitive records in production.

@jcortes jcortes force-pushed the fix-apollo-io-triggers-are-not-logging-anything branch from 4005b7f to 1ad3be0 Compare March 20, 2025 18:33
andrewjschuang
andrewjschuang previously approved these changes Mar 20, 2025
lcaresia
lcaresia previously approved these changes Mar 20, 2025
@jcortes jcortes dismissed stale reviews from lcaresia and andrewjschuang via 5e62d8d March 20, 2025 18:42
@jcortes jcortes force-pushed the fix-apollo-io-triggers-are-not-logging-anything branch from 1ad3be0 to 5e62d8d Compare March 20, 2025 18:42
@jcortes jcortes force-pushed the fix-apollo-io-triggers-are-not-logging-anything branch from 5e62d8d to 0109758 Compare March 21, 2025 15:05
@jcortes
Copy link
Collaborator Author

jcortes commented Mar 21, 2025

/approve

@jcortes jcortes merged commit 9b70290 into master Mar 21, 2025
11 checks passed
@jcortes jcortes deleted the fix-apollo-io-triggers-are-not-logging-anything branch March 21, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Apollo.io triggers are not logging anything

4 participants