Documentation
¶
Overview ¶
Package registry stores definition registrations for the greenfield integration runtime
Index ¶
- Variables
- func GateSurfaceChange(old, next Surface) error
- func ResolveLinkEdge(sourceSchema *entityops.Schema, rule types.LinkRule) (entityops.EdgeDescriptor, error)
- func SurfaceHash(def types.Definition) (string, error)
- func ValidateLinkRules(sourceSchema *entityops.Schema, rules []types.LinkRule) error
- type Builder
- type Option
- type Registry
- func (r *Registry) Catalog() []types.DefinitionSpec
- func (r *Registry) Definition(id string) (types.Definition, bool)
- func (r *Registry) Definitions() []types.Definition
- func (r *Registry) GalaListeners() []types.GalaListenerRegistration
- func (r *Registry) IsRuntimeIntegration(definitionID string) bool
- func (r *Registry) Listeners() []types.OperationRegistration
- func (r *Registry) Operation(id string, name string) (types.OperationRegistration, error)
- func (r *Registry) Register(def types.Definition) error
- func (r *Registry) RegisterAll(builders ...Builder) error
- func (r *Registry) RuntimeClient(definitionID string) (any, bool)
- func (r *Registry) StaticWebhooks() []types.StaticWebhookEntry
- func (r *Registry) Version(id string) string
- func (r *Registry) Webhook(id string, name string) (types.WebhookRegistration, error)
- func (r *Registry) WebhookEvent(id string, webhookName string, eventName string) (types.WebhookEventRegistration, error)
- func (r *Registry) WebhookListeners() []types.WebhookEventRegistration
- type Snapshot
- type Surface
- type SurfaceCredential
- type SurfaceOperation
- type SurfaceSchema
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDefinitionIDRequired indicates a definition is missing its canonical identifier ErrDefinitionIDRequired = errors.New("integrations/registry: definition id required") // ErrDefinitionAlreadyRegistered indicates the definition ID is already present ErrDefinitionAlreadyRegistered = errors.New("integrations/registry: definition already registered") // ErrDefinitionNotFound indicates the requested definition does not exist ErrDefinitionNotFound = errors.New("integrations/registry: definition not found") // ErrDuplicateRegistration indicates a definition registers the same item more than once ErrDuplicateRegistration = errors.New("integrations/registry: duplicate registration") // ErrClientNotFound indicates the requested client does not exist ErrClientNotFound = errors.New("integrations/registry: client not found") // ErrConnectionVerifyRequired indicates a connection declares no verification ErrConnectionVerifyRequired = errors.New("integrations/registry: connection verification required") // ErrConnectionVerifyClientNotProvided indicates a connection's verification client is not among its clients ErrConnectionVerifyClientNotProvided = errors.New("integrations/registry: connection does not provide its verification client") // ErrConnectionClientNotProvided indicates a connection does not provide a client an operation uses ErrConnectionClientNotProvided = errors.New("integrations/registry: connection does not provide a client an operation uses") // ErrOperationClientConflict indicates an operation's handlers bind more than one client type ErrOperationClientConflict = errors.New("integrations/registry: operation handlers bind different clients") // ErrInstallationRequired indicates a definition with connections declares no installation metadata layout ErrInstallationRequired = errors.New("integrations/registry: installation metadata layout required when the definition declares connections") // ErrInstallationSchemaMismatch indicates a connection's verification returns a layout other than the definition's ErrInstallationSchemaMismatch = errors.New("integrations/registry: connection verification returns a different installation metadata layout than the definition declares") // ErrOperationNotFound indicates the requested operation does not exist ErrOperationNotFound = errors.New("integrations/registry: operation not found") // ErrOperationHandlerRequired indicates an operation is missing both Handle and IngestHandle ErrOperationHandlerRequired = errors.New("integrations/registry: operation handler required") // ErrOperationHandlerAmbiguous indicates an operation specifies both Handle and IngestHandle ErrOperationHandlerAmbiguous = errors.New("integrations/registry: operation must specify exactly one of Handle or IngestHandle") // ErrIngestContractsRequired indicates an IngestHandle is registered without any Ingest contracts ErrIngestContractsRequired = errors.New("integrations/registry: IngestHandle requires at least one Ingest contract") // ErrIngestSnapshotRequiresIngestHandle indicates Policy.Snapshot is set without an IngestHandle ErrIngestSnapshotRequiresIngestHandle = errors.New("integrations/registry: policy snapshot requires an IngestHandle") // ErrWebhookEventResolverRequired indicates a webhook registration is missing its event resolver ErrWebhookEventResolverRequired = errors.New("integrations/registry: webhook event resolver required") // ErrWebhookEventHandlerRequired indicates a webhook event registration is missing its handler ErrWebhookEventHandlerRequired = errors.New("integrations/registry: webhook event handler required") // ErrWebhookNotFound indicates the requested webhook or webhook event does not exist ErrWebhookNotFound = errors.New("integrations/registry: webhook not found") // ErrOperatorConfigSchemaRequired indicates a definition has an operator config with no schema ErrOperatorConfigSchemaRequired = errors.New("integrations/registry: operator config schema required") // ErrCredentialSchemaRequired indicates a connection's credential reflects no schema ErrCredentialSchemaRequired = errors.New("integrations/registry: credential schema required") // ErrUserInputSchemaRequired indicates a definition has a user input block with no schema ErrUserInputSchemaRequired = errors.New("integrations/registry: user input schema required") // ErrBuilderNil indicates a builder dependency was nil ErrBuilderNil = errors.New("integrations/registry: builder is nil") // ErrRuntimeBuildRequired indicates a runtime integration is missing its Build function ErrRuntimeBuildRequired = errors.New("integrations/registry: runtime integration build function required") // ErrLinkEdgeNotFound indicates a mapping's link edge does not exist on the source schema ErrLinkEdgeNotFound = errors.New("integrations/registry: link edge not found on source schema") // ErrLinkEdgeAmbiguous indicates a link rule's target type matches multiple edges, no edge set ErrLinkEdgeAmbiguous = errors.New("integrations/registry: link target type is ambiguous, edge name required") // ErrLinkRuleInvalid indicates a link rule sets neither or both of a field match and an expression ErrLinkRuleInvalid = errors.New("integrations/registry: link rule must set exactly one of field match or expression") // ErrLinkTargetNotRegistered indicates a link edge targets a schema without a registry entry ErrLinkTargetNotRegistered = errors.New("integrations/registry: link edge target schema is not in the entityops registry") // ErrLinkTargetFieldInvalid indicates the target field is not a match key on the target schema ErrLinkTargetFieldInvalid = errors.New("integrations/registry: link target field is not a match key on the target schema") // ErrLinkSourceFieldInvalid indicates the source field is not a mapped input key of that shape ErrLinkSourceFieldInvalid = errors.New("integrations/registry: link source field is not a mapped input key of the required shape") // ErrOperationFilterExprInvalid indicates a stored operation input carries a filter expression that does not compile ErrOperationFilterExprInvalid = errors.New("integrations/registry: operation filter expression invalid") // ErrDestructiveSurfaceChange indicates a removed connection or operation has no replacement ErrDestructiveSurfaceChange = errors.New("integrations/registry: removed connection or operation has no replacing registration") // ErrSnapshotStale indicates a definition's surface does not match its committed snapshot; run task config:generate ErrSnapshotStale = errors.New("integrations/registry: definition surface does not match its committed snapshot") )
var Surfaces embed.FS
Surfaces is the committed surface snapshot of every catalog definition, embedded under surfaces/
Functions ¶
func GateSurfaceChange ¶
GateSurfaceChange refuses dropping a connection or operation of the committed surface without a replacement
func ResolveLinkEdge ¶
func ResolveLinkEdge(sourceSchema *entityops.Schema, rule types.LinkRule) (entityops.EdgeDescriptor, error)
ResolveLinkEdge resolves the edge a link rule links through, by name or unique target type
func SurfaceHash ¶
func SurfaceHash(def types.Definition) (string, error)
SurfaceHash hashes the marshalled DefinitionSurface
Types ¶
type Builder ¶
type Builder func() (types.Definition, error)
Builder builds one manifest-backed definition
type Option ¶
type Option func(*Registry)
Option configures a Registry
func WithSnapshots ¶
WithSnapshots requires every registered definition to match its committed snapshot in fsys and records the snapshot's version
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the in-memory index of registered definitions
func (*Registry) Catalog ¶
func (r *Registry) Catalog() []types.DefinitionSpec
Catalog returns all definition specs in stable id order
func (*Registry) Definition ¶
func (r *Registry) Definition(id string) (types.Definition, bool)
Definition returns one definition by canonical identifier
func (*Registry) Definitions ¶
func (r *Registry) Definitions() []types.Definition
Definitions returns all registered definitions in stable id order
func (*Registry) GalaListeners ¶
func (r *Registry) GalaListeners() []types.GalaListenerRegistration
GalaListeners returns all registered standalone gala listener registrations
func (*Registry) IsRuntimeIntegration ¶
IsRuntimeIntegration reports whether the definition was provisioned as a runtime integration
func (*Registry) Listeners ¶
func (r *Registry) Listeners() []types.OperationRegistration
Listeners returns all operation registrations in stable topic order
func (*Registry) Register ¶
func (r *Registry) Register(def types.Definition) error
Register adds one definition to the registry
func (*Registry) RegisterAll ¶
RegisterAll builds and registers every supplied definition builder in order
func (*Registry) RuntimeClient ¶
RuntimeClient returns the cached runtime client for the given definition ID
func (*Registry) StaticWebhooks ¶
func (r *Registry) StaticWebhooks() []types.StaticWebhookEntry
StaticWebhooks returns all webhook registrations that declare a fixed static route, sorted by definition id then webhook name
func (*Registry) Version ¶
Version returns the committed snapshot version of one definition, or empty when unregistered or registered without snapshots
func (*Registry) WebhookEvent ¶
func (r *Registry) WebhookEvent(id string, webhookName string, eventName string) (types.WebhookEventRegistration, error)
WebhookEvent returns one webhook event registration for a definition
func (*Registry) WebhookListeners ¶
func (r *Registry) WebhookListeners() []types.WebhookEventRegistration
WebhookListeners returns all webhook event registrations in stable topic order
type Snapshot ¶
type Snapshot struct {
// Hash is the SurfaceHash of the definition the snapshot was written from
Hash string `json:"hash"`
// Version is the ULID recorded on installations as their definition version
Version string `json:"version"`
// Surface is the definition's installation-facing surface
Surface Surface `json:"surface"`
}
Snapshot is a definition's committed surface, its hash, and the version minted when the hash last changed
type Surface ¶
type Surface struct {
// ID is the canonical definition identifier
ID string `json:"id"`
// Credentials lists every connection credential with its stored schema, sorted by ref
Credentials []SurfaceCredential `json:"credentials"`
// UserInput is the stored user input schema when the definition declares a typed user input
UserInput *SurfaceSchema `json:"userInput,omitempty"`
// Installation is the derived installation metadata schema when the definition declares one
Installation *SurfaceSchema `json:"installation,omitempty"`
// Connections lists every connection mode's selecting credential ref, sorted
Connections []string `json:"connections"`
// Operations lists every operation with its retired names and config schema, sorted by name
Operations []SurfaceOperation `json:"operations,omitempty"`
}
Surface is a definition's installation-facing surface: every kind bound to stored data
func DefinitionSurface ¶
func DefinitionSurface(def types.Definition) Surface
DefinitionSurface projects a definition onto its installation-facing surface
type SurfaceCredential ¶
type SurfaceCredential struct {
// Ref is the stable connection name
Ref string `json:"ref"`
// SurfaceSchema is the stored credential schema with its upgrade declaration
SurfaceSchema
// Replaces lists the retired connection names whose stored payloads move onto this connection, sorted
Replaces []string `json:"replaces,omitempty"`
}
SurfaceCredential is one connection credential, the schema of what it stores, and the retired connections it takes over
type SurfaceOperation ¶
type SurfaceOperation struct {
// Name is the stable operation name
Name string `json:"name"`
// Replaces lists the retired operation names this operation takes over, sorted
Replaces []string `json:"replaces,omitempty"`
// Schema is the composed JSON schema of the operation's stored input
Schema json.RawMessage `json:"schema,omitempty"`
// Upgrade reports whether the operation declares an upgrade for stored input persisted under an older layout
Upgrade bool `json:"upgrade,omitempty"`
}
SurfaceOperation is one operation's name, retired names, and stored input schema
type SurfaceSchema ¶
type SurfaceSchema struct {
// Schema is the reflected JSON schema of the stored type
Schema json.RawMessage `json:"schema"`
// Upgrade reports whether the kind declares an upgrade for documents stored under an older layout
Upgrade bool `json:"upgrade,omitempty"`
}
SurfaceSchema is the stored schema of one kind and whether it declares an upgrade for older documents