-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Salesforce] Knowledge new action components #18216
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?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds three new Salesforce Knowledge action modules, a shared knowledge props module, four app methods including a generic paginator, bumps the package version, and applies many patch version increments across existing actions and sources. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant A as Get Knowledge Articles Action
participant APP as salesforce_rest_api.app
participant SF as Salesforce REST API
U->>A: Run(q, channel, language, categories, queryMethod, sort)
A->>APP: paginate({ requester: getKnowledgeArticles, requesterArgs })
loop Paginate
APP->>SF: GET /services/data/v50.0/support/knowledgeArticles?pageNumber&pageSize&...
SF-->>APP: { articles, nextPageUrl? }
APP->>APP: accumulate response.articles
alt nextPageUrl present
APP->>APP: continue (increment pageNumber)
else
APP-->>A: return aggregated articles
end
end
A-->>U: Return aggregated articles + summary
sequenceDiagram
autonumber
participant U as User
participant G as Get Data Category Groups Action
participant D as Get Data Category Details Action
participant APP as salesforce_rest_api.app
participant SF as Salesforce REST API
U->>G: Run(topCategoriesOnly, language)
G->>APP: getKnowledgeDataCategoryGroups({ $, params, headers })
APP->>SF: GET /services/data/v50.0/support/dataCategoryGroups?sObjectName=KnowledgeArticleVersion&...
SF-->>APP: { categoryGroups }
APP-->>G: return response
G-->>U: Return data + summary
U->>D: Run(groupName, categoryName, language)
D->>APP: getKnowledgeDataCategoryDetails({ groupName, categoryName, $, params, headers })
APP->>SF: GET /services/data/v50.0/support/dataCategoryGroups/{groupName}/dataCategories/{categoryName}
SF-->>APP: { category details }
APP-->>D: return details
D-->>U: Return data + summary
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Suggested labels
Suggested reviewers
Poem
✨ 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. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
dd90c25
to
e2a0cea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
components/salesforce_rest_api/actions/get-knowledge-data-category-groups/get-knowledge-data-category-groups.mjs (1)
32-38
: Pass $ and explicit Accept header to match other actions and aid debugging.Keeps request metadata consistent and ensures JSON response.
- const response = await this.app._makeRequest({ - url: `${this.app._baseApiVersionUrl()}/support/dataCategoryGroups`, - params: { - sObjectName, - topCategoriesOnly, - }, - }); + const response = await this.app._makeRequest({ + $, + url: `${this.app._baseApiVersionUrl()}/support/dataCategoryGroups`, + headers: { + ...this.app._makeRequestHeaders(), + "Accept": "application/json", + }, + params: { sObjectName, topCategoriesOnly }, + });components/salesforce_rest_api/actions/get-knowledge-articles/get-knowledge-articles.mjs (2)
86-117
: More robust pagination: follow nextPageUrl when provided.The API surfaces
nextPageUrl
; relying only onpageNumber++
can desync from the server. UsenextPageUrl
when present; fall back to page numbers otherwise.- async paginate({ + async paginate({ requester, requesterArgs, resultsKey = "articles", maxRequests = 3, pageSize = 100, } = {}) { - let allItems = []; - let currentPage = 1; - let hasMore = true; + let allItems = []; + let currentPage = 1; + let hasMore = true; + let nextUrl = null; while (hasMore && currentPage <= maxRequests) { - const response = await requester({ - ...requesterArgs, - params: { - ...requesterArgs?.params, - pageSize, - pageNumber: currentPage, - }, - }); + const response = await requester( + nextUrl + ? { ...requesterArgs, url: nextUrl } + : { + ...requesterArgs, + params: { + ...requesterArgs?.params, + pageSize, + pageNumber: currentPage, + }, + }, + ); - const respData = response?.data ?? response; + const respData = response?.data ?? response; const items = respData?.[resultsKey]; if (items?.length) { allItems = [ ...allItems, ...items, ]; } - hasMore = Boolean(respData?.nextPageUrl); + nextUrl = respData?.nextPageUrl || null; + hasMore = Boolean(nextUrl); currentPage++; }
145-151
: Nit: avoid sending undefined params.Keeps the query string clean; some backends mis-handle empty keys.
- params: { - q, - channel, - categories, - queryMethod, - sort, - }, + params: Object.fromEntries( + Object.entries({ q, channel, categories, queryMethod, sort }) + .filter(([, v]) => v != null && v !== "") + ),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
components/salesforce_rest_api/actions/get-knowledge-articles/get-knowledge-articles.mjs
(1 hunks)components/salesforce_rest_api/actions/get-knowledge-data-category-details/get-knowledge-data-category-details.mjs
(1 hunks)components/salesforce_rest_api/actions/get-knowledge-data-category-groups/get-knowledge-data-category-groups.mjs
(1 hunks)components/salesforce_rest_api/package.json
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
components/salesforce_rest_api/actions/get-knowledge-data-category-groups/get-knowledge-data-category-groups.mjs (1)
components/salesforce_rest_api/actions/get-knowledge-data-category-details/get-knowledge-data-category-details.mjs (1)
response
(36-41)
components/salesforce_rest_api/actions/get-knowledge-data-category-details/get-knowledge-data-category-details.mjs (2)
components/salesforce_rest_api/actions/get-knowledge-articles/get-knowledge-articles.mjs (1)
response
(98-105)components/salesforce_rest_api/actions/get-knowledge-data-category-groups/get-knowledge-data-category-groups.mjs (1)
response
(32-38)
components/salesforce_rest_api/actions/get-knowledge-articles/get-knowledge-articles.mjs (2)
components/salesforce_rest_api/actions/get-knowledge-data-category-details/get-knowledge-data-category-details.mjs (1)
response
(36-41)components/salesforce_rest_api/actions/get-knowledge-data-category-groups/get-knowledge-data-category-groups.mjs (1)
response
(32-38)
⏰ 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: Verify TypeScript components
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (2)
components/salesforce_rest_api/package.json (1)
3-3
: Semver bump to 1.8.0 looks correct.Minor version bump aligns with adding new actions.
components/salesforce_rest_api/actions/get-knowledge-articles/get-knowledge-articles.mjs (1)
107-116
: Verify_makeRequest
return shape before pagination
The action currently treatsresponse[resultsKey]
andresponse.nextPageUrl
as top-level, but if_makeRequest
returns an object underdata
, both will be undefined and break pagination. Confirm how_makeRequest
surfaces the API payload inget-knowledge-articles
, and, if it wraps underdata
, update accordingly:- const items = response[resultsKey]; + const respData = response?.data ?? response; + const items = respData?.[resultsKey]; @@ - hasMore = !!response.nextPageUrl; + hasMore = Boolean(respData?.nextPageUrl);
...rest_api/actions/get-knowledge-data-category-details/get-knowledge-data-category-details.mjs
Outdated
Show resolved
Hide resolved
e2a0cea
to
042f706
Compare
042f706
to
7f5b814
Compare
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (54)
components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs
(1 hunks)components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs
(1 hunks)components/salesforce_rest_api/actions/common/knowledge.mjs
(1 hunks)components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs
(1 hunks)components/salesforce_rest_api/actions/create-account/create-account.mjs
(1 hunks)components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs
(1 hunks)components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs
(1 hunks)components/salesforce_rest_api/actions/create-case/create-case.mjs
(1 hunks)components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs
(1 hunks)components/salesforce_rest_api/actions/create-contact/create-contact.mjs
(1 hunks)components/salesforce_rest_api/actions/create-content-note/create-content-note.mjs
(1 hunks)components/salesforce_rest_api/actions/create-event/create-event.mjs
(1 hunks)components/salesforce_rest_api/actions/create-lead/create-lead.mjs
(1 hunks)components/salesforce_rest_api/actions/create-note/create-note.mjs
(1 hunks)components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs
(1 hunks)components/salesforce_rest_api/actions/create-record/create-record.mjs
(1 hunks)components/salesforce_rest_api/actions/create-task/create-task.mjs
(1 hunks)components/salesforce_rest_api/actions/create-user/create-user.mjs
(1 hunks)components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs
(1 hunks)components/salesforce_rest_api/actions/delete-record/delete-record.mjs
(1 hunks)components/salesforce_rest_api/actions/find-records/find-records.mjs
(1 hunks)components/salesforce_rest_api/actions/get-case/get-case.mjs
(1 hunks)components/salesforce_rest_api/actions/get-knowledge-articles/get-knowledge-articles.mjs
(1 hunks)components/salesforce_rest_api/actions/get-knowledge-data-category-details/get-knowledge-data-category-details.mjs
(1 hunks)components/salesforce_rest_api/actions/get-knowledge-data-category-groups/get-knowledge-data-category-groups.mjs
(1 hunks)components/salesforce_rest_api/actions/get-user/get-user.mjs
(1 hunks)components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs
(1 hunks)components/salesforce_rest_api/actions/list-case-comments/list-case-comments.mjs
(1 hunks)components/salesforce_rest_api/actions/list-email-messages/list-email-messages.mjs
(1 hunks)components/salesforce_rest_api/actions/list-email-templates/list-email-templates.mjs
(1 hunks)components/salesforce_rest_api/actions/list-knowledge-articles/list-knowledge-articles.mjs
(1 hunks)components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs
(1 hunks)components/salesforce_rest_api/actions/search-string/search-string.mjs
(1 hunks)components/salesforce_rest_api/actions/send-email/send-email.mjs
(1 hunks)components/salesforce_rest_api/actions/soql-search/soql-search.mjs
(1 hunks)components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs
(1 hunks)components/salesforce_rest_api/actions/update-account/update-account.mjs
(1 hunks)components/salesforce_rest_api/actions/update-contact/update-contact.mjs
(1 hunks)components/salesforce_rest_api/actions/update-email-template/update-email-template.mjs
(1 hunks)components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs
(1 hunks)components/salesforce_rest_api/actions/update-record/update-record.mjs
(1 hunks)components/salesforce_rest_api/actions/upsert-record/upsert-record.mjs
(1 hunks)components/salesforce_rest_api/package.json
(1 hunks)components/salesforce_rest_api/salesforce_rest_api.app.mjs
(1 hunks)components/salesforce_rest_api/sources/case-updated-instant/case-updated-instant.mjs
(1 hunks)components/salesforce_rest_api/sources/email-template-updated-instant/email-template-updated-instant.mjs
(1 hunks)components/salesforce_rest_api/sources/knowledge-article-updated-instant/knowledge-article-updated-instant.mjs
(1 hunks)components/salesforce_rest_api/sources/new-case-instant/new-case-instant.mjs
(1 hunks)components/salesforce_rest_api/sources/new-email-template-instant/new-email-template-instant.mjs
(1 hunks)components/salesforce_rest_api/sources/new-knowledge-article-instant/new-knowledge-article-instant.mjs
(1 hunks)components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs
(1 hunks)components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs
(1 hunks)components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs
(1 hunks)components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs
(1 hunks)
✅ Files skipped from review due to trivial changes (46)
- components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs
- components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs
- components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs
- components/salesforce_rest_api/actions/upsert-record/upsert-record.mjs
- components/salesforce_rest_api/sources/case-updated-instant/case-updated-instant.mjs
- components/salesforce_rest_api/actions/create-user/create-user.mjs
- components/salesforce_rest_api/actions/create-account/create-account.mjs
- components/salesforce_rest_api/actions/create-note/create-note.mjs
- components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs
- components/salesforce_rest_api/actions/create-task/create-task.mjs
- components/salesforce_rest_api/actions/update-record/update-record.mjs
- components/salesforce_rest_api/actions/create-contact/create-contact.mjs
- components/salesforce_rest_api/actions/update-account/update-account.mjs
- components/salesforce_rest_api/sources/email-template-updated-instant/email-template-updated-instant.mjs
- components/salesforce_rest_api/sources/new-email-template-instant/new-email-template-instant.mjs
- components/salesforce_rest_api/actions/list-case-comments/list-case-comments.mjs
- components/salesforce_rest_api/actions/list-email-messages/list-email-messages.mjs
- components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs
- components/salesforce_rest_api/actions/list-email-templates/list-email-templates.mjs
- components/salesforce_rest_api/actions/update-contact/update-contact.mjs
- components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs
- components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs
- components/salesforce_rest_api/sources/knowledge-article-updated-instant/knowledge-article-updated-instant.mjs
- components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs
- components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs
- components/salesforce_rest_api/actions/get-case/get-case.mjs
- components/salesforce_rest_api/actions/soql-search/soql-search.mjs
- components/salesforce_rest_api/actions/list-knowledge-articles/list-knowledge-articles.mjs
- components/salesforce_rest_api/actions/update-email-template/update-email-template.mjs
- components/salesforce_rest_api/actions/search-string/search-string.mjs
- components/salesforce_rest_api/actions/get-user/get-user.mjs
- components/salesforce_rest_api/actions/delete-record/delete-record.mjs
- components/salesforce_rest_api/actions/create-case/create-case.mjs
- components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs
- components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs
- components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs
- components/salesforce_rest_api/actions/create-content-note/create-content-note.mjs
- components/salesforce_rest_api/sources/new-knowledge-article-instant/new-knowledge-article-instant.mjs
- components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs
- components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs
- components/salesforce_rest_api/actions/create-record/create-record.mjs
- components/salesforce_rest_api/actions/create-lead/create-lead.mjs
- components/salesforce_rest_api/actions/create-event/create-event.mjs
- components/salesforce_rest_api/actions/send-email/send-email.mjs
- components/salesforce_rest_api/sources/new-case-instant/new-case-instant.mjs
- components/salesforce_rest_api/actions/find-records/find-records.mjs
🚧 Files skipped from review as they are similar to previous changes (5)
- components/salesforce_rest_api/package.json
- components/salesforce_rest_api/actions/common/knowledge.mjs
- components/salesforce_rest_api/actions/get-knowledge-data-category-groups/get-knowledge-data-category-groups.mjs
- components/salesforce_rest_api/actions/get-knowledge-data-category-details/get-knowledge-data-category-details.mjs
- components/salesforce_rest_api/actions/get-knowledge-articles/get-knowledge-articles.mjs
🧰 Additional context used
🧬 Code graph analysis (1)
components/salesforce_rest_api/salesforce_rest_api.app.mjs (1)
components/salesforce_rest_api/actions/get-knowledge-articles/get-knowledge-articles.mjs (1)
items
(84-102)
⏰ 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 (4)
components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs (1)
21-21
: Version bump only — OKNo functional changes. Version aligns with the PR’s patch bump pattern.
components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs (1)
10-10
: Version bump only — OKNo behavior change in the source.
components/salesforce_rest_api/salesforce_rest_api.app.mjs (2)
369-374
: Knowledge articles endpoint wrapper — OKThin wrapper over _makeRequest looks consistent with existing app methods.
375-380
: Data category groups endpoint wrapper — OKMatches the endpoint shape and existing conventions.
WHY
#18027
Summary by CodeRabbit
New Features
Improvements
Chores