Documentation
¶
Overview ¶
Package connector defines the public, versioned boundary for project-owned Connector providers. It owns its DTOs and does not expose Runtime internal application, persistence, secret-store, worker, or transport types.
Index ¶
- Constants
- Variables
- func ApplyConfigDefaults(fields []ConfigField, config map[string]any) (map[string]any, error)
- func Call[I any, O any](ctx context.Context, gateway Gateway, operation CallOperation[I, O], input I) (O, error)
- func CallWithContent[I any, O any](ctx context.Context, gateway Gateway, operation CallOperation[I, O], input I, ...) (O, error)
- func ComputedContractSHA256() string
- func NewProviderError(classification ErrorClassification, code string, cause error) error
- func PermanentError(code string, cause error) error
- func ProviderErrorCodeOf(err error) (string, bool)
- func ProviderIdentity(connectorKey, providerKey string) string
- func ResolveOAuthConnectionTestScopes(adapter Adapter) ([][]string, bool)
- func ResolveOAuthOperationScopes(adapter Adapter, operationKey string) ([][]string, bool)
- func RetryableError(code string, cause error) error
- func UncertainError(code string, cause error) error
- func ValidSHA256(value string) bool
- type Adapter
- type BackgroundCapabilityProvider
- type BackgroundCleanupCapabilityProvider
- type BackgroundCleanupProcessor
- type BackgroundCommit
- type BackgroundEvent
- type BackgroundObservation
- type BackgroundProcessor
- type BackgroundProgress
- type BackgroundRequest
- type BackgroundResult
- type BackgroundTaskDescriptor
- type BoundOperation
- func BindCall[I any, O any](operation CallOperation[I, O], handler CallHandler[I, O]) (BoundOperation, error)
- func BindEnqueueDelivery[I any](operation EnqueueOperation[I], handler DeliveryHandler[I]) (BoundOperation, error)
- func BindStartOperationDelivery[I any](operation StartOperation[I], handler DeliveryHandler[I]) (BoundOperation, error)
- type CallHandler
- type CallOperation
- type CallRequest
- type CallResult
- type CompensationContract
- type CompensationMode
- type ConfigField
- type ConfigFieldType
- type ConfigValidation
- type ConfigValidator
- type Connection
- type ConnectionTester
- type ConnectorDefinition
- type DefinitionCatalog
- type DeliveryHandler
- type DeliveryResult
- type EnqueueOperation
- type ErrorClassification
- type FieldLocalization
- type FilesystemOperation
- type FilesystemRequest
- type FilesystemResult
- type FilesystemTransport
- type Gateway
- type HTTPRequest
- type HTTPResponse
- type IdempotencyContract
- type IdempotencyStrategy
- type Identity
- type MQTTRequest
- type MQTTResult
- type MQTTTransport
- type OAuthAuthorizationCapabilityProvider
- type OAuthAuthorizationRequest
- type OAuthAuthorizer
- type OAuthCodeExchangeRequest
- type OAuthConnectionTestScopeProvider
- type OAuthOperationScopeProvider
- type OAuthTokens
- type OperationDescriptor
- type OperationEffect
- type OperationMode
- type Principal
- type ProcessRequest
- type ProcessSession
- type ProcessTransport
- type ProviderDescriptor
- type ProviderError
- func (e *ProviderError) ApplicationErrorKind() string
- func (e *ProviderError) Classification() ErrorClassification
- func (e *ProviderError) Code() string
- func (e *ProviderError) Error() string
- func (e *ProviderError) ErrorCode() string
- func (*ProviderError) ErrorParams() map[string]string
- func (e *ProviderError) Unwrap() error
- type ProviderSchema
- type ProviderSet
- type ProviderSetFactory
- type ReconcileRequest
- type ReconcileResult
- type Reconciler
- type ReconciliationMode
- type ReconciliationOutcome
- type Registry
- func (r *Registry) Descriptors() []ProviderDescriptor
- func (r *Registry) Freeze()
- func (r *Registry) Frozen() bool
- func (r *Registry) Provider(connectorKey, providerKey string) (Adapter, bool)
- func (r *Registry) Providers() []Adapter
- func (r *Registry) Register(provider Adapter) error
- func (r *Registry) RegisterProviderSet(set ProviderSet) error
- type ReliabilityContract
- type ResourceHealthReport
- type SMTPRequest
- type SMTPResult
- type SMTPTransport
- type SQLOperation
- type SQLRequest
- type SQLResult
- type SecretCredentialKind
- type SecretExpiryPolicy
- type SecretField
- type SecretMaterialFormat
- type SecretRotationPolicy
- type SecretTestRequirement
- type StartOperation
- type StartupActivationPolicy
- type TestConnectionRequest
- type TestConnectionResult
- type Transport
- type TypedRequest
- type TypedResult
- type VerifiedWebhook
- type VerifyWebhookRequest
- type WebSocketMessage
- type WebSocketMessageType
- type WebSocketRequest
- type WebSocketSession
- type WebSocketTransport
- type WebhookDeliveryReceipt
- type WebhookExternalIdentity
- type WebhookSecurityEvidence
- type WebhookVerifier
Constants ¶
const ContractSHA256 = "88741d653e4d03182735ee5e1d6ae0ab0b0d718a630d4a9eadf4d9c63a702ddf"
const ContractVersion = "connector-contract-v22"
const ErrorContractInvalidCode = "connector.error_contract_invalid"
const SDKVersion = "v0.1.0-dev.22"
SDKVersion identifies the release line of this module independently from the compatibility identity of its public Connector contract.
Variables ¶
Functions ¶
func ApplyConfigDefaults ¶
ApplyConfigDefaults materializes schema-owned, non-secret defaults without replacing any value already supplied by a manifest, tenant, or administrator. Decoding on every call also gives mutable JSON defaults an independent value.
func CallWithContent ¶ added in v0.1.9
func CallWithContent[I any, O any](ctx context.Context, gateway Gateway, operation CallOperation[I, O], input I, content io.Reader, contentLength int64, contentSHA256, contentType string) (O, error)
CallWithContent sends one non-replayable content stream alongside bounded JSON metadata. The caller owns the reader and exact identity declaration; the provider transport verifies both byte count and SHA-256 while sending.
func ComputedContractSHA256 ¶
func ComputedContractSHA256() string
func NewProviderError ¶
func NewProviderError(classification ErrorClassification, code string, cause error) error
NewProviderError creates a classified provider failure. Invalid class/code input is converted to a permanent contract error rather than guessed or allowed to become retryable.
func PermanentError ¶
func ProviderErrorCodeOf ¶
func ProviderIdentity ¶
func ResolveOAuthConnectionTestScopes ¶ added in v0.1.1
func ResolveOAuthOperationScopes ¶ added in v0.1.1
func RetryableError ¶
func UncertainError ¶
func ValidSHA256 ¶ added in v0.1.9
ValidSHA256 reports whether value is a normalized lowercase SHA-256 digest.
Types ¶
type Adapter ¶
type Adapter interface {
Descriptor() ProviderDescriptor
Call(context.Context, CallRequest) (CallResult, error)
}
Adapter is the single Integration-facing project Connector boundary. One Adapter may own many differently typed operations for one exact provider.
func NewProvider ¶
func NewProvider(schema ProviderSchema, operations ...BoundOperation) (Adapter, error)
type BackgroundCapabilityProvider ¶
type BackgroundCapabilityProvider interface {
BackgroundProcessor() (BackgroundProcessor, bool)
}
BackgroundCapabilityProvider is implemented by Registry snapshots. The boolean is false when the concrete Provider has no background capability.
type BackgroundCleanupCapabilityProvider ¶
type BackgroundCleanupCapabilityProvider interface {
BackgroundCleanupProcessor() (BackgroundCleanupProcessor, bool)
}
type BackgroundCleanupProcessor ¶
type BackgroundCleanupProcessor interface {
CleanupBackground(context.Context, Connection, map[string]string, time.Time, Principal) (map[string]string, error)
}
BackgroundCleanupProcessor lets a provider tear down remote resources before Integration deletes a connection. Integration still resolves and persists secrets.
type BackgroundCommit ¶
type BackgroundCommit struct {
OperationKey string `json:"operation_key"`
ContractSHA256 string `json:"contract_sha256"`
Payload json.RawMessage `json:"payload"`
}
BackgroundCommit is a provider operation that Integration executes only after the state transition and events are durably committed. It is used for acknowledgements and other post-commit provider effects.
func (BackgroundCommit) Validate ¶
func (c BackgroundCommit) Validate() error
type BackgroundEvent ¶
type BackgroundEvent struct {
ExternalID string `json:"external_id"`
EventType string `json:"event_type"`
Payload json.RawMessage `json:"payload"`
}
BackgroundEvent is provider-normalized input that Integration must durably accept before executing any returned Commit operation.
func (BackgroundEvent) Validate ¶
func (e BackgroundEvent) Validate() error
type BackgroundObservation ¶ added in v0.1.5
BackgroundObservation is a source-owned, aggregate-safe fact produced by a successful task transition. Integration decides which exact observation keys it persists and never exposes task state or provider payload through the monitoring surface.
func (BackgroundObservation) Validate ¶ added in v0.1.5
func (o BackgroundObservation) Validate() error
type BackgroundProcessor ¶
type BackgroundProcessor interface {
BackgroundTasks(Connection) []BackgroundTaskDescriptor
ProcessBackground(context.Context, BackgroundRequest) (BackgroundResult, error)
}
BackgroundProcessor is optional provider behavior. Implementations perform provider I/O only through the Transport supplied to their constructor.
type BackgroundProgress ¶ added in v0.1.8
type BackgroundProgress struct {
Phase string `json:"phase"`
Unit string `json:"unit,omitempty"`
CompletedUnits int64 `json:"completed_units"`
TotalUnits *int64 `json:"total_units,omitempty"`
InitializationComplete bool `json:"initialization_complete"`
}
BackgroundProgress is the provider-owned, user-safe progress snapshot for a durable task. Integration persists this value separately from opaque State and may expose it to an authorized connection owner. Phase and Unit are canonical identifiers; products remain responsible for localized labels. CompletedUnits describes the initialization milestone and must not decrease.
func (BackgroundProgress) Validate ¶ added in v0.1.8
func (p BackgroundProgress) Validate() error
type BackgroundRequest ¶
type BackgroundRequest struct {
TaskKey string `json:"task_key"`
StateVersion int `json:"state_version"`
Connection Connection `json:"connection"`
State json.RawMessage `json:"state,omitempty"`
RelatedStates map[string]json.RawMessage `json:"related_states,omitempty"`
Secrets map[string]string `json:"secrets,omitempty"`
Now time.Time `json:"now"`
Principal Principal `json:"principal"`
}
BackgroundRequest is a single fenced transition request. State is opaque to Integration and must contain exactly one JSON value when non-empty.
func (BackgroundRequest) Validate ¶
func (r BackgroundRequest) Validate() error
type BackgroundResult ¶
type BackgroundResult struct {
State json.RawMessage `json:"state"`
NextDueAt time.Time `json:"next_due_at,omitempty"`
Progress *BackgroundProgress `json:"progress,omitempty"`
Events []BackgroundEvent `json:"events,omitempty"`
Commit []BackgroundCommit `json:"commit,omitempty"`
Observations []BackgroundObservation `json:"observations,omitempty"`
WakeTasks []string `json:"wake_tasks,omitempty"`
SecretUpdates map[string]string `json:"secret_updates,omitempty"`
}
func (BackgroundResult) Validate ¶
func (r BackgroundResult) Validate() error
type BackgroundTaskDescriptor ¶
type BackgroundTaskDescriptor struct {
Key string `json:"key"`
StateVersion int `json:"state_version"`
}
BackgroundTaskDescriptor declares one provider-owned durable task. Integration owns scheduling, leases, persistence, secrets, transports, and audit; the provider owns the state payload and transition semantics.
func (BackgroundTaskDescriptor) Validate ¶
func (d BackgroundTaskDescriptor) Validate() error
type BoundOperation ¶
type BoundOperation struct {
// contains filtered or unexported fields
}
func BindCall ¶
func BindCall[I any, O any](operation CallOperation[I, O], handler CallHandler[I, O]) (BoundOperation, error)
BindCall performs the only type erasure for a synchronous operation.
func BindEnqueueDelivery ¶
func BindEnqueueDelivery[I any](operation EnqueueOperation[I], handler DeliveryHandler[I]) (BoundOperation, error)
BindEnqueueDelivery erases the worker-side delivery handler for an enqueue operation. It does not provide a second Action-side execution channel.
func BindStartOperationDelivery ¶
func BindStartOperationDelivery[I any](operation StartOperation[I], handler DeliveryHandler[I]) (BoundOperation, error)
BindStartOperationDelivery erases the worker-side delivery handler that starts a long-running external operation after the local UoW commits.
func (BoundOperation) Descriptor ¶
func (b BoundOperation) Descriptor() OperationDescriptor
type CallHandler ¶
type CallHandler[I any, O any] func(context.Context, TypedRequest[I]) (TypedResult[O], error)
type CallOperation ¶
type CallOperation[I any, O any] struct { ConnectorKey string ProviderKey string Key string ContractSHA256 string Reliability ReliabilityContract }
CallOperation is a synchronous operation whose typed output is required by the caller before it can continue.
func (CallOperation[I, O]) Descriptor ¶
func (o CallOperation[I, O]) Descriptor() OperationDescriptor
type CallRequest ¶
type CallRequest struct {
ConnectorKey string `json:"connector_key"`
ProviderKey string `json:"provider_key"`
OperationKey string `json:"operation_key"`
ContractSHA256 string `json:"contract_sha256"`
Mode OperationMode `json:"mode"`
Connection Connection `json:"connection"`
Payload json.RawMessage `json:"payload"`
RequestRef string `json:"request_ref,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Secrets map[string]string `json:"secrets,omitempty"`
Delivery bool `json:"delivery,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
Principal Principal `json:"principal"`
// Content is an in-process, single-consumer stream for operations whose
// payload is too large for the JSON envelope. Gateways must preserve the
// reader unchanged and must never persist or retry it implicitly.
Content io.Reader `json:"-"`
ContentLength int64 `json:"-"`
ContentSHA256 string `json:"-"`
ContentType string `json:"-"`
}
CallRequest is the type-erased Integration-to-provider envelope. Payload is decoded by a BoundOperation before project provider code is invoked. Secrets contains Integration-resolved material only for fields declared by the selected Provider descriptor; Adapters must not resolve references.
type CallResult ¶
type CallResult struct {
Payload json.RawMessage `json:"payload,omitempty"`
ResponseRef string `json:"response_ref,omitempty"`
SecretUpdates map[string]string `json:"secret_updates,omitempty"`
ResourceHealth *ResourceHealthReport `json:"resource_health,omitempty"`
}
type CompensationContract ¶
type CompensationContract struct {
Mode CompensationMode `json:"mode"`
OperationKey string `json:"operation_key,omitempty"`
}
type CompensationMode ¶
type CompensationMode string
const ( CompensationNone CompensationMode = "none" CompensationExplicit CompensationMode = "explicit" CompensationSaga CompensationMode = "saga" )
type ConfigField ¶
type ConfigField struct {
Key string `json:"key"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Type ConfigFieldType `json:"type"`
I18n map[string]FieldLocalization `json:"i18n,omitempty"`
Required bool `json:"required"`
Default json.RawMessage `json:"default,omitempty"`
Validation ConfigValidation `json:"validation,omitempty"`
RequiredWith []string `json:"required_with,omitempty"`
}
type ConfigFieldType ¶
type ConfigFieldType string
const ( ConfigFieldText ConfigFieldType = "text" ConfigFieldEmail ConfigFieldType = "email" ConfigFieldInteger ConfigFieldType = "integer" ConfigFieldDecimal ConfigFieldType = "decimal" ConfigFieldBoolean ConfigFieldType = "boolean" ConfigFieldSelect ConfigFieldType = "select" ConfigFieldJSON ConfigFieldType = "json" )
type ConfigValidation ¶
type ConfigValidator ¶
type ConfigValidator interface {
ValidateConfig(Connection) error
}
ConfigValidator is optional. Integration supplies the normalized connection and retains ownership of persistence and secret resolution; providers may only validate provider-specific configuration semantics.
type Connection ¶
type Connection struct {
Key string `json:"key"`
WorkspaceID string `json:"workspace_id,omitempty"`
ConnectorKey string `json:"connector_key"`
ProviderKey string `json:"provider_key"`
Name string `json:"name,omitempty"`
Status string `json:"status,omitempty"`
Config map[string]any `json:"config,omitempty"`
SecretRefs map[string]string `json:"secret_refs,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
Connection contains only SecretRefs declared by the selected Provider descriptor. Integration retains reference resolution and persistence ownership.
type ConnectionTester ¶
type ConnectionTester interface {
TestConnection(context.Context, TestConnectionRequest) (TestConnectionResult, error)
}
ConnectionTester is optional. Integration discovers it by type assertion and fails closed when a provider does not publish connection testing support.
type ConnectorDefinition ¶ added in v0.1.3
type ConnectorDefinition struct {
Key string
Name string
Payload json.RawMessage
}
ConnectorDefinition is one source-owned Connector product definition. Implementations may load it from embedded files, a signed release bundle or another deployment-owned source; consumers depend only on this SDK shape.
type DefinitionCatalog ¶ added in v0.1.3
type DefinitionCatalog func() ([]ConnectorDefinition, error)
DefinitionCatalog loads a detached Connector definition snapshot. Concrete catalog ownership stays at an outer composition root.
type DeliveryHandler ¶
type DeliveryHandler[I any] func(context.Context, TypedRequest[I]) (DeliveryResult, error)
type DeliveryResult ¶
type DeliveryResult struct {
ResponseRef string
SecretUpdates map[string]string
ResourceHealth *ResourceHealthReport
}
type EnqueueOperation ¶
type EnqueueOperation[I any] struct { ConnectorKey string ProviderKey string Key string ContractSHA256 string Reliability ReliabilityContract }
EnqueueOperation is an asynchronous command. Its provider result is delivery metadata only; no typed output is returned to the Action Handler.
func (EnqueueOperation[I]) Descriptor ¶
func (o EnqueueOperation[I]) Descriptor() OperationDescriptor
type ErrorClassification ¶
type ErrorClassification string
ErrorClassification is the closed recovery decision reported by provider code. Runtime still applies the operation's idempotency and retry policy; a retryable classification alone never authorizes a retry.
const ( ErrorRetryable ErrorClassification = "retryable" ErrorPermanent ErrorClassification = "permanent" ErrorUncertain ErrorClassification = "uncertain" )
func ErrorClassificationOf ¶
func ErrorClassificationOf(err error) (ErrorClassification, bool)
type FieldLocalization ¶
type FilesystemOperation ¶
type FilesystemOperation string
const ( FilesystemOperationProbe FilesystemOperation = "probe" FilesystemOperationRead FilesystemOperation = "read" FilesystemOperationWrite FilesystemOperation = "write" FilesystemOperationDelete FilesystemOperation = "delete" )
type FilesystemRequest ¶
type FilesystemRequest struct {
Root string `json:"root"`
Path string `json:"path,omitempty"`
Operation FilesystemOperation `json:"operation"`
Content []byte `json:"content,omitempty"`
MaxReadBytes int64 `json:"max_read_bytes,omitempty"`
}
type FilesystemResult ¶
type FilesystemTransport ¶
type FilesystemTransport interface {
ExecuteFilesystem(context.Context, FilesystemRequest) (FilesystemResult, error)
}
FilesystemTransport is an optional host-owned capability for Providers that operate on a configured local filesystem. The host owns root and path validation, permissions, bounded reads, durable staged writes, and deletion.
type Gateway ¶
type Gateway interface {
Call(context.Context, CallRequest) (CallResult, error)
}
Gateway is implemented by the Integration execution boundary. Generated clients may call it only through the typed helpers in this package.
type HTTPRequest ¶
type HTTPRequest struct {
Method string `json:"method"`
URL string `json:"url"`
Headers map[string][]string `json:"headers,omitempty"`
// SecretHeaders contains resolved secret-bearing header values that Integration
// injects immediately before dispatch. Keys must not occur in Headers.
SecretHeaders map[string][]string `json:"-"`
// SecretQuery is resolved secret material that Integration injects immediately
// before dispatch. It is deliberately excluded from serialization.
SecretQuery map[string]string `json:"-"`
// SecretForm contains resolved form fields that Integration injects into an
// application/x-www-form-urlencoded body immediately before dispatch.
// Keys must not occur in the public Body.
SecretForm map[string]string `json:"-"`
// SecretJSON contains resolved string fields that Integration injects into a
// top-level application/json object immediately before dispatch. Keys must
// not occur in the public Body.
SecretJSON map[string]string `json:"-"`
Body []byte `json:"body,omitempty"`
Content io.Reader `json:"-"`
ContentLength int64 `json:"-"`
ContentSHA256 string `json:"-"`
MaxResponseBytes int64 `json:"max_response_bytes,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
}
type HTTPResponse ¶
type IdempotencyContract ¶
type IdempotencyContract struct {
Strategy IdempotencyStrategy `json:"strategy"`
KeyRetentionSeconds int `json:"key_retention_seconds,omitempty"`
}
type IdempotencyStrategy ¶
type IdempotencyStrategy string
const ( IdempotencyNone IdempotencyStrategy = "none" IdempotencyNatural IdempotencyStrategy = "natural" IdempotencyProviderKey IdempotencyStrategy = "provider_key" )
type Identity ¶
type Identity struct {
SDKVersion string `json:"sdk_version"`
ContractVersion string `json:"contract_version"`
ContractSHA256 string `json:"contract_sha256"`
}
Identity is recorded by hosts and generated projects so semantic SDK releases cannot accidentally hide a public contract change.
func CurrentIdentity ¶
func CurrentIdentity() Identity
CurrentIdentity returns the immutable identity of this SDK build.
type MQTTRequest ¶
type MQTTRequest struct {
BrokerURL string `json:"broker_url"`
ClientID string `json:"client_id,omitempty"`
Topic string `json:"topic,omitempty"`
Payload []byte `json:"payload,omitempty"`
QoS byte `json:"qos,omitempty"`
ProbeOnly bool `json:"probe_only,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
TLSServerName string `json:"tls_server_name,omitempty"`
TLSCAPEM string `json:"tls_ca_pem,omitempty"`
SecretUsername string `json:"-"`
SecretPassword string `json:"-"`
SecretCertificate string `json:"-"`
SecretPrivateKey string `json:"-"`
}
type MQTTResult ¶
type MQTTTransport ¶
type MQTTTransport interface {
ExecuteMQTT(context.Context, MQTTRequest) (MQTTResult, error)
}
MQTTTransport is an optional host-owned capability for Providers that connect to MQTT brokers. The host owns sockets, TLS, packet framing, deadlines, QoS acknowledgement, and secret injection.
type OAuthAuthorizationCapabilityProvider ¶ added in v0.1.1
type OAuthAuthorizationCapabilityProvider interface {
OAuthAuthorizer() (OAuthAuthorizer, bool)
}
OAuthAuthorizationCapabilityProvider preserves the optional protocol capability when a host freezes a registry, without advertising it for non-OAuth providers.
type OAuthAuthorizationRequest ¶ added in v0.1.1
type OAuthAuthorizationRequest struct {
Connection Connection `json:"connection"`
ClientID string `json:"client_id"`
RedirectURI string `json:"redirect_uri"`
Scopes []string `json:"scopes"`
// State and CodeChallenge come from fresh cryptographic randomness generated
// and durably bound to the authenticated session by Integration.
State string `json:"-"`
CodeChallenge string `json:"code_challenge"`
}
type OAuthAuthorizer ¶ added in v0.1.1
type OAuthAuthorizer interface {
AuthorizationURL(OAuthAuthorizationRequest) (string, error)
ExchangeAuthorizationCode(context.Context, OAuthCodeExchangeRequest) (OAuthTokens, error)
}
OAuthAuthorizer is an optional account-authorization protocol capability, not a model-callable business operation. Integration owns the session, current-user authorization, exact redirect allowlist, state, PKCE, one-time code consumption, encrypted token persistence and recovery. Providers perform protocol I/O only through the host Transport. Hosts must never blindly retry an uncertain exchange.
func ResolveOAuthAuthorizer ¶ added in v0.1.1
func ResolveOAuthAuthorizer(adapter Adapter) (OAuthAuthorizer, bool)
type OAuthCodeExchangeRequest ¶ added in v0.1.1
type OAuthConnectionTestScopeProvider ¶ added in v0.1.1
type OAuthConnectionTestScopeProvider interface {
OAuthConnectionTestScopes() (alternatives [][]string, declared bool)
}
OAuthConnectionTestScopeProvider declares the OAuth scopes needed by the provider's fixed connection probe. Alternatives are ORed; every scope in an alternative is required. A missing declaration is distinct from a declared empty alternative (no scopes required). This never adds requested scopes or grants business access. Registry registration snapshots this metadata.
type OAuthOperationScopeProvider ¶ added in v0.1.1
type OAuthOperationScopeProvider interface {
OAuthOperationScopes(operationKey string) (alternatives [][]string, declared bool)
}
OAuthOperationScopeProvider declares the actual OAuth grants required by one registered operation. Alternatives are ORed, members are ANDed. The absence of a declaration must not grant account access; a declared empty alternative explicitly requires no OAuth scope. This metadata neither authorizes the caller nor changes the operation's effect. Hosts must check both separately. Registry registration snapshots declarations for descriptor operations only.
type OAuthTokens ¶ added in v0.1.1
type OAuthTokens struct {
AccessToken string `json:"-"`
RefreshToken string `json:"-"`
TokenType string `json:"token_type"`
GrantedScopes []string `json:"granted_scopes"`
ExpiresInSeconds int64 `json:"expires_in_seconds"`
}
OAuthTokens is private Provider-to-Integration output. Never serialize raw credentials into traces, model payloads or product responses. GrantedScopes record the actual response (or requested scope when omitted under RFC 6749), not product permission: hosts still intersect their current grants and policy.
type OperationDescriptor ¶
type OperationDescriptor struct {
ConnectorKey string `json:"connector_key"`
ProviderKey string `json:"provider_key"`
Key string `json:"key"`
Mode OperationMode `json:"mode"`
ContractSHA256 string `json:"contract_sha256"`
Reliability ReliabilityContract `json:"reliability"`
}
func (OperationDescriptor) Validate ¶
func (d OperationDescriptor) Validate() error
type OperationEffect ¶
type OperationEffect string
const ( EffectRead OperationEffect = "read" EffectReserve OperationEffect = "reserve" EffectWrite OperationEffect = "write" )
type OperationMode ¶
type OperationMode string
const ( ModeCall OperationMode = "call" ModeEnqueue OperationMode = "enqueue" ModeStartOperation OperationMode = "start_operation" )
type Principal ¶
type Principal struct {
UserID string `json:"user_id,omitempty"`
RoleKey string `json:"role_key,omitempty"`
OrgID string `json:"org_id,omitempty"`
RequestID string `json:"request_id,omitempty"`
CausationID string `json:"causation_id,omitempty"`
WorkspaceID string `json:"workspace_id,omitempty"`
IsAuthenticated bool `json:"is_authenticated,omitempty"`
}
type ProcessRequest ¶
type ProcessSession ¶
type ProcessTransport ¶
type ProcessTransport interface {
StartProcess(context.Context, ProcessRequest) (ProcessSession, error)
}
ProcessTransport is an optional host-owned capability for Providers that speak a line-delimited protocol over a governed child process. The host owns executable authorization, process creation, stdio, limits, and termination.
type ProviderDescriptor ¶
type ProviderDescriptor struct {
ConnectorKey string `json:"connector_key"`
ProviderKey string `json:"provider_key"`
ProviderRevision string `json:"provider_revision"`
StartupActivation StartupActivationPolicy `json:"startup_activation,omitempty"`
ConfigFields []ConfigField `json:"config_fields,omitempty"`
SecretFields []SecretField `json:"secret_fields,omitempty"`
Operations []OperationDescriptor `json:"operations"`
}
func (ProviderDescriptor) RequiresReconciler ¶
func (d ProviderDescriptor) RequiresReconciler() bool
func (ProviderDescriptor) Validate ¶
func (d ProviderDescriptor) Validate() error
type ProviderError ¶
type ProviderError struct {
// contains filtered or unexported fields
}
ProviderError carries machine-readable recovery semantics. Error deliberately returns only Code: provider response text and wrapped causes may contain credentials or customer data and are not a public/logging contract.
func (*ProviderError) ApplicationErrorKind ¶ added in v0.1.10
func (e *ProviderError) ApplicationErrorKind() string
func (*ProviderError) Classification ¶
func (e *ProviderError) Classification() ErrorClassification
func (*ProviderError) Code ¶
func (e *ProviderError) Code() string
func (*ProviderError) Error ¶
func (e *ProviderError) Error() string
func (*ProviderError) ErrorCode ¶ added in v0.1.10
func (e *ProviderError) ErrorCode() string
func (*ProviderError) ErrorParams ¶ added in v0.1.10
func (*ProviderError) ErrorParams() map[string]string
func (*ProviderError) Unwrap ¶
func (e *ProviderError) Unwrap() error
type ProviderSchema ¶
type ProviderSchema struct {
ConnectorKey string `json:"connector_key"`
ProviderKey string `json:"provider_key"`
ProviderRevision string `json:"provider_revision"`
StartupActivation StartupActivationPolicy `json:"startup_activation,omitempty"`
ConfigFields []ConfigField `json:"config_fields,omitempty"`
SecretFields []SecretField `json:"secret_fields,omitempty"`
}
func (ProviderSchema) Validate ¶
func (s ProviderSchema) Validate() error
type ProviderSet ¶
type ProviderSet struct {
Providers []Adapter
}
ProviderSet is one explicit batch of Provider Adapters composed by a project before the Runtime validates and freezes its Registry.
type ProviderSetFactory ¶
type ProviderSetFactory func(Transport) (ProviderSet, error)
ProviderSetFactory binds project Adapter constructors to the host-owned Transport before their descriptors enter the frozen Registry.
type ReconcileRequest ¶
type ReconcileRequest struct {
ConnectorKey string `json:"connector_key"`
ProviderKey string `json:"provider_key"`
OperationKey string `json:"operation_key"`
ContractSHA256 string `json:"contract_sha256"`
Connection Connection `json:"connection"`
RequestRef string `json:"request_ref"`
ResponseRef string `json:"response_ref,omitempty"`
Payload json.RawMessage `json:"payload"`
Secrets map[string]string `json:"secrets,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
Principal Principal `json:"principal"`
}
func (ReconcileRequest) Validate ¶
func (r ReconcileRequest) Validate() error
type ReconcileResult ¶
type ReconcileResult struct {
Outcome ReconciliationOutcome `json:"outcome"`
Result *CallResult `json:"result,omitempty"`
FailureCode string `json:"failure_code,omitempty"`
RetryAfter time.Duration `json:"retry_after,omitempty"`
}
func (ReconcileResult) Validate ¶
func (r ReconcileResult) Validate() error
type Reconciler ¶
type Reconciler interface {
Reconcile(context.Context, ReconcileRequest) (ReconcileResult, error)
}
Reconciler is optional and read-only. Integration invokes it only for an operation whose ReliabilityContract declares provider_lookup.
type ReconciliationMode ¶
type ReconciliationMode string
const ( ReconciliationNone ReconciliationMode = "none" ReconciliationProviderLookup ReconciliationMode = "provider_lookup" )
type ReconciliationOutcome ¶
type ReconciliationOutcome string
const ( ReconciliationSucceeded ReconciliationOutcome = "succeeded" ReconciliationFailed ReconciliationOutcome = "failed" ReconciliationPending ReconciliationOutcome = "pending" ReconciliationNotFound ReconciliationOutcome = "not_found" ReconciliationUnknown ReconciliationOutcome = "unknown" )
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Descriptors ¶
func (r *Registry) Descriptors() []ProviderDescriptor
func (*Registry) RegisterProviderSet ¶
func (r *Registry) RegisterProviderSet(set ProviderSet) error
type ReliabilityContract ¶
type ReliabilityContract struct {
Effect OperationEffect `json:"effect"`
Idempotency IdempotencyContract `json:"idempotency"`
Reconciliation ReconciliationMode `json:"reconciliation"`
Compensation CompensationContract `json:"compensation"`
}
func (ReliabilityContract) Validate ¶
func (c ReliabilityContract) Validate(operationKey string) error
type ResourceHealthReport ¶
type ResourceHealthReport struct {
ObservationID string `json:"observation_id"`
Kind string `json:"kind"`
State string `json:"state"`
PreviousState string `json:"previous_state,omitempty"`
EvidenceSource string `json:"evidence_source"`
QuotaUsedPercent *int `json:"quota_used_percent,omitempty"`
BalanceBand string `json:"balance_band,omitempty"`
CapabilityBlocked bool `json:"capability_blocked"`
ObservedAt string `json:"observed_at"`
ErrorCode string `json:"error_code,omitempty"`
}
ResourceHealthReport is an optional, provider-normalized observation. A provider that lacks a reliable API or explicit provider error must omit it; Integration never infers quota or billing state from a generic failed call.
type SMTPRequest ¶
type SMTPRequest struct {
Host string `json:"host"`
Port int `json:"port"`
ImplicitTLS bool `json:"implicit_tls,omitempty"`
StartTLS bool `json:"start_tls,omitempty"`
TLSServerName string `json:"tls_server_name,omitempty"`
TLSCAPEM string `json:"tls_ca_pem,omitempty"`
Username string `json:"username,omitempty"`
SecretPassword string `json:"-"`
EnvelopeFrom string `json:"envelope_from,omitempty"`
Recipients []string `json:"recipients,omitempty"`
Message []byte `json:"message,omitempty"`
ProbeOnly bool `json:"probe_only,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
}
type SMTPResult ¶
type SMTPTransport ¶
type SMTPTransport interface {
SendSMTP(context.Context, SMTPRequest) (SMTPResult, error)
}
SMTPTransport is an optional host-owned capability for Providers that deliver RFC 5322 messages. Keeping it separate preserves compatibility for transports that only support HTTP and SQL.
type SQLOperation ¶
type SQLOperation string
const ( SQLOperationPing SQLOperation = "ping" SQLOperationQuery SQLOperation = "query" SQLOperationExec SQLOperation = "exec" )
type SQLRequest ¶
type SQLRequest struct {
Driver string `json:"driver"`
DSN string `json:"-"`
Operation SQLOperation `json:"operation"`
Statement string `json:"statement,omitempty"`
Arguments []any `json:"arguments,omitempty"`
MaxRows int `json:"max_rows,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
}
type SecretCredentialKind ¶
type SecretCredentialKind string
const ( SecretCredentialAPIKey SecretCredentialKind = "api_key" SecretCredentialBasicAuthPassword SecretCredentialKind = "basic_auth_password" SecretCredentialBearerToken SecretCredentialKind = "bearer_token" SecretCredentialCertificate SecretCredentialKind = "certificate" SecretCredentialConnectionString SecretCredentialKind = "connection_string" SecretCredentialDatabasePassword SecretCredentialKind = "database_password" SecretCredentialGeneric SecretCredentialKind = "generic_secret" SecretCredentialIdentifier SecretCredentialKind = "identifier" SecretCredentialOAuthClientSecret SecretCredentialKind = "oauth_client_secret" SecretCredentialPrivateKey SecretCredentialKind = "private_key" SecretCredentialRefreshToken SecretCredentialKind = "refresh_token" SecretCredentialServiceAccount SecretCredentialKind = "service_account" SecretCredentialSigningSecret SecretCredentialKind = "signing_secret" )
type SecretExpiryPolicy ¶
type SecretExpiryPolicy string
const ( SecretExpiryNone SecretExpiryPolicy = "none" SecretExpiryOptional SecretExpiryPolicy = "optional" SecretExpiryRequired SecretExpiryPolicy = "required" )
type SecretField ¶
type SecretField struct {
Key string `json:"key"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
I18n map[string]FieldLocalization `json:"i18n,omitempty"`
Required bool `json:"required"`
CredentialKind SecretCredentialKind `json:"credential_kind"`
MaterialFormat SecretMaterialFormat `json:"material_format"`
RotationPolicy SecretRotationPolicy `json:"rotation_policy"`
ExpiryPolicy SecretExpiryPolicy `json:"expiry_policy"`
TestRequirement SecretTestRequirement `json:"test_requirement"`
}
type SecretMaterialFormat ¶
type SecretMaterialFormat string
const ( SecretMaterialOpaque SecretMaterialFormat = "opaque" SecretMaterialText SecretMaterialFormat = "text" SecretMaterialJSONObject SecretMaterialFormat = "json_object" SecretMaterialPEM SecretMaterialFormat = "pem" SecretMaterialPEMOrOpaque SecretMaterialFormat = "pem_or_opaque" SecretMaterialPEMOrReference SecretMaterialFormat = "pem_or_reference" SecretMaterialURIOrDSN SecretMaterialFormat = "uri_or_dsn" )
type SecretRotationPolicy ¶
type SecretRotationPolicy string
const ( SecretRotationManual SecretRotationPolicy = "manual" SecretRotationOAuthRefresh SecretRotationPolicy = "oauth_refresh" )
type SecretTestRequirement ¶
type SecretTestRequirement string
const ( SecretTestOptional SecretTestRequirement = "optional" SecretTestWhenBound SecretTestRequirement = "when_bound" )
type StartOperation ¶
type StartOperation[I any] struct { ConnectorKey string ProviderKey string Key string ContractSHA256 string Reliability ReliabilityContract }
StartOperation describes asynchronous delivery that starts a long-running external operation. Integration owns the local durable operation identity.
func (StartOperation[I]) Descriptor ¶
func (o StartOperation[I]) Descriptor() OperationDescriptor
type StartupActivationPolicy ¶
type StartupActivationPolicy string
const ( StartupActivationManual StartupActivationPolicy = "" StartupActivationDefaultSafe StartupActivationPolicy = "default_safe" )
type TestConnectionRequest ¶
type TestConnectionRequest struct {
ConnectorKey string `json:"connector_key"`
ProviderKey string `json:"provider_key"`
Connection Connection `json:"connection"`
Secrets map[string]string `json:"secrets,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
Principal Principal `json:"principal"`
}
TestConnectionRequest is a management-plane probe envelope. It deliberately has no operation key or payload: testing a configured connection is not a business operation and must not be disguised as Adapter.Call.
type TestConnectionResult ¶
type TestConnectionResult struct {
Connected bool `json:"connected"`
Details json.RawMessage `json:"details,omitempty"`
SecretUpdates map[string]string `json:"secret_updates,omitempty"`
}
type Transport ¶
type Transport interface {
RoundTripHTTP(context.Context, HTTPRequest) (HTTPResponse, error)
ExecuteSQL(context.Context, SQLRequest) (SQLResult, error)
}
Transport is the only outbound I/O capability supplied to project-owned Connector Adapters. The deployment host owns the concrete clients, pools and limits.
type TypedRequest ¶
type TypedResult ¶
type TypedResult[O any] struct { Output O ResponseRef string SecretUpdates map[string]string ResourceHealth *ResourceHealthReport }
type VerifiedWebhook ¶
type VerifiedWebhook struct {
EventType string `json:"event_type"`
ExternalID string `json:"external_id"`
Payload json.RawMessage `json:"payload"`
Security *WebhookSecurityEvidence `json:"security,omitempty"`
Challenge string `json:"challenge,omitempty"`
ChallengeFormat string `json:"challenge_format,omitempty"`
ExternalIdentity *WebhookExternalIdentity `json:"external_identity,omitempty"`
DeliveryReceipt *WebhookDeliveryReceipt `json:"delivery_receipt,omitempty"`
}
type VerifyWebhookRequest ¶
type VerifyWebhookRequest struct {
ConnectorKey string `json:"connector_key"`
ProviderKey string `json:"provider_key"`
Connection Connection `json:"connection"`
Headers map[string][]string `json:"headers,omitempty"`
Query map[string][]string `json:"query,omitempty"`
Secrets map[string]string `json:"secrets,omitempty"`
Body []byte `json:"body"`
ReceivedAt time.Time `json:"received_at"`
}
type WebSocketMessage ¶ added in v0.1.22
type WebSocketMessage struct {
Type WebSocketMessageType `json:"type"`
Data []byte `json:"data"`
}
type WebSocketMessageType ¶ added in v0.1.22
type WebSocketMessageType string
const ( WebSocketMessageText WebSocketMessageType = "text" WebSocketMessageBinary WebSocketMessageType = "binary" )
type WebSocketRequest ¶ added in v0.1.22
type WebSocketSession ¶ added in v0.1.22
type WebSocketTransport ¶ added in v0.1.22
type WebSocketTransport interface {
OpenWebSocket(context.Context, WebSocketRequest) (WebSocketSession, error)
}
WebSocketTransport is an optional host-owned capability for Providers that consume or publish framed WebSocket messages. The host owns dialing, TLS, redirects, frame limits, deadlines, secret header injection, and closure.
type WebhookDeliveryReceipt ¶
type WebhookExternalIdentity ¶
type WebhookSecurityEvidence ¶
type WebhookVerifier ¶
type WebhookVerifier interface {
VerifyWebhook(context.Context, VerifyWebhookRequest) (VerifiedWebhook, error)
}
WebhookVerifier is optional. Integration owns the HTTP route, request limits, replay/idempotency checks and persistence; providers only authenticate and normalize one already-resolved connection's inbound request.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package calendar defines provider-neutral read contracts.
|
Package calendar defines provider-neutral read contracts. |
|
Package calendarwrite defines bounded calendar mutation contracts.
|
Package calendarwrite defines bounded calendar mutation contracts. |
|
Package collaborationwrite defines bounded, synchronous collaboration message writes.
|
Package collaborationwrite defines bounded, synchronous collaboration message writes. |
|
Package contracttest provides reusable, side-effect-free checks for Connector implementations.
|
Package contracttest provides reusable, side-effect-free checks for Connector implementations. |
|
examples
|
|
|
minimal
Package minimal demonstrates a Connector that performs no network access.
|
Package minimal demonstrates a Connector that performs no network access. |
|
Package mail defines bounded, provider-neutral mailbox read contracts.
|
Package mail defines bounded, provider-neutral mailbox read contracts. |
|
Package mailattachment defines the provider-neutral contract used to fetch one source-owned email attachment.
|
Package mailattachment defines the provider-neutral contract used to fetch one source-owned email attachment. |
|
Package mailwrite defines explicit, bounded outgoing mail contracts.
|
Package mailwrite defines explicit, bounded outgoing mail contracts. |
|
Package mcptool owns the public Connector operation contract used to list and invoke tools on an MCP server.
|
Package mcptool owns the public Connector operation contract used to list and invoke tools on an MCP server. |
|
providers
|
|
|
knowledge_base/http_api
Package httpapi defines the typed operation contract for the official Knowledge Base HTTP provider.
|
Package httpapi defines the typed operation contract for the official Knowledge Base HTTP provider. |
|
Package web defines bounded public-web search and page-read contracts.
|
Package web defines bounded public-web search and page-read contracts. |