-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Microsoft Outlook - add pagination to props and actions #16255
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 pull request updates multiple Microsoft Outlook actions and source modules by incrementing version numbers across the board. Several files receive minor documentation improvements, and a few actions now introduce or update the Changes
Sequence Diagram(s)sequenceDiagram
participant Action as Action Module
participant App as microsoft_outlook.app
participant API as Microsoft Outlook API
Action->>App: Invoke run method (e.g., find-email)
App->>App: Call paginate({fn, args, maxResults})
loop Pagination Loop
App->>API: Request batch (listMessages, listContacts, etc.)
API-->>App: Return batch of items
App-->>Action: Yield each item from batch
end
Action->>Action: Process retrieved items until maxResults reached
Assessment against linked issues
Suggested labels
Suggested reviewers
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/microsoft_outlook/actions/find-contacts/find-contacts.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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: 1
🔭 Outside diff range comments (1)
components/microsoft_outlook/actions/remove-label-from-email/remove-label-from-email.mjs (1)
34-36
:⚠️ Potential issueHandle Potential Undefined Categories Array
The code retrievesmessage?.categories
and then immediately callsindexOf
on it. Ifmessage.categories
isundefined
, this will result in a runtime error. Consider defaulting to an empty array to avoid this issue. For example:- let labels = message?.categories; + let labels = message?.categories || [];This change will ensure that subsequent operations on
labels
are safe even when no categories are present.
🧹 Nitpick comments (1)
components/microsoft_outlook/sources/new-email/new-email.mjs (1)
29-31
: Consider Making Page Size Configurable
The sample events are fetched with a hard-coded page size of 25. In light of the pagination enhancements, consider exposing the page size as a configurable property, which would empower users to control the number of items per page.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (18)
components/microsoft_outlook/actions/add-label-to-email/add-label-to-email.mjs
(1 hunks)components/microsoft_outlook/actions/approve-workflow/approve-workflow.mjs
(1 hunks)components/microsoft_outlook/actions/create-contact/create-contact.mjs
(1 hunks)components/microsoft_outlook/actions/create-draft-email/create-draft-email.mjs
(1 hunks)components/microsoft_outlook/actions/find-contacts/find-contacts.mjs
(1 hunks)components/microsoft_outlook/actions/find-email/find-email.mjs
(2 hunks)components/microsoft_outlook/actions/list-contacts/list-contacts.mjs
(1 hunks)components/microsoft_outlook/actions/list-folders/list-folders.mjs
(1 hunks)components/microsoft_outlook/actions/list-labels/list-labels.mjs
(1 hunks)components/microsoft_outlook/actions/move-email-to-folder/move-email-to-folder.mjs
(1 hunks)components/microsoft_outlook/actions/remove-label-from-email/remove-label-from-email.mjs
(1 hunks)components/microsoft_outlook/actions/reply-to-email/reply-to-email.mjs
(1 hunks)components/microsoft_outlook/actions/send-email/send-email.mjs
(1 hunks)components/microsoft_outlook/actions/update-contact/update-contact.mjs
(1 hunks)components/microsoft_outlook/microsoft_outlook.app.mjs
(7 hunks)components/microsoft_outlook/package.json
(1 hunks)components/microsoft_outlook/sources/new-contact/new-contact.mjs
(1 hunks)components/microsoft_outlook/sources/new-email/new-email.mjs
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (41)
components/microsoft_outlook/sources/new-email/new-email.mjs (1)
10-10
: Version Bump Updated
The version has been updated from "0.0.15" to "0.0.16" to reflect the new changes. This is consistent with our versioning strategy across the Outlook components.components/microsoft_outlook/actions/move-email-to-folder/move-email-to-folder.mjs (1)
7-7
: Version Bump Updated for Move Email to Folder Action
The version has been incremented from "0.0.2" to "0.0.3". There are no functional changes here, and the update is consistent with similar version bumps in related modules.components/microsoft_outlook/actions/remove-label-from-email/remove-label-from-email.mjs (1)
7-7
: Version Bump Updated for Remove Label from Email Action
The version has been updated from "0.0.4" to "0.0.5", keeping it in line with our consistent versioning approach across the Microsoft Outlook actions.components/microsoft_outlook/actions/list-labels/list-labels.mjs (1)
7-7
: Version Bump Updated for List Labels Action
The version has been updated from "0.0.4" to "0.0.5". The changes are limited to the version update with no impact on functionality.components/microsoft_outlook/actions/reply-to-email/reply-to-email.mjs (1)
7-7
: Version Bump Updated for Reply to Email Action
The module’s version has been incremented from "0.0.1" to "0.0.2". There are no other functional changes in this file.components/microsoft_outlook/package.json (1)
3-3
: Version Update in package.jsonThe version number has been correctly updated from "1.4.0" to "1.4.1", which is consistent with the coordinated version bump across the Microsoft Outlook integration components.
components/microsoft_outlook/actions/add-label-to-email/add-label-to-email.mjs (1)
8-8
: Version Bump for Add Label to Email ActionThe version has been updated from "0.0.4" to "0.0.5" with no changes to the underlying functionality. This version bump maintains consistency with similar updates across the integration.
components/microsoft_outlook/actions/send-email/send-email.mjs (1)
6-6
: Version Update for Send Email ActionThe action’s version is now "0.0.13", which aligns with the overall versioning strategy. No functional changes were made in this update.
components/microsoft_outlook/sources/new-contact/new-contact.mjs (1)
8-8
: Version Bump for New Contact SourceThe exported module’s version has been updated from "0.0.12" to "0.0.13". This is a straightforward version increment; please ensure that any pagination functionality introduced elsewhere (e.g., in the app file) remains consistent with these updates.
components/microsoft_outlook/actions/update-contact/update-contact.mjs (1)
6-6
: Update Contact Action Version IncrementThe version has been bumped from "0.0.11" to "0.0.12". The changes here are limited to versioning, with no modifications to business logic or the action’s properties.
components/microsoft_outlook/actions/approve-workflow/approve-workflow.mjs (1)
7-7
: Version increment looks good.The version bump from "0.0.2" to "0.0.3" is consistent with the versioning strategy across other files in this PR.
components/microsoft_outlook/actions/create-draft-email/create-draft-email.mjs (2)
6-6
: Version increment looks good.The version bump from "0.0.11" to "0.0.12" is appropriate and maintains consistency with other files in the PR.
8-8
: Documentation improvement is good.Changing "docs" to "documentation" improves clarity and readability of the action description.
components/microsoft_outlook/actions/create-contact/create-contact.mjs (2)
6-6
: Version increment looks good.The version bump from "0.0.11" to "0.0.12" aligns with the consistent versioning strategy across components.
8-8
: Documentation improvement is good.Changing "docs" to "documentation" improves clarity and readability in the action description.
components/microsoft_outlook/actions/list-folders/list-folders.mjs (5)
7-7
: Version increment looks good.The version bump from "0.0.2" to "0.0.3" is appropriate for the pagination functionality being added.
11-16
: New maxResults property looks good.Adding the maxResults property allows users to control the number of results returned, which is essential for pagination functionality.
27-30
: Results collection looks good.Correctly collects all paginated results using a for-await loop for async iteration through the paginated items.
32-35
: Summary and return statement updates look good.The summary message and return statement have been appropriately updated to reflect the new pagination implementation.
19-25
:✅ Verification successful
Pagination implementation looks good.
The implementation now uses a paginate helper method instead of directly calling listFolders, which is a good abstraction for handling pagination logic across multiple actions.
🏁 Script executed:
#!/bin/bash # Check the implementation of the paginate method in the app file cat components/microsoft_outlook/microsoft_outlook.app.mjs | grep -A 25 "paginate("Length of output: 668
Pagination implementation verified and approved.
The paginate helper method in
components/microsoft_outlook/microsoft_outlook.app.mjs
correctly handles the pagination logic by merging the necessary parameters, iterating through results, and updating the query with calculated skip values. This abstraction effectively replaces direct calls tolistFolders
and improves code maintainability across actions.components/microsoft_outlook/actions/find-contacts/find-contacts.mjs (5)
6-8
: Version increment and documentation improvements look good.The version update from 0.0.11 to 0.0.12 and added documentation link improve the component.
16-21
: Good addition of the maxResults property.Adding the maxResults property allows users to limit the number of results returned, which is particularly useful with the new pagination implementation.
24-29
: Improved implementation with pagination.The change from direct API call to using the paginate helper method is a significant improvement for handling larger datasets.
31-46
: Filtering logic with maxResults limiting works correctly.The implementation correctly filters contacts based on search criteria and respects the maxResults limit. The approach of filtering after fetching contacts is appropriate since the Microsoft Graph API doesn't support complex filtering on these fields.
49-49
: Summary message update is appropriate.The updated summary message correctly reflects that matching contacts were found rather than filtered.
components/microsoft_outlook/actions/list-contacts/list-contacts.mjs (5)
6-8
: Version increment and documentation improvements look good.The version update from 0.0.11 to 0.0.12 and improved documentation link are good changes.
12-12
: Fixed typo in property label.Correcting "Email adress" to "Email Address" improves the UI accuracy.
17-22
: Good addition of the maxResults property.Adding the maxResults property ensures consistency with other actions and provides control over result volume.
25-32
: Improved implementation with pagination.The change from direct API call to using the paginate helper method with max parameter is a good improvement for handling large datasets.
34-41
: Collection and return of results is well-implemented.The approach of collecting paginated results into an array and providing an appropriate summary message is clean and effective.
components/microsoft_outlook/microsoft_outlook.app.mjs (7)
6-6
: Good addition of DEFAULT_LIMIT constant.Adding a constant for the default limit promotes code consistency and makes future changes easier.
66-78
: Contact options method updated for pagination.The options method now properly handles pagination using the DEFAULT_LIMIT constant.
136-151
: Message options method updated for pagination.The implementation for paginating message options is consistent with the contact options approach.
157-171
: Folder options method updated for pagination.The implementation for paginating folder options is consistent with the other options methods.
173-179
: Well-defined maxResults property.The maxResults property is defined with appropriate defaults and description, making it reusable across components.
327-332
: Simplified parameter handling in listContacts.The method now directly modifies args.params rather than using a separate paramsContainer, which is more consistent with other methods.
406-430
: Well-implemented paginate generator method.The paginate method is a well-designed generator function that handles iteration through paginated results efficiently. It correctly:
- Uses DEFAULT_LIMIT for consistency
- Manages skip/top parameters for pagination
- Respects the max parameter to limit results
- Terminates when no more results are available
components/microsoft_outlook/actions/find-email/find-email.mjs (4)
7-7
: Version increment looks good.The version update from 0.0.2 to 0.0.3 reflects the functional changes appropriately.
18-21
: Good update to use shared maxResults property definition.Updating the maxResults property to use the propDefinition from microsoftOutlook ensures consistency across components.
25-34
: Improved implementation with pagination.The change from direct API call to using the paginate helper method is a good improvement for handling large datasets.
36-44
: Collection and return of results is well-implemented.The approach of collecting paginated results into an array and providing an appropriate summary message is clean and effective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @michelle0927, LGTM! Ready for QA!
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: 0
🧹 Nitpick comments (1)
components/microsoft_outlook/actions/find-contacts/find-contacts.mjs (1)
23-50
: Consider adding error handlingWhile the implementation is functionally correct, consider adding try/catch blocks around the pagination logic to handle potential errors gracefully.
async run({ $ }) { + try { const contacts = this.microsoftOutlook.paginate({ fn: this.microsoftOutlook.listContacts, args: { $, }, }); const relatedContacts = []; for await (const contact of contacts) { if ( contact?.displayName?.includes(this.searchString) || contact?.givenName?.includes(this.searchString) || contact?.surname?.includes(this.searchString) || contact?.emailAddresses?.find( (e) => e?.address == this.searchString || e?.name?.includes(this.searchString), ) ) { relatedContacts.push(contact); if (this.maxResults && relatedContacts.length >= this.maxResults) { break; } } } // eslint-disable-next-line multiline-ternary $.export("$summary", `${relatedContacts.length} matching contact${relatedContacts.length != 1 ? "s" : ""} found`); return relatedContacts; + } catch (error) { + $.export("$summary", "Failed to find contacts"); + throw error; + } },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
components/microsoft_outlook/actions/find-contacts/find-contacts.mjs
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
- GitHub Check: Verify TypeScript components
🔇 Additional comments (5)
components/microsoft_outlook/actions/find-contacts/find-contacts.mjs (5)
6-6
: Documentation and versioning updates look goodAppropriate version bump and improved description with documentation link provides better reference for developers.
Also applies to: 8-8
16-21
: Good addition of maxResults propertyThe new
maxResults
property allows users to limit the number of results returned, which is an important feature for pagination. The implementation correctly uses the propDefinition from the parent app.
24-29
: Pagination implementation looks goodThe change from direct API call to using the pagination helper method is a significant improvement for handling large result sets. This approach is more memory-efficient and aligned with the PR's pagination objectives.
31-46
: Efficient contact filtering with early terminationThe implementation correctly:
- Processes contacts as they're returned from the paginator
- Applies the same filtering criteria as before
- Breaks the loop when reaching the maxResults limit
This improves performance by avoiding unnecessary processing when the desired number of results is reached.
49-49
: Improved summary messageThe updated summary message more accurately describes the action result by indicating that matching contacts were found rather than filtered.
/approve |
Resolves #16233
Summary by CodeRabbit