feat: refactor consumer routes to be provider-agnostic#16
Merged
Conversation
Replace Slack-specific routes with generic consumer routes: - POST /api/connectors/slack-channel -> POST /api/connectors/consumer/channel - POST /api/connectors/slack -> POST /api/connectors/consumer - POST /api/org/integrations/slack/test -> POST /api/org/integrations/test All three routes now accept a `type` parameter. Consumer types register handlers via a consumerTypes registry in connectors.ts and integrationTesters registry in org.ts. New consumer types plug in without new routes. Replace hardcoded SECRET_KEYS list with pattern-based detection (keys containing token, secret, api_key, or password). Make ConsumerConfig generic (Record<string, ConsumerTypeConfig>) instead of having explicit slack/api properties. Update workspace.ts ownsChannel() and channel count logging to work with the generic consumer config. Closes #13 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
typeparameterSECRET_KEYSlist with pattern-based secret detectionConsumerConfiggeneric instead of having explicitslack/apipropertiesRoutes changed
POST /api/connectors/slack-channelPOST /api/connectors/consumer/channel(withtypefield)POST /api/connectors/slackPOST /api/connectors/consumer(withtype+credentialsfields)POST /api/org/integrations/slack/testPOST /api/org/integrations/test(withtype+credentialsfields)Files changed
src/routes/connectors.ts— consumer type registry, generic routessrc/routes/org.ts— generic integration test endpoint, pattern-based secret detectionsrc/shared/types.ts— genericConsumerConfigtypesrc/core/workspace.ts— generic channel ownership checkBreaking change
This changes the API contract. SDK and dashboard will need updates to use the new route paths and request shapes.
Closes #13