core

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IntegrationCapabilityTypeAction  IntegrationCapabilityType = "action"
	IntegrationCapabilityTypeTrigger IntegrationCapabilityType = "trigger"

	IntegrationCapabilityStateRequested   IntegrationCapabilityState = "requested"
	IntegrationCapabilityStateEnabled     IntegrationCapabilityState = "enabled"
	IntegrationCapabilityStateDisabled    IntegrationCapabilityState = "disabled"
	IntegrationCapabilityStateAvailable   IntegrationCapabilityState = "available"
	IntegrationCapabilityStateUnavailable IntegrationCapabilityState = "unavailable"
)
View Source
const MaxEmitCount = 500

MaxEmitCount is the maximum number of events a single execution may emit at once. Components that fan out (For Each, Read Memory "One By One", and similar) must stay within this limit so we do not create unbounded downstream runs, DB rows, or queue load.

Variables

View Source
var (
	ErrSecretKeyNotFound   = errors.New("secret or key not found")
	ErrExecutionKVNotFound = errors.New("execution kv not found")
)
View Source
var DefaultOutputChannel = OutputChannel{Name: "default", Label: "Default"}

Functions

This section is empty.

Types

type Action

type Action interface {

	/*
	 * The unique identifier for the component.
	 * This is how nodes reference it, and is used for registration.
	 */
	Name() string

	/*
	 * The label for the component.
	 * This is how nodes are displayed in the UI.
	 */
	Label() string

	/*
	 * A good description of what the component does.
	 * Helpful for documentation and user interfaces.
	 */
	Description() string

	/*
	 * Detailed markdown documentation explaining how to use the component.
	 * This should provide in-depth information about the component's purpose,
	 * configuration options, use cases, and examples.
	 */
	Documentation() string

	/*
	 * The icon for the component.
	 * This is used in the UI to represent the component.
	 */
	Icon() string

	/*
	 * The color for the component.
	 * This is used in the UI to represent the component.
	 */
	Color() string

	/*
	 * Example output data for the component.
	 */
	ExampleOutput() map[string]any

	/*
	 * The output channels used by the component.
	 * If none is returned, the 'default' one is used.
	 */
	OutputChannels(configuration any) []OutputChannel

	/*
	 * The configuration fields exposed by the component.
	 */
	Configuration() []configuration.Field

	/*
	 * Setup the component.
	 */
	Setup(ctx SetupContext) error

	/*
	 * ProcessQueueItem is called when a queue item for this component's node
	 * is ready to be processed. Implementations should create the appropriate
	 * execution or handle the item synchronously using the provided context.
	 */
	ProcessQueueItem(ctx ProcessQueueContext) (*uuid.UUID, error)

	/*
	 * Passes full execution control to the component.
	 *
	 * Component execution has full control over the execution state,
	 * so it is the responsibility of the component to control it.
	 *
	 * Components should finish the execution or move it to waiting state.
	 * Components can also implement async components by combining Execute() and HandleHook().
	 */
	Execute(ctx ExecutionContext) error

	/*
	 * Allows components to define and execute custom hooks.
	 */
	Hooks() []Hook
	HandleHook(ctx ActionHookContext) error

	/*
	 * Handler for webhooks.
	 */
	HandleWebhook(ctx WebhookRequestContext) (int, *WebhookResponseBody, error)

	/*
	 * Cancel allows components to handle cancellation of executions.
	 * Default behavior does nothing. Components can override to perform
	 * cleanup or cancel external resources.
	 */
	Cancel(ctx ExecutionContext) error

	/*
	 * Cleanup allows components to clean up resources after being removed from a canvas.
	 * Default behavior does nothing. Components can override to perform cleanup.
	 */
	Cleanup(ctx SetupContext) error
}

type ActionHookContext added in v0.18.0

type ActionHookContext struct {
	Name           string
	Configuration  any
	Parameters     map[string]any
	Logger         *log.Entry
	HTTP           HTTPContext
	Metadata       MetadataWriter
	ExecutionState ExecutionStateContext
	Auth           AuthReader
	Requests       RequestContext
	Integration    IntegrationContext
	Notifications  NotificationContext
	Secrets        SecretsContext
}

* Context for executing a action hook.

type AuthReader added in v0.17.0

