feat(ENG-10766): add falcon connector support#10
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces support for Falcon connector versions by implementing version-aware logic to differentiate between legacy and Falcon connectors. The system now handles different connector configurations and API endpoints based on the connector version.
- Adds Falcon connector configuration support with distinct API endpoints
- Implements version detection logic to route between legacy and Falcon connectors
- Updates account connection flow to include version information
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/shared/utils/utils.ts | Adds version detection utility to identify Falcon versions |
| src/modules/integration-picker/types.ts | Defines new Falcon connector configuration interface and adds version field |
| src/modules/integration-picker/queries.ts | Splits connector config queries into legacy and Falcon endpoints, updates account connection |
| src/modules/integration-picker/hooks/useIntegrationPicker.ts | Implements version-aware connector configuration logic and form handling |
| src/modules/integration-picker/components/IntegrationList.tsx | Updates integration display to show version info and use version-aware keys |
| src/modules/integration-picker/components/IntegrationFields.tsx | Improves error handling for provider responses |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| export const isFalconVersion = (version: string) => { | ||
| return version != null && version != '1' && version != '2'; |
There was a problem hiding this comment.
The function logic assumes any version that isn't null, '1', or '2' is a Falcon version. This could incorrectly classify unexpected version values. Consider explicitly checking for known Falcon version patterns or adding validation for expected version formats.
| export const isFalconVersion = (version: string) => { | |
| return version != null && version != '1' && version != '2'; | |
| // Falcon versions are expected to match the pattern 'falcon-x' or 'falcon-x.y', where x and y are numbers | |
| if (typeof version !== 'string') return false; | |
| const falconVersionPattern = /^falcon-\d+(\.\d+)?$/; | |
| return falconVersionPattern.test(version); |
| return { fields }; | ||
| } | ||
|
|
||
| if ('configFields' in connectorData.config) { |
There was a problem hiding this comment.
Using property existence checks to determine config type is fragile. Consider using a discriminated union with a type field or explicit type guards to make the type distinction more reliable and maintainable.
| if ('authentication' in connectorData.config) { | ||
| return connectorData.config.authentication?.[ | ||
| selectedIntegration.authentication_config_key | ||
| ]?.[selectedIntegration.environment]; | ||
| } | ||
| return connectorData.config; |
There was a problem hiding this comment.
Similar to the previous issue, using property existence checks makes the code fragile. The fallback return connectorData.config could return incompatible types. Use proper type guards or discriminated unions to ensure type safety.
| if ('authentication' in connectorData.config) { | |
| return connectorData.config.authentication?.[ | |
| selectedIntegration.authentication_config_key | |
| ]?.[selectedIntegration.environment]; | |
| } | |
| return connectorData.config; | |
| if (hasAuthenticationConfig(connectorData.config)) { | |
| return connectorData.config.authentication?.[ | |
| selectedIntegration.authentication_config_key | |
| ]?.[selectedIntegration.environment]; | |
| } | |
| // Optionally, handle the fallback more safely or return null | |
| return null; |
Summary by cubic
Adds native Falcon connector support with versioned providers (provider@version) and the new configFields schema. Users can pick and connect specific connector versions; configs are fetched from Falcon or legacy endpoints as needed (ENG-10766).
New Features
Bug Fixes