Refine connector provider registry per review

Three follow-ups from review of the registry consolidation:

- Build Vercel's authorization URL with net/url instead of a
  hand-rolled "{integration_slug}" placeholder resolved by
  strings.ReplaceAll. The slug is escaped via url.PathEscape in a
  per-provider Registration.BuildAuthURL closure, and the unused
  AuthURLParams plumbing on Registration and OAuth2Connector is
  removed (OAuth2Connector now carries a typed IntegrationSlug).

- Drop the SettingsInput union type and the per-provider
  MarshalSettings closures. The create resolvers now build the typed
  coredata.*ConnectorSettings directly from the gqlgen input, the
  same way the OAuth callback path already does, so there is no
  shared catch-all DTO and no stringly-typed boundary.

- Restore ConnectorProviders() to a plain ordered slice literal; the
  intermediate map + slices.Sort added nondeterminism and a sort for
  no benefit.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-05-26 15:15:43 +02:00
parent e18ecdda8b
commit a5259fc978
16 changed files with 220 additions and 226 deletions

View File

@@ -12,7 +12,6 @@ import (
"go.gearno.de/kit/log"
"go.probo.inc/probo/pkg/connector"
"go.probo.inc/probo/pkg/connector/provider"
"go.probo.inc/probo/pkg/coredata"
"go.probo.inc/probo/pkg/probo"
"go.probo.inc/probo/pkg/server/api/console/v1/schema"
@@ -44,21 +43,12 @@ func (r *mutationResolver) CreateAPIKeyConnector(ctx context.Context, input type
Connection: &connector.APIKeyConnection{APIKey: input.APIKey},
}
in := &provider.SettingsInput{
TallyOrganizationID: input.TallyOrganizationID,
SentryOrganizationSlug: input.SentryOrganizationSlug,
SupabaseOrganizationSlug: input.SupabaseOrganizationSlug,
GitHubOrganization: input.GithubOrganization,
OnePasswordSCIMBridgeURL: input.OnePasswordScimBridgeURL,
raw, err := apiKeyConnectorSettings(input)
if err != nil {
return nil, gqlutils.Invalid(ctx, err)
}
if reg, ok := r.providerRegistry.Get(input.Provider); ok && reg.MarshalSettings != nil {
raw, err := reg.MarshalSettings(in)
if err != nil {
return nil, gqlutils.Invalid(ctx, err)
}
req.RawSettings = raw
}
req.RawSettings = raw
cnnctr, err := r.probo.Connectors.Create(ctx, scope, req)
if err != nil {
@@ -101,18 +91,12 @@ func (r *mutationResolver) CreateClientCredentialsConnector(ctx context.Context,
Connection: oauth2Conn,
}
in := &provider.SettingsInput{
OnePasswordAccountID: input.OnePasswordAccountID,
OnePasswordRegion: input.OnePasswordRegion,
raw, err := clientCredentialsConnectorSettings(input)
if err != nil {
return nil, gqlutils.Invalid(ctx, err)
}
if reg, ok := r.providerRegistry.Get(input.Provider); ok && reg.MarshalSettings != nil {
raw, err := reg.MarshalSettings(in)
if err != nil {
return nil, gqlutils.Invalid(ctx, err)
}
req.RawSettings = raw
}
req.RawSettings = raw
cnnctr, err := r.probo.Connectors.Create(ctx, scope, req)
if err != nil {