type AuthReader interface {
	AuthenticatedUser() *User
	GetUser(id uuid.UUID) (*User, error)
	GetRole(name string) (*RoleRef, error)
	GetGroup(name string) (*GroupRef, error)
	HasRole(role string) (bool, error)
	InGroup(group string) (bool, error)
}

type BrowserAction

type BrowserAction struct {
	Description string
	URL         string
	Method      string
	FormFields  map[string]string
}

type CanvasMemoryContext added in v0.10.0

type CanvasMemoryContext interface {
	Add(namespace string, values any) error
	Find(namespace string, matches map[string]any) ([]any, error)
	FindFirst(namespace string, matches map[string]any) (any, error)
}

type CanvasMemoryRecord added in v0.23.0

type CanvasMemoryRecord struct {
	ID     uuid.UUID
	Values any
}

type Capability added in v0.19.0

type Capability struct {
	Type           IntegrationCapabilityType `json:"type"`
	Name           string                    `json:"name"`
	Label          string                    `json:"label"`
	Description    string                    `json:"description"`
	Configuration  []configuration.Field     `json:"configuration"`
	OutputChannels []OutputChannel           `json:"outputChannels"`
	ExampleOutput  map[string]any            `json:"exampleOutput,omitempty"`
	ExampleData    map[string]any            `json:"exampleData,omitempty"`
}

type CapabilityContext added in v0.19.0

type CapabilityContext interface {
	Request(capabilities ...string)
	Available(capabilities ...string)
	Unavailable(capabilities ...string)
	Enable(capabilities ...string)
	Disable(capabilities ...string)
	Clear()
	IsRequested(capabilities ...string) bool
	Requested() []string
	Enabled() []string
}

type CapabilityGroup added in v0.19.0

type CapabilityGroup struct {
	Label        string
	Capabilities []Capability
}

type CapabilityUpdateContext added in v0.19.0

type CapabilityUpdateContext struct {
	Changes      map[IntegrationCapabilityState][]string
	Logger       *log.Entry
	HTTP         HTTPContext
	Secrets      IntegrationSecretStorage
	Properties   IntegrationPropertyStorage
	Capabilities CapabilityContext
}

type Configurable added in v0.18.0

type Configurable interface {
	Configuration() []configuration.Field
}

* Configurable is a component (action, trigger, widget) that can be configured.

type EventContext

type EventContext interface {
	Emit(payloadType string, payload any) error
}

type ExecutionContext

type ExecutionContext struct {
	ID             uuid.UUID
	WorkflowID     string
	OrganizationID string
	CanvasName     string
	NodeID         string
	NodeName       string
	SourceNodeID   string
	BaseURL        string
	Data           any
	Configuration  any
	Logger         *log.Entry
	HTTP           HTTPContext
	Metadata       MetadataWriter
	NodeMetadata   MetadataReader
	ExecutionState ExecutionStateContext
	Requests       RequestContext
	Auth           AuthReader
	Integration    IntegrationContext
	Notifications  NotificationContext
	Secrets        SecretsContext
	CanvasMemory   CanvasMemoryContext
	Webhook        NodeWebhookContext
	Expressions    ExpressionContext
}

* ExecutionContext allows the component * to control the state and metadata of each execution of it.

type ExecutionStateContext

type ExecutionStateContext interface {
	IsFinished() bool
	SetKV(key, value string) error
	GetKV(key string) (string, error)

	/*
	 * Pass the execution, emitting a payload to the specified channel.
	 */
	Emit(channel, payloadType string, payloads []any) error

	/*
	 * Pass the execution, without emitting any payloads from it.
	 */
	Pass() error

	/*
	 * Fails the execution.
	 * No payloads are emitted.
	 */
	Fail(reason, message string) error
}

* ExecutionStateContext allows components to control execution lifecycle.

type ExpressionContext added in v0.16.0

type ExpressionContext interface {
	Run(expression string) (any, error)
	RunWithExtraVariables(expression string, variables map[string]any) (any, error)
}

type GroupRef added in v0.16.0

type GroupRef struct {
	Name        string `mapstructure:"name" json:"name"`
	DisplayName string `mapstructure:"displayName" json:"displayName"`
}

type HTTPContext added in v0.0.43

type HTTPContext interface {
	Do(*http.Request) (*http.Response, error)
}

* Components / triggers / applications should always * use this context instead of the net/http directly for executing HTTP requests. * * This makes it easy for us to write unit tests for the implementations, * and also makes it easier to control HTTP timeouts for everything in one place.

