Add Google Analytics, Dotfile, Segment and Square access-review connectors

Two OAuth2 and two API-key connectors:

- Google Analytics (GA4): OAuth2 with both analytics.readonly and
  analytics.manage.users.readonly (readonly alone 403s on the accounts
  list); v1alpha accessBindings enumerated at account and property level
  and merged by email; manual account picker (Pattern 1) with a
  per-connection probe and name resolver; distinct from Google Workspace.
- Dotfile: API key in the X-DOTFILE-API-KEY header (Pattern 3); GET
  /v1/users (owner/admin, suspended_at) with a static probe.
- Segment (Twilio): Public API token as Bearer with a required Region
  setting (US or EU) mapped to the regional host; GET /users plus per-user
  GET /users/{id} for roles and /invites for pending members; per-connection
  BuildProbeURL.
- Square: OAuth2 (EMPLOYEES_READ) or a personal access token (Pattern 3);
  POST /v2/team-members/search returns email/status/is_owner directly, so no
  role resolution; custom probe and name resolver.

Google Analytics and Square are confidential OAuth clients, wired into the
bootstrap OAuth provider list and .env.example. Segment carries a required
extra setting, so the console add-source dialog maps region onto its
segmentRegion API-key input; without that mapping the value is silently
dropped and the create is rejected.

Cassette-backed driver tests plus unit tests for the Segment probe URL and
the bootstrap OAuth provider list.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-07-11 23:15:03 +02:00
parent 724c169876
commit 60628645ae
31 changed files with 2124 additions and 28 deletions

View File

@@ -60,32 +60,36 @@ const (
ConnectorProviderClickUp ConnectorProvider = "CLICKUP"
// ConnectorProviderClerk is disabled (unregistered) but kept in IsValid
// and the GraphQL enum so existing stored CLERK rows still validate.
ConnectorProviderClerk ConnectorProvider = "CLERK"
ConnectorProviderVercel ConnectorProvider = "VERCEL"
ConnectorProviderMonday ConnectorProvider = "MONDAY"
ConnectorProviderMetabase ConnectorProvider = "METABASE"
ConnectorProviderTailscale ConnectorProvider = "TAILSCALE"
ConnectorProviderAnthropic ConnectorProvider = "ANTHROPIC"
ConnectorProviderCursor ConnectorProvider = "CURSOR"
ConnectorProviderDatadog ConnectorProvider = "DATADOG"
ConnectorProviderOkta ConnectorProvider = "OKTA"
ConnectorProviderZendesk ConnectorProvider = "ZENDESK"
ConnectorProviderQovery ConnectorProvider = "QOVERY"
ConnectorProviderRender ConnectorProvider = "RENDER"
ConnectorProviderNeon ConnectorProvider = "NEON"
ConnectorProviderMercury ConnectorProvider = "MERCURY"
ConnectorProviderApollo ConnectorProvider = "APOLLO"
ConnectorProviderDeepgram ConnectorProvider = "DEEPGRAM"
ConnectorProviderClickHouse ConnectorProvider = "CLICKHOUSE"
ConnectorProviderLangfuse ConnectorProvider = "LANGFUSE"
ConnectorProviderPylon ConnectorProvider = "PYLON"
ConnectorProviderOpenRouter ConnectorProvider = "OPENROUTER"
ConnectorProviderIncidentIO ConnectorProvider = "INCIDENT_IO"
ConnectorProviderBrevo ConnectorProvider = "BREVO"
ConnectorProviderScaleway ConnectorProvider = "SCALEWAY"
ConnectorProviderYousign ConnectorProvider = "YOUSIGN"
ConnectorProviderRailway ConnectorProvider = "RAILWAY"
ConnectorProviderCrisp ConnectorProvider = "CRISP"
ConnectorProviderClerk ConnectorProvider = "CLERK"
ConnectorProviderVercel ConnectorProvider = "VERCEL"
ConnectorProviderMonday ConnectorProvider = "MONDAY"
ConnectorProviderMetabase ConnectorProvider = "METABASE"
ConnectorProviderTailscale ConnectorProvider = "TAILSCALE"
ConnectorProviderAnthropic ConnectorProvider = "ANTHROPIC"
ConnectorProviderCursor ConnectorProvider = "CURSOR"
ConnectorProviderDatadog ConnectorProvider = "DATADOG"
ConnectorProviderOkta ConnectorProvider = "OKTA"
ConnectorProviderZendesk ConnectorProvider = "ZENDESK"
ConnectorProviderQovery ConnectorProvider = "QOVERY"
ConnectorProviderRender ConnectorProvider = "RENDER"
ConnectorProviderNeon ConnectorProvider = "NEON"
ConnectorProviderMercury ConnectorProvider = "MERCURY"
ConnectorProviderApollo ConnectorProvider = "APOLLO"
ConnectorProviderDeepgram ConnectorProvider = "DEEPGRAM"
ConnectorProviderClickHouse ConnectorProvider = "CLICKHOUSE"
ConnectorProviderLangfuse ConnectorProvider = "LANGFUSE"
ConnectorProviderPylon ConnectorProvider = "PYLON"
ConnectorProviderOpenRouter ConnectorProvider = "OPENROUTER"
ConnectorProviderIncidentIO ConnectorProvider = "INCIDENT_IO"
ConnectorProviderBrevo ConnectorProvider = "BREVO"
ConnectorProviderScaleway ConnectorProvider = "SCALEWAY"
ConnectorProviderYousign ConnectorProvider = "YOUSIGN"
ConnectorProviderRailway ConnectorProvider = "RAILWAY"
ConnectorProviderCrisp ConnectorProvider = "CRISP"
ConnectorProviderDotfile ConnectorProvider = "DOTFILE"
ConnectorProviderSegment ConnectorProvider = "SEGMENT"
ConnectorProviderSquare ConnectorProvider = "SQUARE"
ConnectorProviderGoogleAnalytics ConnectorProvider = "GOOGLE_ANALYTICS"
)
var (
@@ -150,6 +154,10 @@ func ConnectorProviders() []ConnectorProvider {
ConnectorProviderYousign,
ConnectorProviderRailway,
ConnectorProviderCrisp,
ConnectorProviderDotfile,
ConnectorProviderSegment,
ConnectorProviderSquare,
ConnectorProviderGoogleAnalytics,
}
}
@@ -210,7 +218,11 @@ func (v ConnectorProvider) IsValid() bool {
ConnectorProviderScaleway,
ConnectorProviderYousign,
ConnectorProviderRailway,
ConnectorProviderCrisp:
ConnectorProviderCrisp,
ConnectorProviderDotfile,
ConnectorProviderSegment,
ConnectorProviderSquare,
ConnectorProviderGoogleAnalytics:
return true
}

