Repository navigation
chore: clean up old zoho logic after releasing vdmv2 - #4189
Conversation
Summary by CodeRabbit
WalkthroughThis update removes several Zoho API configuration constants and functions, refactors record transformation logic, and simplifies test cases. The changes update bindings in the workflow configuration to reference a new transformation implementation, rename parameters for clarity, and integrate Zoho SDK usage. Test payloads and connection configuration constants have been consolidated and renamed to streamline the code and testing logic. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Workflow as rtWorkflow (V2)
participant Transformer as transformRecord.js
participant ZohoSDK as Zoho SDK / Utils
Client->>Workflow: Send RECORD input
Workflow->>Transformer: Invoke processRecordInputsV2
Transformer->>ZohoSDK: Validate destConfig & process fields
ZohoSDK-->>Transformer: Return processed data or error
Transformer-->>Workflow: Return transformed record
Workflow-->>Client: Deliver record payload
Suggested reviewers
✨ 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
Documentation and Community
|
|
Allure Test reports for this run are available at:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4189 +/- ##
===========================================
- Coverage 91.05% 91.03% -0.02%
===========================================
Files 627 626 -1
Lines 33049 32924 -125
Branches 7818 7795 -23
===========================================
- Hits 30092 29974 -118
+ Misses 2710 2703 -7
Partials 247 247 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
test/integrations/destinations/zoho/router/upsert.ts (1)
492-492: Duplicate check fields
Including both'email'and'Email'may be redundant unless Zoho’s fields differ in case. This could cause confusion or duplication.Consider unifying them in a single array entry for clarity if the Zoho API does not require both variations.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between d641594 and 752c06bd719ba6fc8748e461b0418c0c8f56d79b.
📒 Files selected for processing (10)
src/cdk/v2/destinations/zoho/config.js(0 hunks)src/cdk/v2/destinations/zoho/rtWorkflow.yaml(2 hunks)src/cdk/v2/destinations/zoho/transformRecord.js(0 hunks)src/cdk/v2/destinations/zoho/transformRecordV2.js(2 hunks)src/cdk/v2/destinations/zoho/transformRecordsV2.test.js(5 hunks)src/cdk/v2/destinations/zoho/utils.js(1 hunks)src/cdk/v2/destinations/zoho/utils.test.js(0 hunks)test/integrations/destinations/zoho/common.ts(0 hunks)test/integrations/destinations/zoho/router/deletion.ts(0 hunks)test/integrations/destinations/zoho/router/upsert.ts(11 hunks)
💤 Files with no reviewable changes (5)
- src/cdk/v2/destinations/zoho/transformRecord.js
- src/cdk/v2/destinations/zoho/config.js
- test/integrations/destinations/zoho/common.ts
- src/cdk/v2/destinations/zoho/utils.test.js
- test/integrations/destinations/zoho/router/deletion.ts
🧰 Additional context used
🧬 Code Definitions (2)
src/cdk/v2/destinations/zoho/transformRecordsV2.test.js (1)
src/cdk/v2/destinations/zoho/transformRecordV2.js (6) (6)
require(1-5)require(6-6)require(7-16)require(18-25)require(26-26)processRecordInputs(307-376)
test/integrations/destinations/zoho/router/upsert.ts (1)
test/integrations/destinations/zoho/common.ts (3) (3)
commonConnectionConfigCustomModuleV2(474-474)commonUpsertDestConfig(465-465)commonConnectionConfigV2(470-470)
🔇 Additional comments (19)
src/cdk/v2/destinations/zoho/transformRecordsV2.test.js (2)
1-1: Rename fromprocessRecordInputsV2toprocessRecordInputsis consistent
No issues observed. This correctly aligns with the function’s new name intransformRecordV2.js.
3-3: Updated test description
This description accurately reflects the renamed function under test, ensuring clarity.src/cdk/v2/destinations/zoho/transformRecordV2.js (2)
307-307: Renamed function signature
Renaming fromprocessRecordInputsV2toprocessRecordInputsappears consistent with the rest of the codebase, preserving all logic and parameters. Ensure all references to the old function name have been updated.
378-378: Export updated
The updated export{ processRecordInputs }aligns with the new function name.src/cdk/v2/destinations/zoho/rtWorkflow.yaml (2)
4-5: Workflow binding renamed
Binding the newly namedprocessRecordInputsto./transformRecordV2is consistent with the file rename.
23-23: Invocation reference updated
The workflow now correctly invokes$.processRecordInputsrather than the old wrap function. Confirm that no other references toprocessRecordInputsWrapremain.Would you like to verify usage across the repository to ensure the old wrap function is fully removed?
test/integrations/destinations/zoho/router/upsert.ts (12)
239-239: Clarified test description
Renaming the description to reflect “V2” clarifies this test is based on the updated logic.
266-268: Use ofidentifiersproperty
Introducing anidentifiersfield with'email', causing possible case-sensitivity conflicts.Please confirm that Zoho’s API tolerates the difference between
279-280: Switch to custom module config
Switching tocommonUpsertDestConfig2CustomModuleandcommonConnectionConfigCustomModuleV2likely reflects support for custom modules.
301-303: Repeatedidentifiersblock
This mirrors lines 266-268, maintaining consistency in the second test message. Again, watch for case sensitivity if the final logic depends on a specific casing.
314-315: Potential mismatch
Here,destinationiscommonUpsertDestConfig2butconnectioniscommonConnectionConfigCustomModuleV2, which differs from the first test’s consistent pairing of custom configs.Would you like to confirm that mixing these configs is intentional for this particular scenario?
395-395: Enhanced error test description
The description now explicitly states the condition (module-specific mandatory field missing).
420-420: Ensuring message type
Marking the message type as'record'aligns with typical usage in Zoho transformations.
433-434: Standard config reference
UsingcommonUpsertDestConfigwithcommonConnectionConfigV2is consistent for a “Leads” module scenario.
451-455: Mixed field property naming
This change setsLast_Nametonull—presumably to test an absence scenario—and uses lowercase'Email'for duplications, this discrepancy could cause missed matches.Would you like to confirm that the code or environment has been updated to accept both
'Email'and'email'gracefully, or unify them under a single key?
466-467: Consistent config usage
The lines confirm usage ofcommonUpsertDestConfigandcommonConnectionConfigV2for another scenario. No immediate issues.
485-485: Confirming endpoint
The call to'https://www.zohoapis.com/crm/v6/Leads/upsert'matches previous examples. Just ensure it is the correct latest endpoint.Would you like me to verify that Zoho’s v6 endpoint for upsert is still valid or if a more recent version is recommended?
504-504: Trigger set to'workflow'
Changing from an empty trigger to['workflow']modifies system behavior. Confirm that this is required if you only want Zoho’s workflow processes triggered, and no other.Would you like to confirm in the environment or API documentation that
'workflow'alone triggers the desired Zoho workflows?src/cdk/v2/destinations/zoho/utils.js (1)
10-10: Confirm usage of utility from v0 folderYou're importing
isHttpStatusSuccessfrom../../../../v0/utilin a v2 module. Please verify that referencing the v0 file is intentional and will remain stable going forward. If v0 utilities are deprecated or slated for removal, consider migrating the function into a shared or v2-friendly utility.
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
src/cdk/v2/destinations/zoho/utils.js (1)
35-37: 💡 Verification agent🧩 Analysis chain
Verify the missing fields check logic
The current implementation checks if a field exists in the object BUT is empty, which seems counterintuitive for mandatory field validation. Typically, you'd check if a required field is missing or empty.
🏁 Script executed:
#!/bin/bash # Find usages of validatePresenceOfMandatoryPropertiesV2 to understand the expected behavior rg -A 3 -B 3 "validatePresenceOfMandatoryPropertiesV2" --type jsLength of output: 2124
Mandatory Field Validation Update Needed
The current implementation only flags fields that exist but have empty values. As a mandatory field check, it should also flag fields that are completely missing. For example, update:
const missingFields = moduleWiseMandatoryFields.filter( (field) => object.hasOwnProperty(field) && !isDefinedAndNotNullAndNotEmpty(object[field]), );to something like:
const missingFields = moduleWiseMandatoryFields.filter( (field) => !object.hasOwnProperty(field) || !isDefinedAndNotNullAndNotEmpty(object[field]), );This ensures that both missing and empty fields are correctly identified, aligning with the expected behavior observed in
validatePresenceOfMandatoryPropertiesV2.🧰 Tools
🪛 Biome (1.9.4)
[error] 36-36: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
🧹 Nitpick comments (4)
src/cdk/v2/destinations/zoho/utils.js (4)
10-10: Consider updating import path for consistencyThe import path
'../../../../v0/util'references av0directory while this file is in av2directory. Consider updating this import to use a version-consistent path if available, or document why this cross-version import is necessary.
34-34: Fix typo in commentThere's a typo in the comment: "doens't" should be "doesn't".
- // We have this gurantee because the creation of the configuration doens't permit user to omit the mandatory fields + // We have this guarantee because the creation of the configuration doesn't permit user to omit the mandatory fields
78-86: Consider optimizing the groupConditions functionThe current recursive implementation processes only two elements at a time, which could be inefficient for large condition arrays. Consider a simpler approach using array methods.
-const groupConditions = (conditions) => { - if (conditions.length === 1) { - return conditions[0]; // No need for grouping with a single condition - } - if (conditions.length === 2) { - return `(${conditions[0]} AND ${conditions[1]})`; // Base case - } - return `(${groupConditions(conditions.slice(0, 2))} AND ${groupConditions(conditions.slice(2))})`; -}; +const groupConditions = (conditions) => { + if (conditions.length === 1) { + return conditions[0]; // No need for grouping with a single condition + } + // For multiple conditions, wrap each in parentheses and join with AND + return `(${conditions.join(') AND (')})`; +};
146-146: Update feature name for clarityThe feature name 'deleteRecords' is misleading since this function is being used to search for records, not delete them. Consider updating to a more appropriate name like 'searchRecords'.
- feature: 'deleteRecords', + feature: 'searchRecords',
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 752c06bd719ba6fc8748e461b0418c0c8f56d79b and 96aa8ef89379f33b273e21d2e3b32d3bed2048fd.
📒 Files selected for processing (2)
src/cdk/v2/destinations/zoho/config.js(0 hunks)src/cdk/v2/destinations/zoho/utils.js(2 hunks)
💤 Files with no reviewable changes (1)
- src/cdk/v2/destinations/zoho/config.js
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Code Coverage
- GitHub Check: test_and_publish
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
src/cdk/v2/destinations/zoho/utils.js (1)
129-132: LGTM! Good use of SDKThe change to use
ZOHO_SDK.ZOHO.getBaseRecordUrlfor constructing the URL is a good practice that aligns with the goal of leveraging the Zoho SDK more consistently.
|
Allure Test reports for this run are available at:
|
|
Allure Test reports for this run are available at:
|
ItsSudip
left a comment
There was a problem hiding this comment.
Can we remove v2 from file names?
|
Allure Test reports for this run are available at:
|
|
Allure Test reports for this run are available at:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
test/integrations/destinations/zoho/common.ts (1)
100-100: Consider consolidating repeated connection configs.Multiple
Connectionobjects throughout this file share nearly identical fields, with only minor differences in module, trigger, or identifier mappings. A small factory function or helper could reduce duplication and improve maintainability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 0561279d00affa2f586da82003cb8a041519a9dd and 471c83c6978405f1be8e05d9f736db03f7abe361.
📒 Files selected for processing (10)
src/cdk/v2/destinations/zoho/config.js(0 hunks)src/cdk/v2/destinations/zoho/rtWorkflow.yaml(2 hunks)src/cdk/v2/destinations/zoho/transformRecord.js(15 hunks)src/cdk/v2/destinations/zoho/transformRecordV2.js(0 hunks)src/cdk/v2/destinations/zoho/transformRecords.test.js(5 hunks)src/cdk/v2/destinations/zoho/utils.js(4 hunks)src/cdk/v2/destinations/zoho/utils.test.js(4 hunks)test/integrations/destinations/zoho/common.ts(7 hunks)test/integrations/destinations/zoho/router/deletion.ts(14 hunks)test/integrations/destinations/zoho/router/upsert.ts(20 hunks)
💤 Files with no reviewable changes (2)
- src/cdk/v2/destinations/zoho/transformRecordV2.js
- src/cdk/v2/destinations/zoho/config.js
🚧 Files skipped from review as they are similar to previous changes (2)
- src/cdk/v2/destinations/zoho/transformRecords.test.js
- src/cdk/v2/destinations/zoho/rtWorkflow.yaml
🧰 Additional context used
🧬 Code Definitions (3)
src/cdk/v2/destinations/zoho/transformRecord.js (1)
src/cdk/v2/destinations/zoho/utils.js (8)
destConfig(15-15)destConfig(185-185)identifierType(16-16)formattedFields(53-53)formatMultiSelectFields(45-63)Config(184-184)searchRecordId(182-196)deduceModuleInfo(14-25)
test/integrations/destinations/zoho/router/upsert.ts (1)
test/integrations/destinations/zoho/common.ts (8)
commonConnectionConfig(470-470)commonConnectionConfig2(471-471)commonConnectionConfigCustomModule(474-474)commonUpsertDestConfig2(466-466)commonUpsertDestConfig2CustomModule(469-469)destType(453-453)commonConnectionConfig3(472-472)upsertPayload3(464-464)
test/integrations/destinations/zoho/router/deletion.ts (1)
test/integrations/destinations/zoho/common.ts (3)
commonConnectionConfig4(473-473)deletionPayload1(459-459)commonDeletionConnectionConfig(475-475)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Code Coverage
- GitHub Check: test_and_publish
- GitHub Check: ingestion-service-test
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (58)
src/cdk/v2/destinations/zoho/transformRecord.js (19)
15-15: Reinstating the getHashFromArray import.This correctly re-adds the
getHashFromArrayutility that's needed for handling multi-select fields.
31-31: Parameter renamed fromconfigtodestConfigfor clarity.Renaming from
configtodestConfigimproves code clarity by explicitly indicating this is the destination configuration.
38-39: Better variable destructuring from destConfig.This change properly extracts trigger, duplicate check and multi-select configuration from the destination config.
45-50: Computing hash map once for multiSelectFieldLevelDecision.Computing the hash map once and storing it in a variable improves performance by avoiding redundant computations.
60-60: Using the precomputed multiSelectFieldLevelDecisionAcc.Correctly using the precomputed hash map to support multi-select field appending functionality.
76-76: Parameter renamed in batchResponseBuilder for consistency.This maintains the parameter naming convention established earlier, providing better code consistency.
106-106: Consistently renamed parameter across all functions.Function parameters have been consistently renamed from
configtodestConfigthroughout the file, improving naming clarity.Also applies to: 119-119, 212-212, 246-246, 262-262, 277-277, 338-339, 349-349, 362-362
143-145: Updated function parameters documentation.The JSDoc has been correctly updated to reflect the parameter renaming and consolidation of fields.
152-153: Consolidating identifiers and fields into allFields.This change simplifies the code by combining the identifiers and fields into a single parameter, making validation and processing more straightforward.
158-158: Updating validation call with destConfig.Correctly updating the validation function call to use the new parameter name, maintaining functionality.
166-166: Updated formatMultiSelectFields call.Correctly updating the function call to use the new parameter name while preserving the functionality.
189-193: Enhanced error handling for INSTRUMENTATION_ERROR.This change improves error handling by specifically checking for instrumentation errors and returning the appropriate error type.
248-249: Improved field handling in processInput.Destructuring the message to extract fields, action, and identifiers, then combining identifiers and fields into a single object simplifies the code.
251-251: Updated empty fields check.The check for empty fields now correctly validates the combined allFields object.
267-271: Added validation for empty identifiers.This is a good addition that validates that identifiers aren't empty before proceeding with deletion operations.
311-313: Added validation for destination.This enhances error handling by validating that the destination is provided before processing.
318-327: Added robust config validation.This validation ensures that all required configuration properties are present before proceeding, preventing potential runtime errors.
336-339: Updated deduceModuleInfo call.The function call has been updated to use the correct parameter names while maintaining functionality.
378-378: Simplified module exports.The exports have been simplified to only include the
processRecordInputsfunction, removing the now obsoleteprocessRecordInputsWrap.src/cdk/v2/destinations/zoho/utils.test.js (6)
48-48: Updated function call to use the renamed function.Test has been updated to call
formatMultiSelectFieldsdirectly rather than the removed V2 variant, maintaining test coverage.
191-223: Added comprehensive test cases for complex identifiers.This is a good addition of test cases for handling complex identifier scenarios with multiple fields and different data types.
227-240: Added test for handling multiple records in response.This new test case properly validates that the function can handle responses with multiple record IDs.
278-283: Updated searchRecordId test call.The test call has been updated to use the new parameter structure, ensuring test coverage for the updated function.
336-341: Updated searchRecordId test call for error case.Test case for instrumentation error has been properly updated to match the new function signature.
413-413: Updated deduceModuleInfo test call.The test call has been updated to use the new parameter structure, ensuring test coverage for the updated function.
src/cdk/v2/destinations/zoho/utils.js (7)
10-10: Updated import for isHttpStatusSuccess.The import has been properly updated to use the utility from the v0 folder.
14-25: Simplified deduceModuleInfo implementation.The function has been simplified to directly use the destConfig object and the Zoho SDK, reducing complexity and improving maintainability.
27-43: Simplified validatePresenceOfMandatoryProperties.The function now uses the Zoho SDK to fetch mandatory fields, simplifying the code and reducing dependency on hardcoded configurations.
🧰 Tools
🪛 Biome (1.9.4)
[error] 36-36: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
45-63: Updated formatMultiSelectFields.The function has been updated to use destConfig parameter, maintaining functionality while matching the updated parameter naming convention.
🧰 Tools
🪛 Biome (1.9.4)
[error] 56-56: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
65-74: Improved handleDuplicateCheck function.The function now uses the Zoho SDK to fetch duplicate check fields, removing dependency on hardcoded configurations.
129-132: Updated URL construction using SDK.Using the Zoho SDK for URL construction improves consistency and maintainability.
182-196: Simplified searchRecordId implementation.The function has been simplified to use the destConfig parameter, maintaining functionality while matching the updated parameter naming convention.
test/integrations/destinations/zoho/router/upsert.ts (10)
5-8: Updated import names from V2 variants.The imports have been updated to use the standardized names without V2 suffix, reflecting the codebase cleanup.
39-39: Updated connection configuration references.All references to V2-specific connection configurations have been updated to use the standardized names, maintaining test functionality.
Also applies to: 148-148, 160-160, 279-279, 314-315, 384-385, 433-433, 467-467, 645-645, 657-657, 669-669, 793-793, 805-805
297-300: Updated test payload structure.The test payload has been correctly updated with consistent field naming and structure.
301-303: Updated identifiers structure.The identifiers structure in the test data has been updated to match the expected format.
332-332: Standardized endpoint URL.The endpoint URL has been standardized to use the consistent format for all test cases.
339-353: Updated expected response data structure.The expected response data has been updated to reflect the changes in how fields are processed and structured.
359-359: Updated trigger field in response.The trigger field in the expected response has been updated to reflect the current implementation.
395-395: Updated test description.The test description has been updated to remove V2-specific references, maintaining clarity.
775-775: Updated test case description.The test description has been updated to better reflect the test's purpose.
784-784: Updated test payload reference.The test payload reference has been updated to use the standard payload object.
test/integrations/destinations/zoho/common.ts (6)
331-331: Verify case sensitivity for identifier mappings.Here,
to: 'email'might conflict with other configs usingto: 'Email'. Zoho integrations can be case-sensitive. Please confirm that'email'is acceptable for the Zoho API.
356-356: Ensure consistent identifier field naming.Similar to line 331,
to: 'email'might be problematic if Zoho mandates'Email'with a capital “E.” Verify correctness to avoid mismatches.
381-381: Looks good.No immediate concerns with this custom module configuration.
406-406: No issues found.This config for Leads and workflow triggers appears correct.
427-427: Confirm naming of the identifier field.For consistency, please verify that
'to': 'email'(all lowercase) is valid if Zoho expects'Email'.
470-475: Export statements look correct.All newly defined configs are exported accordingly.
test/integrations/destinations/zoho/router/deletion.ts (10)
6-7: Import updates appear aligned with new connection configs.No concerns regarding these additional imports for deletion tests.
53-53: Connection matches the “Contacts” module.Using
commonConnectionConfig4is correct for a Contacts module scenario.
106-107: Duplicate scenario ID risk.This scenario reuses
id: 'zoho_deletion_1', which is also assigned elsewhere. Confirm if retaining the same ID for different modules is intentional.
116-116: Payload usage is consistent.Referencing
deletionPayload1here aligns with the new structure—no issues noted.
125-125: Adopting the new connection config is good.Switching to
commonDeletionConnectionConfiglooks consistent with the updated approach.
157-157: Consistent use ofcommonDeletionConnectionConfig.No issues; it ensures uniform deletion logic.
344-345: Scenario ID overlap.
id: 'zoho_deletion_2'might conflict with other tests using the same ID. Please verify uniqueness to avoid confusion.
428-429: Repeated ID for a different scenario.Again,
id: 'zoho_deletion_2'is declared multiple times. Confirm if these scenarios should share an ID.
509-510: Another reused scenario ID.
'zoho_deletion_1'appears repeatedly. Check if this is intentional or needs a distinct label.
548-548: Connection config update looks fine.Using
commonDeletionConnectionConfigensures consistency with the other deletion scenarios.
|
Allure Test reports for this run are available at:
|
|
Allure Test reports for this run are available at:
|
1 similar comment
|
Allure Test reports for this run are available at:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
src/cdk/v2/destinations/zoho/utils.js (4)
10-10: Imported utility from a deeply nested pathThe import path
../../../../v0/utiluses multiple parent directory references, which could make the code harder to maintain. Consider moving common utilities to a more accessible location in a future refactoring to reduce import path depth.
14-196: Consider adding JSDoc comments to utility functionsThese utility functions are critical for Zoho integration but lack proper documentation. Adding JSDoc comments would improve code maintainability and help other developers understand the purpose and expected parameters of each function.
For example:
+/** + * Deduces module information from destination configuration + * @param {Object} Config - The main configuration object + * @param {Object} destConfig - The destination-specific configuration + * @returns {Object} Object containing operation module type, upsert endpoint and identifier type + */ const deduceModuleInfoV2 = (Config, destConfig) => { // function implementation };🧰 Tools
🪛 Biome (1.9.4)
[error] 36-36: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
[error] 56-56: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
27-43: Validate response from Zoho SDKThe function relies on
ZOHO.fetchModuleWiseMandatoryFields(objectName)but doesn't validate that the SDK itself returns expected data structures. Consider adding additional error handling for SDK responses.function validatePresenceOfMandatoryPropertiesV2(objectName, object) { const { ZOHO } = ZOHO_SDK; const moduleWiseMandatoryFields = ZOHO.fetchModuleWiseMandatoryFields(objectName); + if (moduleWiseMandatoryFields === undefined || moduleWiseMandatoryFields === null) { + return { + status: true, + missingField: ['Unable to fetch mandatory fields from Zoho SDK'], + }; + } if (isEmpty(moduleWiseMandatoryFields)) { return undefined; } // Rest of function... }🧰 Tools
🪛 Biome (1.9.4)
[error] 36-36: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
65-74: Use more descriptive variable namesThe parameter
addDefaultDuplicateCheckwould be clearer asshouldAddDefaultDuplicateCheckto indicate it's a boolean flag. This makes the code more self-documenting.-const handleDuplicateCheckV2 = (addDefaultDuplicateCheck, identifierType, operationModuleType) => { +const handleDuplicateCheckV2 = (shouldAddDefaultDuplicateCheck, identifierType, operationModuleType) => { let additionalFields = []; - if (addDefaultDuplicateCheck) { + if (shouldAddDefaultDuplicateCheck) { const { ZOHO } = ZOHO_SDK; additionalFields = ZOHO.fetchModuleWiseDuplicateCheckField(operationModuleType); } return Array.from(new Set([...identifierType, ...additionalFields])); };
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 98d3d8f4543db02e1f33b4cb80195f4be7be673c and 54266a04456892412a2c2dd41b51829b02477ec9.
⛔ Files ignored due to path filters (3)
test/integrations/destinations/zoho/common.tsis excluded by!**/test/**test/integrations/destinations/zoho/router/deletion.tsis excluded by!**/test/**test/integrations/destinations/zoho/router/upsert.tsis excluded by!**/test/**
📒 Files selected for processing (5)
src/cdk/v2/destinations/zoho/config.js(0 hunks)src/cdk/v2/destinations/zoho/rtWorkflow.yaml(2 hunks)src/cdk/v2/destinations/zoho/transformRecord.js(0 hunks)src/cdk/v2/destinations/zoho/utils.js(2 hunks)src/cdk/v2/destinations/zoho/utils.test.js(0 hunks)
💤 Files with no reviewable changes (3)
- src/cdk/v2/destinations/zoho/utils.test.js
- src/cdk/v2/destinations/zoho/config.js
- src/cdk/v2/destinations/zoho/transformRecord.js
🚧 Files skipped from review as they are similar to previous changes (1)
- src/cdk/v2/destinations/zoho/rtWorkflow.yaml
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
**/*.js: Focus on ESLint errors (max 3) and warnings (max 5).
src/cdk/v2/destinations/zoho/utils.js
🧬 Code Definitions (1)
src/cdk/v2/destinations/zoho/utils.js (2)
src/cdk/v2/destinations/zoho/transformRecordV2.js (5)
require(1-5)require(6-6)require(7-16)require(18-25)require(26-26)src/util/common.js (2)
require(1-1)require(2-2)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
- GitHub Check: Code Coverage
- GitHub Check: ingestion-service-test
- GitHub Check: test_and_publish
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
src/cdk/v2/destinations/zoho/utils.js (1)
129-132: Good use of SDK for URL constructionReplacing hard-coded URL construction with the SDK's
getBaseRecordUrlmethod centralizes the URL logic and makes the code more maintainable. This change aligns well with the goal of leveraging the Zoho SDK more effectively.
|
Allure Test reports for this run are available at:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/cdk/v2/destinations/zoho/utils.js (3)
27-43: Consider improving the filter condition readability.The filter condition on line 36 checks if a field exists in the object but doesn't have a defined, non-null, non-empty value. This logic could be confusing at first glance.
Consider rewriting this for better readability:
const missingFields = moduleWiseMandatoryFields.filter( - (field) => object.hasOwnProperty(field) && !isDefinedAndNotNullAndNotEmpty(object[field]), + (field) => object.hasOwnProperty(field) && !isDefinedAndNotNullAndNotEmpty(object[field]), );A more descriptive variable name like
fieldsWithEmptyValuesmight also help clarify the purpose of this filter.🧰 Tools
🪛 Biome (1.9.4)
[error] 36-36: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
45-63: Potential issue with shallow copy of fields.On line 53, a shallow copy of the fields object is created. This could lead to unintended mutations if the fields object contains nested objects.
Consider using a deep copy for safer handling of nested objects:
- const formattedFields = { ...fields }; + const formattedFields = JSON.parse(JSON.stringify(fields));Or alternatively, if you're working in an environment that supports it:
- const formattedFields = { ...fields }; + const formattedFields = structuredClone(fields);🧰 Tools
🪛 Biome (1.9.4)
[error] 56-56: Do not access Object.prototype method 'hasOwnProperty' from target object.
It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.(lint/suspicious/noPrototypeBuiltins)
78-86: Complex recursive implementation for condition grouping.The recursive implementation for grouping conditions is more complex than necessary and might be difficult to maintain.
Consider a simpler approach:
const groupConditions = (conditions) => { if (conditions.length === 1) { return conditions[0]; // No need for grouping with a single condition } - if (conditions.length === 2) { - return `(${conditions[0]} AND ${conditions[1]})`; // Base case - } - return `(${groupConditions(conditions.slice(0, 2))} AND ${groupConditions(conditions.slice(2))})`; + return `(${conditions.join(' AND ')})`; };
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 54266a04456892412a2c2dd41b51829b02477ec9 and 42515f5.
⛔ Files ignored due to path filters (3)
test/integrations/destinations/zoho/common.tsis excluded by!**/test/**test/integrations/destinations/zoho/router/deletion.tsis excluded by!**/test/**test/integrations/destinations/zoho/router/upsert.tsis excluded by!**/test/**
📒 Files selected for processing (5)
src/cdk/v2/destinations/zoho/config.js(0 hunks)src/cdk/v2/destinations/zoho/rtWorkflow.yaml(2 hunks)src/cdk/v2/destinations/zoho/transformRecord.js(0 hunks)src/cdk/v2/destinations/zoho/utils.js(2 hunks)src/cdk/v2/destinations/zoho/utils.test.js(0 hunks)
💤 Files with no reviewable changes (3)
- src/cdk/v2/destinations/zoho/utils.test.js
- src/cdk/v2/destinations/zoho/config.js
- src/cdk/v2/destinations/zoho/transformRecord.js
🚧 Files skipped from review as they are similar to previous changes (1)
- src/cdk/v2/destinations/zoho/rtWorkflow.yaml
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: Focus on ESLint errors (max 3) and warnings (max 5).
**/*.js: Focus on ESLint errors (max 3) and warnings (max 5).
src/cdk/v2/destinations/zoho/utils.js
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
- GitHub Check: Code Coverage
- GitHub Check: ingestion-service-test
- GitHub Check: test_and_publish
- GitHub Check: UT Tests
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
src/cdk/v2/destinations/zoho/utils.js (3)
10-10: Import path changed for isHttpStatusSuccess.The import path for
isHttpStatusSuccesshas been updated to use a path from the v0 util. Since this PR is removing old Zoho logic, this change ensures the utility function is being imported from the correct location.
129-132: Improved URL construction using ZOHO_SDK.The code now uses
ZOHO_SDK.ZOHO.getBaseRecordUrlto construct the searchURL, which aligns with the goal of better utilizing the Zoho SDK and reducing reliance on hardcoded URLs or local configurations.
224-232: LGTM: Module exports are properly updated.The module exports now include all the V2 versions of the functions, aligning with the PR objective to clean up old Zoho logic after releasing vdmv2.
|
Allure Test reports for this run are available at:
|
|



What are the changes introduced in this PR?
Remove unused code from the old zoho implementation after vdmv2 release.
What is the related Linear task?
Resolves REV-1490
Please explain the objectives of your changes below
Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here
Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?
N/A
Any new dependencies introduced with this change?
N/A
Any new generic utility introduced or modified. Please explain the changes.
N/A
Any technical or performance related pointers to consider with the change?
N/A
@coderabbitai review
Developer checklist
My code follows the style guidelines of this project
No breaking changes are being introduced.
All related docs linked with the PR?
All changes manually tested?
Any documentation changes needed with this change?
Is the PR limited to 10 file changes?
Is the PR limited to one linear task?
Are relevant unit and component test-cases added in new readability format?
Reviewer checklist
Is the type of change in the PR title appropriate as per the changes?
Verified that there are no credentials or confidential data exposed with the changes.