type HTTPRequestContext

type HTTPRequestContext struct {
	Logger           *logrus.Entry
	Request          *http.Request
	Response         http.ResponseWriter
	OrganizationID   string
	BaseURL          string
	WebhooksBaseURL  string
	HTTP             HTTPContext
	Integration      IntegrationContext
	Capabilities     CapabilityContext
	IntegrationSetup IntegrationSetupContext
}

type Hook added in v0.18.0

type Hook struct {
	Type       HookType
	Name       string
	Parameters []configuration.Field
}

type HookType added in v0.18.0

type HookType string
const (
	HookTypeInternal HookType = "internal"
	HookTypeUser     HookType = "user"
)

type Integration added in v0.5.0

type Integration interface {
	/*
	 * The name of the integration.
	 */
	Name() string

	/*
	 * Display name for the integration.
	 */
	Label() string

	/*
	 * The icon used by the integration.
	 */
	Icon() string

	/*
	 * A description of what the integration does.
	 */
	Description() string

	/*
	 * Markdown-formatted instructions shown in the connection modal.
	 */
	Instructions() string

	/*
	 * The configuration fields of the integration.
	 */
	Configuration() []configuration.Field

	/*
	 * The list of actions exposed by the integration.
	 */
	Actions() []Action

	/*
	 * The list of triggers exposed by the integration.
	 */
	Triggers() []Trigger

	/*
	 * Called when configuration changes.
	 */
	Sync(ctx SyncContext) error

	/*
	 * Called when the integration is deleted.
	 */
	Cleanup(ctx IntegrationCleanupContext) error

	/*
	 * Allows integrations to define and execute  hooks.
	 */
	Hooks() []Hook
	HandleHook(ctx IntegrationHookContext) error

	/*
	 * List resources of a given type.
	 */
	ListResources(resourceType string, ctx ListResourcesContext) ([]IntegrationResource, error)

	/*
	 * HTTP request handler
	 */
	HandleRequest(ctx HTTPRequestContext)
}

type IntegrationAction added in v0.18.0

type IntegrationAction interface {

	/*
	 * IntegrationAction inherits all the methods from Action interface,
	 * and adds a couple more, which are only applicable to app actions.
	 */
	Action

	OnIntegrationMessage(ctx IntegrationMessageContext) error
}

type IntegrationCapabilityState added in v0.19.0

type IntegrationCapabilityState string

type IntegrationCapabilityType added in v0.19.0

type IntegrationCapabilityType string

* Capabilities are the "features" that the integration provides. * They are typed so the different parts of the system can take only the ones they need. * * They can be in 4 states: * - Unavailable: capability exists, but was not requested as part of the setup flow, and the user cannot request it anymore. * - Available: capability exists, setup did not expose it yet, but the user can still request it. * - Requested: capability was requested, but setup did not enable it yet. * - Enabled: capability is fully enabled and ready for use. * - Disabled: capability was enabled during the setup flow, but has been manually disabled by the user.

type IntegrationCleanupContext added in v0.6.0

type IntegrationCleanupContext struct {
	Configuration  any
	BaseURL        string
	OrganizationID string
	Logger         *logrus.Entry
	HTTP           HTTPContext
	Integration    IntegrationContext
}

type IntegrationContext

type IntegrationContext interface {

	//
	// Whether the integration is using the legacy setup flow.
	//
	LegacySetup() bool
	Properties() IntegrationPropertyStorage
	Secrets() IntegrationSecretStorage

	//
	// Control the metadata and config of the integration
	//
	ID() uuid.UUID
	GetMetadata() any
	SetMetadata(any)
	GetConfig(name string) ([]byte, error)

	//
	// Control the state of the integration
	//
	Ready()
	Error(message string)

	//
	// Control the browser action of the integration
	//
	NewBrowserAction(action BrowserAction)
	RemoveBrowserAction()

	//
	// Control the secrets of the integration
	//
	SetSecret(name string, value []byte) error
	GetSecrets() ([]IntegrationSecret, error)

	/*
	 * Request a new webhook from the integration.
	 * Called from the components/triggers Setup().
	 */
	RequestWebhook(configuration any) error

	/*
	 * Subscribe to integration events.
	 */
	Subscribe(any) (*uuid.UUID, error)

	/*
	 * Schedule actions for the integration.
	 */
	ScheduleResync(interval time.Duration) error
	ScheduleActionCall(actionName string, parameters any, interval time.Duration) error

	/*
	 * List integration subscriptions from nodes.
	 */
	ListSubscriptions() ([]IntegrationSubscriptionContext, error)

	/*
	 * Find a subscription by a predicate function.
	 * Returns the first subscription that matches the predicate, or nil if none found.
	 */
	FindSubscription(predicate func(IntegrationSubscriptionContext) bool) (IntegrationSubscriptionContext, error)
}

