plugins

package
v0.0.0-...-c9de886 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSuspended = errors.New("activity result pending")

ErrSuspended is returned by a plugin when it wants to pause task execution and wait for an asynchronous action.

Functions

func DefaultHTTPDispatcher

func DefaultHTTPDispatcher(ctx context.Context, url string, taskID string, payload map[string]any) error

DefaultHTTPDispatcher sends the payload as-is with no envelope. Callers that need a specific request shape should provide a custom dispatcher.

Types

type APICallConfig

type APICallConfig struct {
	URL string `json:"url"`
}

APICallConfig holds properties decoded from the TaskTemplate's JSON configuration.

type APICallPlugin

type APICallPlugin struct {
	// contains filtered or unexported fields
}

APICallPlugin implements the generic_api_call plugin for FIRE_AND_FORGET tasks. It sends an API request to a configured URL containing the task data payload.

func (*APICallPlugin) Execute

func (p *APICallPlugin) Execute(ctx PluginContext, configRaw json.RawMessage) error

type Dispatcher

type Dispatcher func(ctx context.Context, url string, taskID string, payload map[string]any) error

Dispatcher defines the function signature for executing external system integrations.

type ExternalReviewConfig

type ExternalReviewConfig struct {
	ExternalURL string `json:"external_url"`
}

ExternalReviewConfig holds properties decoded from the TaskTemplate's JSON configuration.

type ExternalReviewPlugin

type ExternalReviewPlugin struct {
	// contains filtered or unexported fields
}

ExternalReviewPlugin manages asynchronous delegation of task steps to third-party government agencies.

func (*ExternalReviewPlugin) Execute

func (p *ExternalReviewPlugin) Execute(ctx PluginContext, configRaw json.RawMessage) error

type PaymentConfig

type PaymentConfig struct {
	PaymentServiceURL string `json:"payment_service_url"`
}

PaymentConfig holds properties decoded from the TaskTemplate's JSON configuration.

type PaymentPlugin

type PaymentPlugin struct {
	// contains filtered or unexported fields
}

PaymentPlugin implements the generic_payment plugin. It initiates a payment step externally and transitions the task record to "PENDING_PAYMENT".

func (*PaymentPlugin) Execute

func (p *PaymentPlugin) Execute(ctx PluginContext, configRaw json.RawMessage) error

type PluginContext

type PluginContext struct {
	Context         context.Context
	Record          *store.TaskRecord
	Inputs          map[string]any
	OutputNamespace string
}

PluginContext provides the database record, input arguments, and context to a plugin during execution.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is a thread-safe registry of task plugins keyed by taskType and pluginName.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new, empty Registry.

func (*Registry) Get

func (r *Registry) Get(taskType string) (TaskPlugin, bool)

Get retrieves a registered plugin by taskType and pluginName.

func (*Registry) Register

func (r *Registry) Register(taskType string, p TaskPlugin) error

Register adds a new plugin for a specific taskType. It returns an error if a plugin with the same name already exists for that taskType.

type SOAPCallConfig

type SOAPCallConfig struct {
	ServiceID  string `json:"service_id"`
	Operation  string `json:"operation"`
	Path       string `json:"path,omitempty"`        // relative to the service URL; "" posts to the service URL itself
	SOAPAction string `json:"soap_action,omitempty"` // SOAP 1.1 action; quoted automatically, "" sends SOAPAction: ""
}

SOAPCallConfig holds properties decoded from the TaskTemplate's JSON configuration.

type SOAPCallPlugin

type SOAPCallPlugin struct {
	// contains filtered or unexported fields
}

SOAPCallPlugin posts a SOAP envelope to a configured service and records the outcome. Transport (endpoint, timeout, mTLS client certificate) is resolved by remote.Manager from the services registry; envelope building and response interpretation are delegated to a SOAPInterpreter, so the plugin itself is domain-agnostic. It is an auto plugin: it always returns nil so the workflow advances, and the interpreter's recorded flags drive the gateways.

func (*SOAPCallPlugin) Execute

func (p *SOAPCallPlugin) Execute(ctx PluginContext, configRaw json.RawMessage) error

type SOAPInterpreter

type SOAPInterpreter interface {
	// BuildEnvelope returns the SOAP envelope XML for the operation, derived
	// from the task's mapped inputs. An error means the request cannot even be
	// built (e.g. an incomplete document); the plugin then skips the call and
	// hands the error straight to Interpret, so user-facing prose stays in the
	// domain.
	BuildEnvelope(operation string, inputs map[string]any) (string, error)

	// Interpret turns the call outcome into a record state ("" leaves the
	// state unchanged) and the fields to record into the output namespace.
	// callErr is the build or transport error (nil on success); resp is the
	// raw response, nil when the call never happened. A non-2xx status arrives
	// here as a response, not an error — SOAP faults carry meaningful bodies.
	Interpret(operation string, callErr error, resp *remote.RawResponse) (state string, out map[string]any)
}

SOAPInterpreter adapts a domain to the generic SOAP-call plugin: it builds the SOAP envelope from the task inputs and interprets the raw response into a record state plus fields to record into the output namespace.

type TaskPlugin

type TaskPlugin interface {
	// Execute runs the custom logic of the plugin, updating the task record status and metadata.
	// The config argument contains the custom plugin configuration parameters unmarshaled from JSON.
	Execute(ctx PluginContext, config json.RawMessage) error
}

TaskPlugin is the interface that all interaction and system action handlers must implement.

func NewAPICallPlugin

func NewAPICallPlugin(dispatcher Dispatcher) TaskPlugin

NewAPICallPlugin creates a new APICallPlugin.

func NewExternalReviewPlugin

func NewExternalReviewPlugin(dispatcher Dispatcher) TaskPlugin

NewExternalReviewPlugin returns a plugin with a custom or default HTTP dispatcher.

func NewPaymentPlugin

func NewPaymentPlugin(dispatcher Dispatcher) TaskPlugin

NewPaymentPlugin creates a new PaymentPlugin.

func NewSOAPCallPlugin

func NewSOAPCallPlugin(manager *remote.Manager, interp SOAPInterpreter) TaskPlugin

NewSOAPCallPlugin creates a new SOAPCallPlugin bound to an interpreter.

func NewUserInputPlugin

func NewUserInputPlugin() TaskPlugin

type UserInputConfig

type UserInputConfig struct {
	StatusOverride string `json:"status_override,omitempty"`
}

UserInputConfig holds properties specific to the user input step

type UserInputPlugin

type UserInputPlugin struct{}

UserInputPlugin implements a standard human interaction / form submission step.

func (*UserInputPlugin) Execute

func (p *UserInputPlugin) Execute(ctx PluginContext, configRaw json.RawMessage) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL