fix: move getConnectorTelemetryMeta from components/ to lib#1426
Conversation
…ependency inversion lib/posthog/events.ts was importing from components/assistant-ui/..., creating an inverted dependency layer (lib → components). Move ConnectorTelemetryMeta type, CONNECTOR_TELEMETRY_REGISTRY, getConnectorTelemetryMeta, and getReauthEndpoint into the new lib/connector-telemetry.ts module so that lib/ no longer depends upward into the UI tree. connector-constants.ts now re-exports from the new module for backward compatibility. Fixes MODSetter#1375
|
@guangyang1206 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ependency inversion
lib/posthog/events.ts was importing from components/assistant-ui/..., creating an inverted dependency layer (lib → components).
Move ConnectorTelemetryMeta type, CONNECTOR_TELEMETRY_REGISTRY, getConnectorTelemetryMeta, and getReauthEndpoint into the new lib/connector-telemetry.ts module so that lib/ no longer depends upward into the UI tree.
connector-constants.ts now re-exports from the new module for backward compatibility.
Fixes #1375
Description
Moves
getConnectorTelemetryMetaand related types (ConnectorTelemetryMeta,ConnectorTelemetryGroup,CONNECTOR_TELEMETRY_REGISTRY) andgetReauthEndpointfromcomponents/assistant-ui/connector-popup/constants/connector-constants.tsto the new filelib/connector-telemetry.ts.lib/posthog/events.tsnow imports from@/lib/connector-telemetryinstead of@/components/.../connector-constants, eliminating the inverted dependency fromlib/→components/.connector-constants.tsre-exports these symbols from@/lib/connector-telemetryto preserve backward compatibility for existing importers.Why
lib/posthog/events.tsis an analytics module that should sit below the UI layer in the dependency graph. However, it was statically importing functions fromcomponents/, causing:events.tsBy moving telemetry-related logic into
lib/, the dependency direction becomescomponents/→lib/, which aligns with the project's architecture expectations.Changes
surfsense_web/lib/connector-telemetry.ts(new file): hostsConnectorTelemetryMetatype,CONNECTOR_TELEMETRY_REGISTRY,getConnectorTelemetryMeta,getReauthEndpointsurfsense_web/lib/posthog/events.ts: import path changed to@/lib/connector-telemetrysurfsense_web/components/assistant-ui/connector-popup/constants/connector-constants.ts: removed migrated content, now re-exports from@/lib/connector-telemetryTesting
ConnectorTelemetryMetatype and function signatures unchanged)events.tsbehavior withgetConnectorTelemetryMetais identical after the moveconnector-constants.tsare unaffected due to re-exportsRelated
Fixes #1375