* IntegrationContext allows components to access integration information.

type IntegrationHookContext added in v0.18.0

type IntegrationHookContext struct {
	Name            string
	Parameters      any
	Configuration   any
	WebhooksBaseURL string
	Logger          *log.Entry
	Requests        RequestContext
	Integration     IntegrationContext
	HTTP            HTTPContext
}

* Context for executing a integration hook.

type IntegrationMessageContext added in v0.5.0

type IntegrationMessageContext struct {
	Message           any
	Configuration     any
	NodeMetadata      MetadataReader
	Logger            *logrus.Entry
	HTTP              HTTPContext
	Integration       IntegrationContext
	Events            EventContext
	FindExecutionByKV func(key string, value string) (*ExecutionContext, error)
}

type IntegrationPropertyDefinition added in v0.19.0

type IntegrationPropertyDefinition struct {
	Type        IntegrationPropertyType `json:"type"`
	Name        string                  `json:"name"`
	Label       string                  `json:"label"`
	Description string                  `json:"description"`
	Value       any                     `json:"value"`
	Editable    bool                    `json:"editable"`
}

type IntegrationPropertyStorage added in v0.19.0

type IntegrationPropertyStorage interface {
	IntegrationPropertyStorageReader

	Delete(names ...string) error
	Create(def IntegrationPropertyDefinition) error
	CreateMany(defs []IntegrationPropertyDefinition) error
}

type IntegrationPropertyStorageReader added in v0.19.0

type IntegrationPropertyStorageReader interface {
	Get(name string) (any, error)
	GetString(name string) (string, error)
}

type IntegrationPropertyType added in v0.19.0

type IntegrationPropertyType string

* Properties is non-sensitive information exposed by the setup flow to the user. * They can be editable or not. If they are editable, OnPropertyUpdate() is called when the user updates it. * They are also typed, so the display layers (UI, CLI) can render them accordingly.

const (
	IntegrationPropertyTypeString IntegrationPropertyType = "string"
)

type IntegrationResource added in v0.5.0

type IntegrationResource struct {
	Type string
	Name string
	ID   string
}

type IntegrationSecret added in v0.5.0

type IntegrationSecret struct {
	Name  string
	Value []byte
}

type IntegrationSecretDefinition added in v0.19.0

type IntegrationSecretDefinition struct {
	Name        string
	Label       string
	Description string
	Value       string
	Editable    bool
}

type IntegrationSecretStorage added in v0.19.0

type IntegrationSecretStorage interface {
	IntegrationSecretStorageReader

	Delete(name string) error
	Create(def IntegrationSecretDefinition) error
	CreateMany(defs []IntegrationSecretDefinition) error
	Update(name string, value string) error
}

* Secrets are sensitive information managed by the integration. * In some cases, this comes from the user, as a step input. * In other cases, this comes from the setup flow itself. * Secrets can be editable or not. If they are editable, OnSecretUpdate() is called when the user updates it. * * This is context that the integration receives as part of the setup flow for managing them.

type IntegrationSecretStorageReader added in v0.19.0

type IntegrationSecretStorageReader interface {
	Get(name string) (string, error)
}

type IntegrationSetupContext added in v0.20.0

type IntegrationSetupContext interface {
	SetStep(step SetupStep) error
}

* IntegrationSetupContext allows integrations to manage setup state * from outside the setup flow (e.g. from an HTTP request handler).

type IntegrationSetupProvider added in v0.19.0