View File

@@ -194,6 +194,25 @@ type (
CrispConnectorSettings struct {
WebsiteID string `json:"website_id"`
}
// SegmentConnectorSettings stores the Twilio Segment Public API base URL.
// A Public API token is bound to one workspace, but the workspace's region
// is not discoverable from the token and selects the API host
// (api.segmentapis.com for US, eu1.api.segmentapis.com for EU). The region
// the customer picks is resolved to this base URL up front, so the driver
// and probe read a single host with no region logic.
SegmentConnectorSettings struct {
BaseURL string `json:"base_url"`
}
// GoogleAnalyticsConnectorSettings stores the selected GA4 account ID
// (the numeric portion of the `accounts/{account}` resource name). A
// Google OAuth token can reach many GA4 accounts, so the reviewed account
// is picked after authorization; the driver then lists the account's
// access bindings plus the bindings of every property beneath it.
GoogleAnalyticsConnectorSettings struct {
AccountID string `json:"account_id"`
}
)
// GrantType returns the OAuth2 grant type recorded on the connector's

View File

@@ -0,0 +1,18 @@
-- Copyright (c) 2026 Probo Inc <hello@probo.com>.
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
ALTER TYPE connector_provider ADD VALUE IF NOT EXISTS 'DOTFILE';
ALTER TYPE connector_provider ADD VALUE IF NOT EXISTS 'SEGMENT';
ALTER TYPE connector_provider ADD VALUE IF NOT EXISTS 'SQUARE';
ALTER TYPE connector_provider ADD VALUE IF NOT EXISTS 'GOOGLE_ANALYTICS';