-
Notifications
You must be signed in to change notification settings - Fork 5.3k
DataForSEO new components #16717
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
base: master
Are you sure you want to change the base?
DataForSEO new components #16717
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
""" WalkthroughThis update introduces multiple new action modules for the DataForSEO integration, primarily focused on backlinks, business data, and on-page content parsing. It also adds new property definitions, utility functions, and updates internal references for consistency. The package version is incremented to 0.2.0. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ActionModule
participant DataForSEOAPI
User->>ActionModule: Provide input parameters
ActionModule->>ActionModule: Prepare request payload
ActionModule->>DataForSEOAPI: POST to relevant endpoint (e.g., /backlinks/...)
DataForSEOAPI-->>ActionModule: Return response data
ActionModule->>User: Export summary and return data
Assessment against linked issues
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/dataforseo/actions/get-categories-aggregation/get-categories-aggregation.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/dataforseo/actions/search-business-listings/search-business-listings.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (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: 7
🧹 Nitpick comments (13)
components/dataforseo/actions/get-bulk-spam-score/get-bulk-spam-score.mjs (1)
1-48
: New component looks good with a minor suggestion for the summary outputThe implementation follows the established pattern for DataForSEO actions and correctly interacts with the bulk spam score endpoint.
Consider enhancing the success message to include more details about what was retrieved:
- $.export("$summary", "Successfully retrieved bulk spam score"); + $.export("$summary", `Successfully retrieved spam scores for ${this.targets.length} target(s)`);components/dataforseo/actions/get-backlinks-history/get-backlinks-history.mjs (2)
21-25
: Consider using a shared prop definition for the target parameterThe
target
property is defined inline, but it might be better to use a shared prop definition from the dataforseo app module if one exists (likebacklinksTarget
), to maintain consistency with other components.
66-66
: Enhance the success summary messageConsider making the success message more informative by including details about the target domain and date range.
- $.export("$summary", "Successfully retrieved backlinks history"); + $.export("$summary", `Successfully retrieved backlinks history for ${this.target}${this.dateFrom ? ` from ${this.dateFrom}` : ""}${this.dateTo ? ` to ${this.dateTo}` : ""}`);components/dataforseo/actions/get-bulk-referring-domains/get-bulk-referring-domains.mjs (1)
1-48
: New component looks good with a minor suggestion for the summary outputThe implementation follows the established pattern for DataForSEO actions and correctly interacts with the bulk referring domains endpoint.
Consider enhancing the success message to include more details about what was retrieved:
- $.export("$summary", "Successfully retrieved bulk referring domains"); + $.export("$summary", `Successfully retrieved referring domains data for ${this.targets.length} target(s)`);components/dataforseo/actions/parse-page-content/parse-page-content.mjs (2)
34-46
: Store Raw HTML description has incorrect markdown formattingThe markdown link in the storeRawHtml description is improperly formatted.
Apply this diff to fix the markdown link:
- description: "Set to `true` if you want to get the HTML of the page using the [https://docs.dataforseo.com/v3/on_page/raw_html/](OnPage Raw HTML endpoint)", + description: "Set to `true` if you want to get the HTML of the page using the [OnPage Raw HTML endpoint](https://docs.dataforseo.com/v3/on_page/raw_html/)",
21-27
: Consider adding URL validationThe URL property should be validated to ensure it's properly formatted.
Consider adding basic URL validation, for example:
url: { type: "string", label: "URL", description: "The URL of the page to parse, e.g. `https://pipedream.com/`", + validate: (value) => { + try { + new URL(value); + return true; + } catch (err) { + return "Please enter a valid URL"; + } + }, },components/dataforseo/actions/search-business-listings/search-business-listings.mjs (2)
53-60
: Documentation link should be more specificThe documentation link in the additionalOptions description points to the general API endpoint. To help users find the exact parameters, it would be better to point to the specific "Request parameters" section.
additionalOptions: { propDefinition: [ dataforseo, "additionalOptions", ], description: - "Additional parameters to send in the request. [See the documentation](https://docs.dataforseo.com/v3/business_data/business_listings/search/live/) for all available parameters. Values will be parsed as JSON where applicable.", + "Additional parameters to send in the request. [See the documentation](https://docs.dataforseo.com/v3/business_data/business_listings/search/live/#request-parameters) for all available parameters. Values will be parsed as JSON where applicable.", },
8-9
: Add explicit mention of the API usedTo improve clarity of this component's purpose, consider adding explicit mention of Google Maps in the description.
description: - "Get information about business entities listed on Google Maps. [See the documentation](https://docs.dataforseo.com/v3/business_data/business_listings/search/live/)", + "Get information about business entities listed on Google Maps using DataForSEO's Business Data API. [See the documentation](https://docs.dataforseo.com/v3/business_data/business_listings/search/live/)",components/dataforseo/actions/get-domain-pages-summary/get-domain-pages-summary.mjs (2)
78-94
: Consider adding pagination handlingThe Domain Pages Summary endpoint likely returns paginated results for domains with many pages. Consider adding support for pagination parameters in the request or handling pagination in the response for large domains.
You could enhance the method to automatically handle pagination by checking for
result_count
andtotal_count
in the response and making additional requests if needed:async getDomainPagesSummaryWithPagination(args = {}, allResults = []) { const response = await this.getDomainPagesSummary(args); // Add results to our collection if (response?.tasks?.[0]?.result?.[0]?.items) { allResults.push(...response.tasks[0].result[0].items); } // Check if we need to paginate const resultCount = response?.tasks?.[0]?.result?.[0]?.items?.length || 0; const totalCount = response?.tasks?.[0]?.result?.[0]?.total_count || 0; if (allResults.length < totalCount && resultCount > 0) { // Prepare for next page const nextOffset = (args.data[0].offset || 0) + resultCount; args.data[0].offset = nextOffset; // Recursive call for next page return this.getDomainPagesSummaryWithPagination(args, allResults); } // Return all results and the original response structure const fullResponse = { ...response }; if (fullResponse?.tasks?.[0]?.result?.[0]) { fullResponse.tasks[0].result[0].items = allResults; } return fullResponse; }
70-76
: Make documentation link more specificTo improve user experience, update the documentation link to point directly to the request parameters section rather than the general endpoint documentation.
additionalOptions: { propDefinition: [ dataforseo, "additionalOptions", ], - description: "Additional parameters to send in the request. [See the documentation](https://docs.dataforseo.com/v3/backlinks/domain_pages_summary/live/) for all available parameters. Values will be parsed as JSON where applicable.", + description: "Additional parameters to send in the request. [See the documentation](https://docs.dataforseo.com/v3/backlinks/domain_pages_summary/live/#request-parameters) for all available parameters. Values will be parsed as JSON where applicable.", },components/dataforseo/actions/get-backlinks-summary/get-backlinks-summary.mjs (1)
70-76
: Update documentation link to be more specificThe additionalOptions description should point directly to the request parameters section rather than the general endpoint documentation.
additionalOptions: { propDefinition: [ dataforseo, "additionalOptions", ], - description: "Additional parameters to send in the request. [See the documentation](https://docs.dataforseo.com/v3/backlinks/summary/live/) for all available parameters. Values will be parsed as JSON where applicable.", + description: "Additional parameters to send in the request. [See the documentation](https://docs.dataforseo.com/v3/backlinks/summary/live/#request-parameters) for all available parameters. Values will be parsed as JSON where applicable.", },components/dataforseo/actions/get-referring-domains/get-referring-domains.mjs (1)
70-76
: Update documentation link for better specificityThe documentation link in additionalOptions should point directly to the request parameters section instead of the general endpoint page.
additionalOptions: { propDefinition: [ dataforseo, "additionalOptions", ], - description: "Additional parameters to send in the request. [See the documentation](https://docs.dataforseo.com/v3/backlinks/referring_domains/live/) for all available parameters. Values will be parsed as JSON where applicable.", + description: "Additional parameters to send in the request. [See the documentation](https://docs.dataforseo.com/v3/backlinks/referring_domains/live/#request-parameters) for all available parameters. Values will be parsed as JSON where applicable.", },components/dataforseo/actions/get-backlinks/get-backlinks.mjs (1)
79-96
: Add error handling to improve resilience.The
run
method doesn't have any error handling mechanisms. Consider adding try/catch blocks to handle potential API errors gracefully and provide meaningful error messages to the user.async run({ $ }) { + try { const response = await this.getBacklinks({ $, data: [ { target: this.target, mode: this.mode, filters: this.filters, order_by: this.order_by, rank_scale: this.rankScale, tag: this.tag, ...parseObjectEntries(this.additionalOptions), }, ], }); $.export("$summary", "Successfully retrieved backlinks data"); return response; + } catch (error) { + $.export("$summary", `Error retrieving backlinks: ${error.message}`); + throw error; + } },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (18)
components/dataforseo/actions/get-backlinks-history/get-backlinks-history.mjs
(1 hunks)components/dataforseo/actions/get-backlinks-summary/get-backlinks-summary.mjs
(1 hunks)components/dataforseo/actions/get-backlinks/get-backlinks.mjs
(1 hunks)components/dataforseo/actions/get-bulk-backlinks/get-bulk-backlinks.mjs
(1 hunks)components/dataforseo/actions/get-bulk-ranks/get-bulk-ranks.mjs
(1 hunks)components/dataforseo/actions/get-bulk-referring-domains/get-bulk-referring-domains.mjs
(1 hunks)components/dataforseo/actions/get-bulk-spam-score/get-bulk-spam-score.mjs
(1 hunks)components/dataforseo/actions/get-business-listings/get-business-listings.mjs
(1 hunks)components/dataforseo/actions/get-categories-aggregation/get-categories-aggregation.mjs
(1 hunks)components/dataforseo/actions/get-domain-pages-summary/get-domain-pages-summary.mjs
(1 hunks)components/dataforseo/actions/get-keyword-difficulty/get-keyword-difficulty.mjs
(1 hunks)components/dataforseo/actions/get-ranked-keywords/get-ranked-keywords.mjs
(1 hunks)components/dataforseo/actions/get-referring-domains/get-referring-domains.mjs
(1 hunks)components/dataforseo/actions/parse-page-content/parse-page-content.mjs
(1 hunks)components/dataforseo/actions/search-business-listings/search-business-listings.mjs
(1 hunks)components/dataforseo/common/utils.mjs
(1 hunks)components/dataforseo/dataforseo.app.mjs
(3 hunks)components/dataforseo/package.json
(1 hunks)
🔇 Additional comments (24)
components/dataforseo/common/utils.mjs (2)
1-7
: Well-implemented error handling in JSON parsing utilityThis utility function provides a robust way to attempt JSON parsing without throwing exceptions, which is excellent for handling potentially malformed JSON input. It follows the principle of graceful degradation by falling back to the original value when parsing fails.
9-22
: Good approach for handling nested JSON structuresThe
parseObjectEntries
function elegantly handles the case where an object might contain JSON strings as values. The implementation correctly:
- Accepts an input with a sensible default
- Parses string inputs as JSON
- Recursively applies JSON parsing to each value
- Preserves the original structure
This utility will be valuable for processing the
additionalOptions
props in the new DataForSEO action modules.components/dataforseo/package.json (1)
3-3
: Appropriate version bump for feature additionsThe version increment from 0.1.0 to 0.2.0 follows semantic versioning principles correctly, as this PR is adding substantial new functionality (12 new actions) without breaking existing functionality.
components/dataforseo/actions/get-business-listings/get-business-listings.mjs (3)
1-1
: Consistent import naming convention appliedChanging the import alias from
app
todataforseo
improves code readability by making it immediately clear which app the module is associated with.
7-7
: Version bump reflects refactoring changesThe patch version increment from 0.0.1 to 0.0.2 is appropriate for these non-functional refactoring changes.
10-50
: Consistent renaming throughout the componentAll references to the app module have been systematically updated from
app
todataforseo
, maintaining consistency throughout the file. This refactoring improves maintainability and readability without changing functionality.components/dataforseo/actions/get-ranked-keywords/get-ranked-keywords.mjs (3)
1-1
: Consistent import naming convention appliedSimilar to the business listings component, the import alias has been standardized to
dataforseo
which improves code clarity and consistency across the codebase.
7-7
: Version bump reflects refactoring changesThe patch version increment (0.0.1 to 0.0.2) properly indicates the non-functional nature of these changes.
10-31
: Consistent renaming throughout the componentAll references to the app module have been systematically updated for consistency, with no functional changes. This type of systematic refactoring improves maintainability.
components/dataforseo/actions/get-keyword-difficulty/get-keyword-difficulty.mjs (1)
1-1
: LGTM - Clean refactoring of import alias and referencesThe change from
app
todataforseo
import alias across the component provides better clarity and consistency with other DataForSEO components. Version increment from 0.0.1 to 0.0.2 appropriately reflects these non-breaking changes.Also applies to: 7-7, 10-10, 13-13, 19-19, 25-25, 31-31
components/dataforseo/actions/get-bulk-backlinks/get-bulk-backlinks.mjs (3)
10-18
: LGTM! Method implementation is correctThe method correctly calls the DataForSEO API endpoint for bulk backlinks.
19-33
: Props look goodThe properties are properly defined with appropriate references to the dataforseo app prop definitions.
34-47
: Run method is well-structuredThe run method correctly assembles the request payload and handles the response.
components/dataforseo/actions/parse-page-content/parse-page-content.mjs (2)
10-18
: LGTM! Method implementation is correctThe
parsePageContent
method is properly implemented to call the appropriate API endpoint.
55-70
: LGTM! Run method is well-implementedThe run method correctly uses all defined properties and handles the API request and response properly.
components/dataforseo/actions/get-bulk-ranks/get-bulk-ranks.mjs (4)
3-9
: Component metadata looks goodThe component key, name, description, and version are appropriately defined.
10-18
: Method implementation is correctThe
getBacklinksBulkRanks
method is properly defined to interact with the DataForSEO API endpoint for bulk ranks.
19-39
: Props are well-definedThe properties are properly defined with appropriate references to the dataforseo app prop definitions.
40-54
: Run method is well-structuredThe run method correctly constructs the API request payload and handles the response.
components/dataforseo/actions/get-categories-aggregation/get-categories-aggregation.mjs (4)
3-10
: Component metadata looks goodThe component key, name, description, and version are appropriately defined.
11-19
: Method implementation is correctThe
getCategoriesAggregation
method is properly implemented to interact with the DataForSEO business listings API.
20-61
: Props are well-definedThe properties are correctly defined with appropriate references to the dataforseo app prop definitions. The additionalOptions description includes a helpful link to the documentation.
62-79
: Run method implementation is solidThe run method correctly:
- Assembles the request payload with all the defined properties
- Properly transforms camelCase property names to snake_case for the API
- Uses the parseObjectEntries utility for additionalOptions
- Exports a summary and returns the response
components/dataforseo/dataforseo.app.mjs (1)
41-177
: LGTM: Well-structured property definitions for backlinks operations.The newly added property definitions are well-structured with appropriate types, labels, detailed descriptions, and options where needed. They provide a comprehensive foundation for the backlinks-related operations.
Closes #15507
12 actions among the requested components were implemented:
The rest were not clear on what endpoint was intended for the action - there are many, many available endpoints among the multiple APIs available in DataForSEO.
I'm opening this now with the above 12 new components, which is a significant amount on top of the 3 existing ones. If any more actions are needed they can be created moving forward as required.
Summary by CodeRabbit