type IntegrationSetupProvider interface {

	//
	// All the capabilities supported by the integration.
	// The grouping is a presentation matter, and per-integration states
	// are still tracked per capability.
	//
	CapabilityGroups() []CapabilityGroup

	//
	// Generate the first step of the setup flow.
	//
	FirstStep(ctx SetupStepContext) SetupStep

	//
	// Called when the user submits the current pending step.
	//
	OnStepSubmit(ctx SetupStepContext) (*SetupStep, error)

	//
	// Called when the user reverts the last successfully submitted step.
	//
	OnStepRevert(ctx SetupStepContext) error

	//
	// Called when the user updates a property.
	// A property update might trigger a new setup flow.
	//
	OnPropertyUpdate(ctx PropertyUpdateContext) (*SetupStep, error)

	//
	// Called when the user updates a secret.
	// A secret update might trigger a new setup flow.
	//
	OnSecretUpdate(ctx SecretUpdateContext) (*SetupStep, error)

	//
	// Called when the user requests new capabilities
	// from an already setup integration.
	//
	OnCapabilityUpdate(ctx CapabilityUpdateContext) (*SetupStep, error)
}

* IntegrationSetupProvider is the contract for an integration to provide its setup flow. * Any changes to this interface should be documented in docs/design/integration-setup-flow.md.

type IntegrationSubscriptionContext added in v0.5.0

type IntegrationSubscriptionContext interface {
	Configuration() any
	SendMessage(any) error
}

type IntegrationTrigger added in v0.5.0

type IntegrationTrigger interface {

	/*
	 * Inherits all the methods from Trigger interface,
	 * and adds a couple more, which are only applicable to integration triggers.
	 */
	Trigger

	OnIntegrationMessage(ctx IntegrationMessageContext) error
}

type ListResourcesContext added in v0.0.43

type ListResourcesContext struct {
	Logger      *logrus.Entry
	HTTP        HTTPContext
	Integration IntegrationContext
	Parameters  map[string]string
}

type MetadataReader added in v0.17.0

type MetadataReader interface {
	Get() any
}

* Metadata is arbitrary data that can be stored for nodes and executions. * MetadataReader allows components to read metadata from a node or execution.

type MetadataWriter added in v0.17.0

type MetadataWriter interface {
	MetadataReader
	Set(any) error
}

* MetadataWriter allows components to write metadata to a node or execution. * It inherits from MetadataReader to allow components to read metadata as well.

type Node added in v0.16.0

type Node struct {
	ID string `mapstructure:"id" json:"id"`
}

type NodeWebhookContext added in v0.0.30

type NodeWebhookContext interface {
	Setup() (string, error)
	GetSecret() ([]byte, error)
	SetSecret(secret []byte) error
	ResetSecret() ([]byte, []byte, error)
	GetBaseURL() string
}

type NotificationContext added in v0.0.43

type NotificationContext interface {
	Send(title, body, url, urlLabel string, receivers NotificationReceivers) error
	IsAvailable() bool
}

type NotificationReceivers added in v0.0.43

type NotificationReceivers struct {
	Emails []string
	Groups []string
	Roles  []string
}

type OutputChannel

type OutputChannel struct {
	Name        string
	Label       string
	Description string
}

type ProcessQueueContext

type ProcessQueueContext struct {
	WorkflowID    string
	NodeID        string
	RootEventID   string
	EventID       string
	SourceNodeID  string
	Configuration any
	Input         any
	Expressions   ExpressionContext

	//
	// Deletes the queue item
	//
	DequeueItem func() error

	//
	// Updates the state of the node
	//
	UpdateNodeState func(state string) error

	//
	// Creates a pending execution for this queue item.
	//
	CreateExecution func() (*ExecutionContext, error)

	//
	// Finds an execution by a key-value pair.
	// Returns an ExecutionContext.
	//
	FindExecutionByKV func(key string, value string) (*ExecutionContext, error)

	//
	// DefaultProcessing performs the default processing for the queue item.
	// Convenience method to avoid boilerplate in components that just want default behavior,
	// where an execution is created and the item is dequeued.
	//
	DefaultProcessing func() (*uuid.UUID, error)

	//
	// DistinctIncomingSources returns the distinct upstream
	// source nodes connected to this node (ignoring multiple channels from the
	// same source)
	//
	DistinctIncomingSources func() ([]Node, error)
}

* ProcessQueueContext is provided to components to process a node's queue item. * It mirrors the data the queue worker would otherwise use to create executions.

type PropertyUpdateContext added in v0.19.0

type PropertyUpdateContext struct {
	PropertyName string
	Value        string
	Logger       *log.Entry
	HTTP         HTTPContext
	Secrets      IntegrationSecretStorage
	Properties   IntegrationPropertyStorage
	Capabilities CapabilityContext
}

