-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - kenjo #15076
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
New Components - kenjo #15076
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis pull request introduces comprehensive enhancements to the Kenjo integration, adding new actions and sources for managing employee-related data. The changes include creating attendance entries, employees, and leave requests, as well as implementing event sources for tracking new companies and employees. The Kenjo app component has been expanded with new methods and properties to support these functionalities, enabling more robust interaction with the Kenjo API. Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 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: 2
🧹 Nitpick comments (8)
components/kenjo/kenjo.app.mjs (3)
6-20
: Consider handling empty or null API responses
Currently,employeeId
options are generated fromlistEmployees()
, filtered forisActive
. IflistEmployees()
returns an unexpected structure (e.g., nodata
or a null response), we could encounter errors. Consider defaulting to an empty array or providing fallback logic.
21-34
: Likewise, consider pagination for listing companies
If there are many companies, thelistCompanies()
call may return a large array. Consider pagination or partial loading if the Kenjo API supports it.
88-101
: Centralized request method with limited error handling
While_makeRequest()
funnels all requests through a single method, consider adding more robust error trapping (like catching 4xx / 5xx responses). This will help the flows gracefully handle API errors and provide meaningful messages.components/kenjo/sources/new-company-created/new-company-created.mjs (1)
3-23
: New company created event source
This logic cleanly extends the common base, retrieves new companies usinglistCompanies()
, and emits them with a helpful summary. Consider logging or error handling iflistCompanies()
fails or returns unexpected data.components/kenjo/sources/common/base.mjs (1)
26-40
: Core run logic
Iterates over items returned by the resource function, then emits each with metadata. This framework is flexible. Consider a maximum item cap or paginated retrieval for sources that might return large datasets.components/kenjo/actions/create-attendance-entry/create-attendance-entry.mjs (1)
4-52
: Properties for attendance creation
Well-defined properties, including optional break times. We might want to add a format validator on time fields if the API is strict about thehh:mm:ss
format, otherwise we rely on Kenjo’s server to handle validation.components/kenjo/actions/create-leave-request/create-leave-request.mjs (1)
33-52
: Consider defaulting toStartOfDay
andEndOfDay
if unset.
If the user leavespartOfDayFrom
orpartOfDayTo
blank, you might default them here in therun
method to avoid potential API errors.components/kenjo/actions/create-employee/create-employee.mjs (1)
87-107
: EnsureworkDays
aligns with real schedules.
IfworkDays
is left empty, it is interpreted as an employee working no days. Confirm if this is the intended behavior or if defaults should be used. Similarly, confirm whethertrackAttendance
should default tofalse
if unset.
📜 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 (8)
components/kenjo/actions/create-attendance-entry/create-attendance-entry.mjs
(1 hunks)components/kenjo/actions/create-employee/create-employee.mjs
(1 hunks)components/kenjo/actions/create-leave-request/create-leave-request.mjs
(1 hunks)components/kenjo/kenjo.app.mjs
(1 hunks)components/kenjo/package.json
(2 hunks)components/kenjo/sources/common/base.mjs
(1 hunks)components/kenjo/sources/new-company-created/new-company-created.mjs
(1 hunks)components/kenjo/sources/new-employee-created/new-employee-created.mjs
(1 hunks)
🔇 Additional comments (22)
components/kenjo/kenjo.app.mjs (9)
1-2
: Imports look good.
No concerns regarding the imported modules.
35-48
: Time-off type listing appears straightforward
The code for timeOffTypeId
is consistent with the approach for other IDs. Looks good, with the same remark about handling possibly large data sets or empty arrays.
49-67
: Optional office ID logic is solid
Accepting a companyId
for filtering offices is a good approach. Consider returning an empty array if companyId
is not defined, or if the user might skip that selection.
68-82
: Department listing
Similar to offices and companies, watch out for large or paged data sets from listDepartments()
.
85-87
: Base URL retrieval
Returning the API URL from this.$auth
is standard. Verify that api_url
is always populated in the user’s auth object.
102-131
: List methods appear consistent
All list methods (listCompanies
, listOffices
, listDepartments
, listEmployees
, and listTimeOffTypes
) uniformly use _makeRequest
. This consistency is good. A next step could be adding optional parameters (e.g. pagination limits) if supported by the API.
132-138
: Employee creation logic
Straightforward creation method. Consider systematically handling the response for partial success or validation errors if they arise.
139-145
: Leave request creation method
Matches the pattern used in createEmployee
. Minimal overhead—good job keeping consistent naming.
146-151
: Attendance entry creation method
Implementation is consistent with the other creation methods. If attendance creation has unique validations (e.g., overlapping time checks), consider an additional check or returning informative errors.
components/kenjo/sources/new-company-created/new-company-created.mjs (1)
1-2
: Base module import
Importing the shared common
utility helps standardize event logic. No issues found.
components/kenjo/sources/new-employee-created/new-employee-created.mjs (2)
1-2
: Base module import
Similar approach to new-company-created
. No issues.
3-27
: New employee created event source
The approach reuses shared logic and properly references listEmployees()
. Generating metadata with employee.email
is user-friendly.
components/kenjo/sources/common/base.mjs (2)
1-3
: Imports
Pulling kenjo
from the same-level app and using the default polling interval is standard for sources. No concerns.
4-24
: Common source props and partial method stubs
Defining placeholders such as getResourceFn()
and generateMeta()
for extension is an excellent approach. This fosters reusability across new event sources.
components/kenjo/actions/create-attendance-entry/create-attendance-entry.mjs (2)
1-3
: Imports
Importing kenjo
and ConfigurationError
is appropriate for the creation logic.
53-76
: Runtime logic
The check for breakEndTime
requiring a breakStartTime
is prudent. The final summary message is clear. Overall, nicely handled with a minimal but sufficient guard.
components/kenjo/actions/create-leave-request/create-leave-request.mjs (2)
3-8
: Looks good -- clear metadata and naming.
The name and description fields accurately describe the action. Versioning and action type are well-defined.
23-32
: Validate the date format and range.
Although the action description indicates the YYYY-MM-DD
format, consider adding validation or checks to ensure the user provides valid dates and that the from
date precedes the to
date.
components/kenjo/actions/create-employee/create-employee.mjs (2)
3-8
: Action metadata is consistent and descriptive.
The naming conventions and references to the Kenjo docs are clear. This helps users quickly identify the purpose of the action.
10-132
: Validate required fields and clarify optional ones.
- Fields like
email
,firstName
,lastName
,companyId
, andweeklyHours
are essential. Consider checking if they are missing or invalid before calling the API. - Fields like
language
orbirthdate
are optional, so specifying defaults or using safe fallback logic could improve robustness.
components/kenjo/package.json (2)
3-3
: Minor version bump looks appropriate.
You’ve introduced new features, so incrementing to 0.1.0
is consistent with semantic versioning for new functionality.
14-18
: Check that the added dependency is truly necessary.
Confirm that all features from @pipedream/platform
are utilized in the new actions or sources. Removing unused dependencies keeps the package lean.
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!
Resolves #15065.
Summary by CodeRabbit
Release Notes
New Features
Enhancements
Version Update
Documentation