Documentation
¶
Overview ¶
Package integration is wowapi's external-provider framework: modules register a Provider ADAPTER per provider key (a payment gateway, an SMS gateway, an identity source, …); per-tenant/platform rows in integration_providers hold the non-secret config plus a credential REFERENCE (never plaintext); and the kernel resolves an adapter + its config + its resolved credential on demand and aggregates provider health for readiness.
Anti-corruption boundary: the adapter is where a provider's payloads are translated to kernel/module types — provider types never cross into services. Contract: blueprint 07 §6.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Key string
Kind string
Settings map[string]any
// Credential is the resolved secret as a config.Secret, so it is structurally
// redacted — it never appears in logs, %v, JSON, or dumps (roadmap S4/CA-14).
// Unwrap the plaintext with the Secret's reveal accessor at the point of use;
// IsZero when there is no credential_ref.
Credential config.Secret
IsPlatform bool // true when resolved from the platform (tenant_id NULL) row
}
Config is a resolved provider instance: identity, non-secret settings, and the resolved credential (from the row's credential_ref via the secrets provider). Credential is never logged.
type Provider ¶
type Provider interface {
Key() string // "core.stripe" — module.name
Kind() string // one of validKinds
// HealthCheck probes the live provider using the resolved config. A non-nil
// error marks the provider degraded (surfaced in readiness detail, non-fatal).
HealthCheck(ctx context.Context, cfg Config) error
}
Provider is the adapter a module registers for one provider key. Concrete per-kind behavior lives behind interfaces the module defines; the kernel needs only identity and a health probe.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry collects provider adapters during module registration.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store reads/writes integration_providers rows and resolves a provider's config + credential. Config reads run on the caller's TenantDB (RLS: a tenant sees its own rows + platform defaults); writes run with platform privilege (provider config is behavior-changing, kept off the module role — SEC-13).
func NewStore ¶
NewStore wires the store. secrets may be nil (credential resolution then errors if a row carries a credential_ref).
func (*Store) HealthChecks ¶
HealthChecks probes every registered provider that has an active config row visible to the caller's tenant. Returns key → error (nil = healthy). A provider with no config row is skipped (not enabled for this tenant). Non-fatal: intended for readiness detail.
type UpsertIn ¶
type UpsertIn struct {
TenantID uuid.UUID
Key string
Kind string
Settings map[string]any
CredentialRef string // a secretref://... string, or "" for none
}
UpsertIn describes a provider config row. TenantID zero → a platform-wide row (tenant_id NULL); non-zero → a tenant override (the DBTX must be bound to that tenant so RLS admits the write).