type RedirectPrompt added in v0.19.0

type RedirectPrompt struct {
	URL      string
	Method   string
	FormData map[string]string
}

type RequestContext

type RequestContext interface {

	//
	// Allows the scheduling of a certain component action at a later time
	//
	ScheduleActionCall(actionName string, parameters map[string]any, interval time.Duration) error
}

* RequestContext allows the execution to schedule * work with the processing engine.

type RoleRef added in v0.16.0

type RoleRef struct {
	Name        string `mapstructure:"name" json:"name"`
	DisplayName string `mapstructure:"displayName" json:"displayName"`
}

type SecretUpdateContext added in v0.19.0

type SecretUpdateContext struct {
	SecretName   string
	Value        string
	Logger       *log.Entry
	HTTP         HTTPContext
	Secrets      IntegrationSecretStorage
	Properties   IntegrationPropertyStorage
	Capabilities CapabilityContext
}

type SecretsContext added in v0.7.0

type SecretsContext interface {
	GetKey(secretName, keyName string) ([]byte, error)
}

type SetupContext

type SetupContext struct {
	Logger        *log.Entry
	Configuration any
	HTTP          HTTPContext
	Metadata      MetadataWriter
	Requests      RequestContext
	Auth          AuthReader
	Integration   IntegrationContext
	Webhook       NodeWebhookContext
}

* ExecutionContext allows the component * to control the state and metadata of each execution of it.

type SetupStep added in v0.19.0

type SetupStep struct {
	Type           SetupStepType
	Name           string
	Label          string
	Instructions   string
	Inputs         []configuration.Field
	Capabilities   []string
	RedirectPrompt *RedirectPrompt
}

type SetupStepContext added in v0.19.0

type SetupStepContext struct {
	Step            StepInfo
	IntegrationID   uuid.UUID
	OrganizationID  string
	BaseURL         string
	WebhooksBaseURL string
	Logger          *log.Entry
	HTTP            HTTPContext
	Secrets         IntegrationSecretStorage
	Properties      IntegrationPropertyStorage
	Capabilities    CapabilityContext
}

type SetupStepType added in v0.19.0

type SetupStepType string
const (
	SetupStepTypeInputs              SetupStepType = "inputs"
	SetupStepTypeCapabilitySelection SetupStepType = "capabilitySelection"
	SetupStepTypeRedirectPrompt      SetupStepType = "redirectPrompt"
	SetupStepTypeDone                SetupStepType = "done"
)

type StepInfo added in v0.19.0

type StepInfo struct {
	Name         string
	Inputs       any
	Capabilities []string
}

type SyncContext

type SyncContext struct {
	Logger          *logrus.Entry
	Configuration   any
	BaseURL         string
	WebhooksBaseURL string
	OrganizationID  string
	HTTP            HTTPContext
	Integration     IntegrationContext
	OIDC            oidc.Provider
}

type Trigger

type Trigger interface {
	/*
	 * The unique identifier for the trigger.
	 * This is how nodes reference it, and is used for registration.
	 */
	Name() string

	/*
	 * The label for the trigger.
	 * This is how nodes are displayed in the UI.
	 */
	Label() string

	/*
	 * A good description of what the trigger does.
	 * Helpful for documentation and user interfaces.
	 */
	Description() string

	/*
	 * Detailed markdown documentation explaining how to use the trigger.
	 * This should provide in-depth information about the trigger's purpose,
	 * configuration options, use cases, and examples.
	 */
	Documentation() string

	/*
	 * The icon for the trigger.
	 */
	Icon() string

	/*
	 * The color for the trigger.
	 */
	Color() string

	/*
	 * Example input data for the trigger.
	 */
	ExampleData() map[string]any

	/*
	 * The configuration fields exposed by the trigger.
	 */
	Configuration() []configuration.Field

	/*
	 * Handler for webhooks
	 */
	HandleWebhook(ctx WebhookRequestContext) (int, *WebhookResponseBody, error)

	/*
	 * Setup the trigger.
	 */
	Setup(ctx TriggerContext) error

	/*
	 * Allows triggers to define custom hooks.
	 */
	Hooks() []Hook

	/*
	 * Execute a custom hook - defined in Hooks() for a trigger.
	 */
	HandleHook(ctx TriggerHookContext) (map[string]any, error)

	/*
	 * Cleanup allows triggers to clean up resources after being removed from a canvas.
	 * Default behavior does nothing. Triggers can override to perform cleanup.
	 */
	Cleanup(ctx TriggerContext) error
}

