-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Hostaway new action #14825
base: master
Are you sure you want to change the base?
Hostaway new action #14825
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis pull request introduces a new module for creating reservations in the Hostaway system, along with updates to existing modules and constants. Key changes include a new action for reservation creation, updates to version numbers for several existing actions, and modifications to property keys and constants. The overall structure of the components remains intact, with enhancements primarily focused on the reservation creation functionality and version management. Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
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: 3
🧹 Outside diff range and nitpick comments (4)
components/hostaway/common/constants.mjs (1)
45-61
: Improve code formatting and structure of CHANNEL_OPTIONSThe channel options are correctly defined but could benefit from better formatting for consistency and readability.
Apply this formatting:
const CHANNEL_OPTIONS = [ - { value: 2018, label: "airbnbOfficial", }, -{ value: 2002, label: "homeaway", }, + { + value: 2018, + label: "airbnbOfficial", + }, + { + value: 2002, + label: "homeaway", + }, // ... format other entries similarly ];This matches the formatting style used in the
CATEGORIES
constant above.🧰 Tools
🪛 eslint
[error] 46-46: Expected a line break after this opening brace.
(object-curly-newline)
[error] 46-46: Object properties must go on a new line.
(object-property-newline)
[error] 46-46: Unexpected trailing comma.
(comma-dangle)
[error] 46-46: Expected a line break before this closing brace.
(object-curly-newline)
[error] 47-47: Expected a line break after this opening brace.
(object-curly-newline)
[error] 47-47: Expected indentation of 2 spaces but found 0.
(indent)
[error] 47-47: Object properties must go on a new line.
(object-property-newline)
[error] 47-47: Unexpected trailing comma.
(comma-dangle)
[error] 47-47: Expected a line break before this closing brace.
(object-curly-newline)
[error] 48-48: Expected a line break after this opening brace.
(object-curly-newline)
[error] 48-48: Expected indentation of 2 spaces but found 0.
(indent)
[error] 48-48: Object properties must go on a new line.
(object-property-newline)
[error] 48-48: Unexpected trailing comma.
(comma-dangle)
[error] 48-48: Expected a line break before this closing brace.
(object-curly-newline)
[error] 49-49: Expected a line break after this opening brace.
(object-curly-newline)
[error] 49-49: Expected indentation of 2 spaces but found 0.
(indent)
[error] 49-49: Object properties must go on a new line.
(object-property-newline)
[error] 49-49: Unexpected trailing comma.
(comma-dangle)
[error] 49-49: Expected a line break before this closing brace.
(object-curly-newline)
[error] 50-50: Expected a line break after this opening brace.
(object-curly-newline)
[error] 50-50: Expected indentation of 2 spaces but found 0.
(indent)
[error] 50-50: Object properties must go on a new line.
(object-property-newline)
[error] 50-50: Unexpected trailing comma.
(comma-dangle)
[error] 50-50: Expected a line break before this closing brace.
(object-curly-newline)
[error] 51-51: Expected a line break after this opening brace.
(object-curly-newline)
[error] 51-51: Expected indentation of 2 spaces but found 0.
(indent)
[error] 51-51: Object properties must go on a new line.
(object-property-newline)
[error] 51-51: Unexpected trailing comma.
(comma-dangle)
[error] 51-51: Expected a line break before this closing brace.
(object-curly-newline)
[error] 52-52: Expected a line break after this opening brace.
(object-curly-newline)
[error] 52-52: Expected indentation of 2 spaces but found 0.
(indent)
[error] 52-52: Object properties must go on a new line.
(object-property-newline)
[error] 52-52: Unexpected trailing comma.
(comma-dangle)
[error] 52-52: Expected a line break before this closing brace.
(object-curly-newline)
[error] 53-53: Expected a line break after this opening brace.
(object-curly-newline)
[error] 53-53: Expected indentation of 2 spaces but found 0.
(indent)
[error] 53-53: Object properties must go on a new line.
(object-property-newline)
[error] 53-53: Unexpected trailing comma.
(comma-dangle)
[error] 53-53: Expected a line break before this closing brace.
(object-curly-newline)
[error] 54-54: Expected a line break after this opening brace.
(object-curly-newline)
[error] 54-54: Expected indentation of 2 spaces but found 0.
(indent)
[error] 54-54: Object properties must go on a new line.
(object-property-newline)
[error] 54-54: Unexpected trailing comma.
(comma-dangle)
[error] 54-54: Expected a line break before this closing brace.
(object-curly-newline)
[error] 55-55: Expected a line break after this opening brace.
(object-curly-newline)
[error] 55-55: Expected indentation of 2 spaces but found 0.
(indent)
[error] 55-55: Object properties must go on a new line.
(object-property-newline)
[error] 55-55: Unexpected trailing comma.
(comma-dangle)
[error] 55-55: Expected a line break before this closing brace.
(object-curly-newline)
[error] 56-56: Expected a line break after this opening brace.
(object-curly-newline)
[error] 56-56: Expected indentation of 2 spaces but found 0.
(indent)
[error] 56-56: Object properties must go on a new line.
(object-property-newline)
[error] 56-56: Unexpected trailing comma.
(comma-dangle)
[error] 56-56: Expected a line break before this closing brace.
(object-curly-newline)
[error] 57-57: Expected a line break after this opening brace.
(object-curly-newline)
[error] 57-57: Expected indentation of 2 spaces but found 0.
(indent)
[error] 57-57: Object properties must go on a new line.
(object-property-newline)
[error] 57-57: Unexpected trailing comma.
(comma-dangle)
[error] 57-57: Expected a line break before this closing brace.
(object-curly-newline)
[error] 58-58: Expected a line break after this opening brace.
(object-curly-newline)
[error] 58-58: Expected indentation of 2 spaces but found 0.
(indent)
[error] 58-58: Object properties must go on a new line.
(object-property-newline)
[error] 58-58: Unexpected trailing comma.
(comma-dangle)
[error] 58-58: Expected a line break before this closing brace.
(object-curly-newline)
[error] 59-59: Expected a line break after this opening brace.
(object-curly-newline)
[error] 59-59: Expected indentation of 2 spaces but found 0.
(indent)
[error] 59-59: Object properties must go on a new line.
(object-property-newline)
[error] 59-59: Unexpected trailing comma.
(comma-dangle)
[error] 59-59: Expected a line break before this closing brace.
(object-curly-newline)
[error] 60-60: Expected a line break after this opening brace.
(object-curly-newline)
[error] 60-60: Expected indentation of 2 spaces but found 0.
(indent)
[error] 60-60: Object properties must go on a new line.
(object-property-newline)
[error] 60-60: Unexpected trailing comma.
(comma-dangle)
[error] 60-60: Expected a line break before this closing brace.
(object-curly-newline)
🪛 GitHub Check: Lint Code Base
[failure] 46-46:
Expected a line break after this opening brace
[failure] 46-46:
Object properties must go on a new line
[failure] 46-46:
Unexpected trailing comma
[failure] 46-46:
Expected a line break before this closing brace
[failure] 47-47:
Expected a line break after this opening brace
[failure] 47-47:
Expected indentation of 2 spaces but found 0components/hostaway/actions/create-reservation/create-reservation.mjs (1)
51-56
: Document common additional fieldsWhile the documentation link is helpful, consider listing common additional fields in the description.
Update the description to include common fields:
additionalFields: { type: "object", label: "Additional Fields", - description: "Additional fields to set for the reservation. [See the documentation](https://api.hostaway.com/documentation#reservation-object) for all available fields.", + description: "Additional fields to set for the reservation. Common fields include: `guestPhone`, `adults`, `children`, `pets`, `price`, `currency`. [See the documentation](https://api.hostaway.com/documentation#reservation-object) for all available fields.", optional: true, }🧰 Tools
🪛 GitHub Check: Lint Code Base
[failure] 56-56:
Missing trailing commacomponents/hostaway/actions/update-task/update-task.mjs (1)
Inconsistent property naming found in Hostaway components
The codebase shows inconsistent usage between
listingId
andlistingMapId
:
- In Hostaway components, there's a mix where input props are named
listingId
but they're being mapped tolistingMapId
in API calls:
components/hostaway/actions/update-task/update-task.mjs
components/hostaway/actions/create-task/create-task.mjs
components/hostaway/actions/send-message-to-guest/send-message-to-guest.mjs
- However,
components/hostaway/actions/create-reservation/create-reservation.mjs
directly useslistingMapId
as the prop nameThis inconsistency should be standardized to use
listingMapId
throughout the Hostaway components for clarity and consistency.🔗 Analysis chain
Line range hint
67-75
: Verify consistent use of listingMapIdLet's verify that the rename from
listingId
tolistingMapId
is consistent across the codebase.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any remaining uses of listingId that should be listingMapId # Expected: No inconsistent usage of these property names # Search for listingId usage rg "listingId" --type js --type mjs # Search for listingMapId usage rg "listingMapId" --type js --type mjsLength of output: 130
Script:
#!/bin/bash # Search for listingId and listingMapId usage with correct file type flags rg "listingId" -t js rg "listingMapId" -t js # Also search without file type restriction to catch .mjs files rg "listingId" rg "listingMapId"Length of output: 6702
components/hostaway/hostaway.app.mjs (1)
220-226
: LGTM! Consider adding JSDoc comments.The implementation follows the established pattern and correctly uses the _makeRequest helper. To improve maintainability, consider adding JSDoc comments describing the expected arguments and return value, similar to the Hostaway API documentation.
+ /** + * Creates a new reservation + * @param {Object} args - The reservation details + * @returns {Promise<Object>} The created reservation + */ createReservation(args = {}) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (10)
components/hostaway/actions/create-reservation/create-reservation.mjs
(1 hunks)components/hostaway/actions/create-task/create-task.mjs
(1 hunks)components/hostaway/actions/send-message-to-guest/send-message-to-guest.mjs
(1 hunks)components/hostaway/actions/update-task/update-task.mjs
(1 hunks)components/hostaway/common/constants.mjs
(1 hunks)components/hostaway/hostaway.app.mjs
(2 hunks)components/hostaway/package.json
(1 hunks)components/hostaway/sources/new-message-received/new-message-received.mjs
(1 hunks)components/hostaway/sources/reservation-created/reservation-created.mjs
(1 hunks)components/hostaway/sources/reservation-updated/reservation-updated.mjs
(1 hunks)
✅ Files skipped from review due to trivial changes (6)
- components/hostaway/actions/create-task/create-task.mjs
- components/hostaway/actions/send-message-to-guest/send-message-to-guest.mjs
- components/hostaway/sources/new-message-received/new-message-received.mjs
- components/hostaway/sources/reservation-updated/reservation-updated.mjs
- components/hostaway/sources/reservation-created/reservation-created.mjs
- components/hostaway/package.json
🧰 Additional context used
🪛 eslint
components/hostaway/common/constants.mjs
[error] 46-46: Expected a line break after this opening brace.
(object-curly-newline)
[error] 46-46: Object properties must go on a new line.
(object-property-newline)
[error] 46-46: Unexpected trailing comma.
(comma-dangle)
[error] 46-46: Expected a line break before this closing brace.
(object-curly-newline)
[error] 47-47: Expected a line break after this opening brace.
(object-curly-newline)
[error] 47-47: Expected indentation of 2 spaces but found 0.
(indent)
[error] 47-47: Object properties must go on a new line.
(object-property-newline)
[error] 47-47: Unexpected trailing comma.
(comma-dangle)
[error] 47-47: Expected a line break before this closing brace.
(object-curly-newline)
[error] 48-48: Expected a line break after this opening brace.
(object-curly-newline)
[error] 48-48: Expected indentation of 2 spaces but found 0.
(indent)
[error] 48-48: Object properties must go on a new line.
(object-property-newline)
[error] 48-48: Unexpected trailing comma.
(comma-dangle)
[error] 48-48: Expected a line break before this closing brace.
(object-curly-newline)
[error] 49-49: Expected a line break after this opening brace.
(object-curly-newline)
[error] 49-49: Expected indentation of 2 spaces but found 0.
(indent)
[error] 49-49: Object properties must go on a new line.
(object-property-newline)
[error] 49-49: Unexpected trailing comma.
(comma-dangle)
[error] 49-49: Expected a line break before this closing brace.
(object-curly-newline)
[error] 50-50: Expected a line break after this opening brace.
(object-curly-newline)
[error] 50-50: Expected indentation of 2 spaces but found 0.
(indent)
[error] 50-50: Object properties must go on a new line.
(object-property-newline)
[error] 50-50: Unexpected trailing comma.
(comma-dangle)
[error] 50-50: Expected a line break before this closing brace.
(object-curly-newline)
[error] 51-51: Expected a line break after this opening brace.
(object-curly-newline)
[error] 51-51: Expected indentation of 2 spaces but found 0.
(indent)
[error] 51-51: Object properties must go on a new line.
(object-property-newline)
[error] 51-51: Unexpected trailing comma.
(comma-dangle)
[error] 51-51: Expected a line break before this closing brace.
(object-curly-newline)
[error] 52-52: Expected a line break after this opening brace.
(object-curly-newline)
[error] 52-52: Expected indentation of 2 spaces but found 0.
(indent)
[error] 52-52: Object properties must go on a new line.
(object-property-newline)
[error] 52-52: Unexpected trailing comma.
(comma-dangle)
[error] 52-52: Expected a line break before this closing brace.
(object-curly-newline)
[error] 53-53: Expected a line break after this opening brace.
(object-curly-newline)
[error] 53-53: Expected indentation of 2 spaces but found 0.
(indent)
[error] 53-53: Object properties must go on a new line.
(object-property-newline)
[error] 53-53: Unexpected trailing comma.
(comma-dangle)
[error] 53-53: Expected a line break before this closing brace.
(object-curly-newline)
[error] 54-54: Expected a line break after this opening brace.
(object-curly-newline)
[error] 54-54: Expected indentation of 2 spaces but found 0.
(indent)
[error] 54-54: Object properties must go on a new line.
(object-property-newline)
[error] 54-54: Unexpected trailing comma.
(comma-dangle)
[error] 54-54: Expected a line break before this closing brace.
(object-curly-newline)
[error] 55-55: Expected a line break after this opening brace.
(object-curly-newline)
[error] 55-55: Expected indentation of 2 spaces but found 0.
(indent)
[error] 55-55: Object properties must go on a new line.
(object-property-newline)
[error] 55-55: Unexpected trailing comma.
(comma-dangle)
[error] 55-55: Expected a line break before this closing brace.
(object-curly-newline)
[error] 56-56: Expected a line break after this opening brace.
(object-curly-newline)
[error] 56-56: Expected indentation of 2 spaces but found 0.
(indent)
[error] 56-56: Object properties must go on a new line.
(object-property-newline)
[error] 56-56: Unexpected trailing comma.
(comma-dangle)
[error] 56-56: Expected a line break before this closing brace.
(object-curly-newline)
[error] 57-57: Expected a line break after this opening brace.
(object-curly-newline)
[error] 57-57: Expected indentation of 2 spaces but found 0.
(indent)
[error] 57-57: Object properties must go on a new line.
(object-property-newline)
[error] 57-57: Unexpected trailing comma.
(comma-dangle)
[error] 57-57: Expected a line break before this closing brace.
(object-curly-newline)
[error] 58-58: Expected a line break after this opening brace.
(object-curly-newline)
[error] 58-58: Expected indentation of 2 spaces but found 0.
(indent)
[error] 58-58: Object properties must go on a new line.
(object-property-newline)
[error] 58-58: Unexpected trailing comma.
(comma-dangle)
[error] 58-58: Expected a line break before this closing brace.
(object-curly-newline)
[error] 59-59: Expected a line break after this opening brace.
(object-curly-newline)
[error] 59-59: Expected indentation of 2 spaces but found 0.
(indent)
[error] 59-59: Object properties must go on a new line.
(object-property-newline)
[error] 59-59: Unexpected trailing comma.
(comma-dangle)
[error] 59-59: Expected a line break before this closing brace.
(object-curly-newline)
[error] 60-60: Expected a line break after this opening brace.
(object-curly-newline)
[error] 60-60: Expected indentation of 2 spaces but found 0.
(indent)
[error] 60-60: Object properties must go on a new line.
(object-property-newline)
[error] 60-60: Unexpected trailing comma.
(comma-dangle)
[error] 60-60: Expected a line break before this closing brace.
(object-curly-newline)
[error] 61-62: Missing semicolon.
(semi)
components/hostaway/hostaway.app.mjs
[error] 125-126: Missing trailing comma.
(comma-dangle)
components/hostaway/actions/create-reservation/create-reservation.mjs
[error] 56-57: Missing trailing comma.
(comma-dangle)
[error] 59-59: Expected a line break after this opening brace.
(object-curly-newline)
[error] 59-59: Expected a line break before this closing brace.
(object-curly-newline)
[error] 64-65: Missing trailing comma.
(comma-dangle)
🪛 GitHub Check: Lint Code Base
components/hostaway/common/constants.mjs
[failure] 46-46:
Expected a line break after this opening brace
[failure] 46-46:
Object properties must go on a new line
[failure] 46-46:
Unexpected trailing comma
[failure] 46-46:
Expected a line break before this closing brace
[failure] 47-47:
Expected a line break after this opening brace
[failure] 47-47:
Expected indentation of 2 spaces but found 0
components/hostaway/actions/create-reservation/create-reservation.mjs
[failure] 56-56:
Missing trailing comma
[failure] 59-59:
Expected a line break after this opening brace
[failure] 59-59:
Expected a line break before this closing brace
[failure] 64-64:
Missing trailing comma
🔇 Additional comments (2)
components/hostaway/common/constants.mjs (1)
45-61
: Verify channel IDs against Hostaway API
Let's verify these channel IDs match the official Hostaway API documentation.
🧰 Tools
🪛 eslint
[error] 46-46: Expected a line break after this opening brace.
(object-curly-newline)
[error] 46-46: Object properties must go on a new line.
(object-property-newline)
[error] 46-46: Unexpected trailing comma.
(comma-dangle)
[error] 46-46: Expected a line break before this closing brace.
(object-curly-newline)
[error] 47-47: Expected a line break after this opening brace.
(object-curly-newline)
[error] 47-47: Expected indentation of 2 spaces but found 0.
(indent)
[error] 47-47: Object properties must go on a new line.
(object-property-newline)
[error] 47-47: Unexpected trailing comma.
(comma-dangle)
[error] 47-47: Expected a line break before this closing brace.
(object-curly-newline)
[error] 48-48: Expected a line break after this opening brace.
(object-curly-newline)
[error] 48-48: Expected indentation of 2 spaces but found 0.
(indent)
[error] 48-48: Object properties must go on a new line.
(object-property-newline)
[error] 48-48: Unexpected trailing comma.
(comma-dangle)
[error] 48-48: Expected a line break before this closing brace.
(object-curly-newline)
[error] 49-49: Expected a line break after this opening brace.
(object-curly-newline)
[error] 49-49: Expected indentation of 2 spaces but found 0.
(indent)
[error] 49-49: Object properties must go on a new line.
(object-property-newline)
[error] 49-49: Unexpected trailing comma.
(comma-dangle)
[error] 49-49: Expected a line break before this closing brace.
(object-curly-newline)
[error] 50-50: Expected a line break after this opening brace.
(object-curly-newline)
[error] 50-50: Expected indentation of 2 spaces but found 0.
(indent)
[error] 50-50: Object properties must go on a new line.
(object-property-newline)
[error] 50-50: Unexpected trailing comma.
(comma-dangle)
[error] 50-50: Expected a line break before this closing brace.
(object-curly-newline)
[error] 51-51: Expected a line break after this opening brace.
(object-curly-newline)
[error] 51-51: Expected indentation of 2 spaces but found 0.
(indent)
[error] 51-51: Object properties must go on a new line.
(object-property-newline)
[error] 51-51: Unexpected trailing comma.
(comma-dangle)
[error] 51-51: Expected a line break before this closing brace.
(object-curly-newline)
[error] 52-52: Expected a line break after this opening brace.
(object-curly-newline)
[error] 52-52: Expected indentation of 2 spaces but found 0.
(indent)
[error] 52-52: Object properties must go on a new line.
(object-property-newline)
[error] 52-52: Unexpected trailing comma.
(comma-dangle)
[error] 52-52: Expected a line break before this closing brace.
(object-curly-newline)
[error] 53-53: Expected a line break after this opening brace.
(object-curly-newline)
[error] 53-53: Expected indentation of 2 spaces but found 0.
(indent)
[error] 53-53: Object properties must go on a new line.
(object-property-newline)
[error] 53-53: Unexpected trailing comma.
(comma-dangle)
[error] 53-53: Expected a line break before this closing brace.
(object-curly-newline)
[error] 54-54: Expected a line break after this opening brace.
(object-curly-newline)
[error] 54-54: Expected indentation of 2 spaces but found 0.
(indent)
[error] 54-54: Object properties must go on a new line.
(object-property-newline)
[error] 54-54: Unexpected trailing comma.
(comma-dangle)
[error] 54-54: Expected a line break before this closing brace.
(object-curly-newline)
[error] 55-55: Expected a line break after this opening brace.
(object-curly-newline)
[error] 55-55: Expected indentation of 2 spaces but found 0.
(indent)
[error] 55-55: Object properties must go on a new line.
(object-property-newline)
[error] 55-55: Unexpected trailing comma.
(comma-dangle)
[error] 55-55: Expected a line break before this closing brace.
(object-curly-newline)
[error] 56-56: Expected a line break after this opening brace.
(object-curly-newline)
[error] 56-56: Expected indentation of 2 spaces but found 0.
(indent)
[error] 56-56: Object properties must go on a new line.
(object-property-newline)
[error] 56-56: Unexpected trailing comma.
(comma-dangle)
[error] 56-56: Expected a line break before this closing brace.
(object-curly-newline)
[error] 57-57: Expected a line break after this opening brace.
(object-curly-newline)
[error] 57-57: Expected indentation of 2 spaces but found 0.
(indent)
[error] 57-57: Object properties must go on a new line.
(object-property-newline)
[error] 57-57: Unexpected trailing comma.
(comma-dangle)
[error] 57-57: Expected a line break before this closing brace.
(object-curly-newline)
[error] 58-58: Expected a line break after this opening brace.
(object-curly-newline)
[error] 58-58: Expected indentation of 2 spaces but found 0.
(indent)
[error] 58-58: Object properties must go on a new line.
(object-property-newline)
[error] 58-58: Unexpected trailing comma.
(comma-dangle)
[error] 58-58: Expected a line break before this closing brace.
(object-curly-newline)
[error] 59-59: Expected a line break after this opening brace.
(object-curly-newline)
[error] 59-59: Expected indentation of 2 spaces but found 0.
(indent)
[error] 59-59: Object properties must go on a new line.
(object-property-newline)
[error] 59-59: Unexpected trailing comma.
(comma-dangle)
[error] 59-59: Expected a line break before this closing brace.
(object-curly-newline)
[error] 60-60: Expected a line break after this opening brace.
(object-curly-newline)
[error] 60-60: Expected indentation of 2 spaces but found 0.
(indent)
[error] 60-60: Object properties must go on a new line.
(object-property-newline)
[error] 60-60: Unexpected trailing comma.
(comma-dangle)
[error] 60-60: Expected a line break before this closing brace.
(object-curly-newline)
🪛 GitHub Check: Lint Code Base
[failure] 46-46:
Expected a line break after this opening brace
[failure] 46-46:
Object properties must go on a new line
[failure] 46-46:
Unexpected trailing comma
[failure] 46-46:
Expected a line break before this closing brace
[failure] 47-47:
Expected a line break after this opening brace
[failure] 47-47:
Expected indentation of 2 spaces but found 0
components/hostaway/actions/update-task/update-task.mjs (1)
9-9
: Version bump is appropriate
The version increment from 0.0.1 to 0.0.2 is appropriate for the property rename change.
arrivalDate: { | ||
type: "string", | ||
label: "Arrival Date", | ||
description: "Arrival date in `YYYY-MM-DD` format, e.g. `2024-08-15`", | ||
}, | ||
departureDate: { | ||
type: "string", | ||
label: "Departure Date", | ||
description: "Departure date in `YYYY-MM-DD` format, e.g. `2024-08-19`", | ||
}, |
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.
🛠️ Refactor suggestion
Add date validation for arrival and departure dates
While the date format is documented, there's no validation to ensure dates are:
- In the correct format
- Arrival is before departure
- Not in the past
Consider adding validation in the run method:
async run({ $ }) {
const { hostaway, additionalFields = {}, ...data } = this;
+ const arrival = new Date(data.arrivalDate);
+ const departure = new Date(data.departureDate);
+
+ if (isNaN(arrival.getTime()) || isNaN(departure.getTime())) {
+ throw new Error("Invalid date format. Use YYYY-MM-DD");
+ }
+
+ if (arrival >= departure) {
+ throw new Error("Arrival date must be before departure date");
+ }
+
+ if (arrival < new Date()) {
+ throw new Error("Arrival date cannot be in the past");
+ }
const { result } = await hostaway.createReservation({
Committable suggestion skipped: line range outside the PR's diff.
async run({ $ }) { | ||
const { hostaway, additionalFields = {}, ...data } = this; | ||
const { result } = await hostaway.createReservation({ | ||
$, | ||
data: { | ||
...data, | ||
...additionalFields | ||
}, | ||
}); | ||
|
||
if (result?.id) { | ||
$.export("summary", `Successfully created reservation (ID: ${result.id})`); | ||
} | ||
|
||
return result; | ||
}, |
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.
🛠️ Refactor suggestion
Enhance error handling in run method
The current implementation could benefit from better error handling and validation.
Consider adding try-catch and validation:
async run({ $ }) {
- const { hostaway, additionalFields = {}, ...data } = this;
- const { result } = await hostaway.createReservation({
- $,
- data: {
- ...data,
- ...additionalFields
- },
- });
+ try {
+ const { hostaway, additionalFields = {}, ...data } = this;
+
+ // Validate required fields
+ if (!data.channelId || !data.listingMapId) {
+ throw new Error("channelId and listingMapId are required");
+ }
+
+ const { result } = await hostaway.createReservation({
+ $,
+ data: {
+ ...data,
+ ...additionalFields,
+ },
+ });
- if (result?.id) {
- $.export("summary", `Successfully created reservation (ID: ${result.id})`);
- }
+ if (!result?.id) {
+ throw new Error("Failed to create reservation: No ID returned");
+ }
+
+ $.export("summary", `Successfully created reservation (ID: ${result.id})`);
+ return result;
+ } catch (error) {
+ throw new Error(`Failed to create reservation: ${error.message}`);
+ }
- return result;
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
async run({ $ }) { | |
const { hostaway, additionalFields = {}, ...data } = this; | |
const { result } = await hostaway.createReservation({ | |
$, | |
data: { | |
...data, | |
...additionalFields | |
}, | |
}); | |
if (result?.id) { | |
$.export("summary", `Successfully created reservation (ID: ${result.id})`); | |
} | |
return result; | |
}, | |
async run({ $ }) { | |
try { | |
const { hostaway, additionalFields = {}, ...data } = this; | |
// Validate required fields | |
if (!data.channelId || !data.listingMapId) { | |
throw new Error("channelId and listingMapId are required"); | |
} | |
const { result } = await hostaway.createReservation({ | |
$, | |
data: { | |
...data, | |
...additionalFields, | |
}, | |
}); | |
if (!result?.id) { | |
throw new Error("Failed to create reservation: No ID returned"); | |
} | |
$.export("summary", `Successfully created reservation (ID: ${result.id})`); | |
return result; | |
} catch (error) { | |
throw new Error(`Failed to create reservation: ${error.message}`); | |
} | |
}, |
🧰 Tools
🪛 eslint
[error] 59-59: Expected a line break after this opening brace.
(object-curly-newline)
[error] 59-59: Expected a line break before this closing brace.
(object-curly-newline)
[error] 64-65: Missing trailing comma.
(comma-dangle)
🪛 GitHub Check: Lint Code Base
[failure] 59-59:
Expected a line break after this opening brace
[failure] 59-59:
Expected a line break before this closing brace
[failure] 64-64:
Missing trailing comma
components/hostaway/hostaway.app.mjs
Outdated
channelId: { | ||
type: "integer", | ||
label: "Channel", | ||
description: "Identifier of the channel", | ||
options: constants.CHANNEL_OPTIONS | ||
}, |
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.
💡 Codebase verification
Add trailing comma for consistency and fix CHANNEL_OPTIONS formatting
The property definition needs a trailing comma, and I noticed the CHANNEL_OPTIONS constant has inconsistent formatting:
channelId: {
type: "integer",
label: "Channel",
description: "Identifier of the channel",
- options: constants.CHANNEL_OPTIONS
+ options: constants.CHANNEL_OPTIONS,
},
components/hostaway/common/constants.mjs
: Fix inconsistent indentation and trailing commas in CHANNEL_OPTIONS array items. The first item is indented while others aren't.
🔗 Analysis chain
Add trailing comma for consistency.
The property definition looks good, but needs a trailing comma to match the style of other properties in this file.
channelId: {
type: "integer",
label: "Channel",
description: "Identifier of the channel",
- options: constants.CHANNEL_OPTIONS
+ options: constants.CHANNEL_OPTIONS,
},
Let's verify the channel options are properly defined:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if CHANNEL_OPTIONS are defined in constants file
rg "CHANNEL_OPTIONS.*=.*\[" components/hostaway/common/constants.mjs
Length of output: 96
Script:
#!/bin/bash
# Let's check the full definition of CHANNEL_OPTIONS to ensure it's properly populated
rg -A10 "CHANNEL_OPTIONS.*=.*\[" components/hostaway/common/constants.mjs
Length of output: 496
🧰 Tools
🪛 eslint
[error] 125-126: Missing trailing comma.
(comma-dangle)
Closes #14431
Note: I was only able to successfully create a reservation using channel ID 2000, although the API documentation lists all the ones that are available here.
Summary by CodeRabbit
Release Notes
New Features
Version Updates
New Constants