type TriggerContext

type TriggerContext struct {
	Logger        *log.Entry
	Configuration any
	HTTP          HTTPContext
	Metadata      MetadataWriter
	Requests      RequestContext
	Events        EventContext
	Webhook       NodeWebhookContext
	Integration   IntegrationContext
}

type TriggerHookContext added in v0.18.0

type TriggerHookContext struct {
	Name          string
	Parameters    map[string]any
	Configuration any
	Logger        *log.Entry
	HTTP          HTTPContext
	Metadata      MetadataWriter
	Requests      RequestContext
	Events        EventContext
	Webhook       NodeWebhookContext
	Integration   IntegrationContext
}

* Context for executing a trigger hook.

type User

type User struct {
	ID    string `mapstructure:"id" json:"id"`
	Name  string `mapstructure:"name" json:"name"`
	Email string `mapstructure:"email" json:"email"`
}

type WebhookContext

type WebhookContext interface {
	GetID() string
	GetURL() string
	GetSecret() ([]byte, error)
	GetMetadata() any
	GetConfiguration() any
	SetSecret([]byte) error
}

* WebhookContext allows implementations to read/manage Webhook records.

type WebhookHandler added in v0.7.0

type WebhookHandler interface {

	/*
	 * Set up webhooks through the integration, in the external system.
	 * This is called by the webhook provisioner, for pending webhook records.
	 */
	Setup(ctx WebhookHandlerContext) (any, error)

	/*
	 * Delete webhooks through the integration, in the external system.
	 * This is called by the webhook cleanup worker, for webhook records that were deleted.
	 */
	Cleanup(ctx WebhookHandlerContext) error

	/*
	 * Compare two webhook configurations to see if they are the same.
	 */
	CompareConfig(a, b any) (bool, error)

	/*
	 * Merge an existing webhook configuration with a requested one.
	 * Return changed=false when no update is needed.
	 */
	Merge(current, requested any) (merged any, changed bool, err error)
}

type WebhookHandlerContext added in v0.7.0

type WebhookHandlerContext struct {
	Logger      *logrus.Entry
	HTTP        HTTPContext
	Integration IntegrationContext
	Webhook     WebhookContext
}

type WebhookOptions

type WebhookOptions struct {
	ID            string
	URL           string
	Secret        []byte
	Configuration any
	Metadata      any
}

type WebhookRequestContext

type WebhookRequestContext struct {
	Body          []byte
	Headers       http.Header
	WorkflowID    string
	NodeID        string
	Configuration any
	Metadata      MetadataWriter
	Logger        *log.Entry
	Webhook       NodeWebhookContext
	Events        EventContext
	Integration   IntegrationContext

	//
	// Return an execution context for a given execution,
	// through a referencing key-value pair.
	//
	FindExecutionByKV func(key string, value string) (*ExecutionContext, error)

	// Do not make HTTP calls as part of handling the webhook. This is useful for
	// retrieving more data that is not part of the webhook payload.
	HTTP HTTPContext
}

type WebhookResponseBody added in v0.12.0

type WebhookResponseBody struct {
	Body        []byte
	ContentType string
}

WebhookResponseBody allows a HandleWebhook implementation to return a custom response body. If non-nil and Body is non-empty, the server writes it back to the caller instead of the default empty 200 OK.

type Widget added in v0.0.18

type Widget interface {

	/*
	 * The unique identifier for the widget.
	 * This is how nodes reference it, and is used for registration.
	 */
	Name() string

	/*
	 * The label for the widget.
	 * This is how nodes are displayed in the UI.
	 */
	Label() string

	/*
	 * A good description of what the widget does.
	 * Helpful for documentation and user interfaces.
	 */
	Description() string

	/*
	 * The icon for the widget.
	 */
	Icon() string

	/*
	 * The color for the widget.
	 */
	Color() string

	/*
	 * The configuration fields exposed by the widget.
	 */
	Configuration() []configuration.Field
}

* Widgets are used to represent every node not event or execution related. * Use it to display and group data in the UI canvas.

Jump to

Keyboard shortcuts

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