sdk

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// EnvironmentTest represents the test environment
	EnvironmentTest = core.EnvironmentTest
	// EnvironmentDebug represents the debug environment
	EnvironmentDebug = core.EnvironmentDebug
	// EnvironmentProd represents the production environment
	EnvironmentProd = core.EnvironmentProd
	EnvironmentDev  = core.EnvironmentDev
)
View Source
const (
	// FlowComponentTypeBranch represents a branching flow component
	FlowComponentTypeBranch = core.FlowComponentTypeBranch

	// FlowComponentTypeLoop represents a loop flow component
	FlowComponentTypeLoop = core.FlowComponentTypeLoop

	// FlowComponentTypeCondition represents a condition flow component
	FlowComponentTypeCondition = core.FlowComponentTypeCondition

	// FlowComponentTypeRouter represents a router flow component
	FlowComponentTypeRouter = core.FlowComponentTypeRouter

	// FlowComponentTypeApproval represents an approval flow component
	FlowComponentTypeApproval = core.FlowComponentTypeApproval

	// FlowComponentTypeDelay represents a delay flow component
	FlowComponentTypeDelay = core.FlowComponentTypeDelay

	// FlowComponentTypeSequential represents a delay flow component
	FlowComponentTypeSequential = core.FlowComponentTypeSequential

	// FlowComponentTypeSubflow represents a subflow flow component
	FlowComponentTypeSubflow = core.FlowComponentTypeSubflow

	FlowComponentTypeParallel = core.FlowComponentTypeParallel
)
View Source
const (
	// None indicates no authentication is required
	None = core.None

	// Basic indicates username and password authentication
	Basic = core.Basic

	// Secret indicates a shared secret or token authentication
	Secret = core.Secret

	// APIKey indicates API key authentication
	APIKey = core.APIKey

	// OAuth2 indicates OAuth 2.0 authentication
	OAuth2 = core.OAuth2

	// Custom indicates a custom authentication method
	Custom = core.Custom

	// JWT indicates JSON Web Token authentication
	JWT = core.JWT

	// ApiKeyHeader indicates an API key in the header
	ApiKeyHeader = core.ApiKeyHeader

	// ApiKeyQuery indicates an API key in the query string
	ApiKeyQuery = core.ApiKeyQuery

	// BearerToken indicates a bearer token authentication
	BearerToken = core.BearerToken

	// ClientCert indicates client certificate authentication
	ClientCert = core.ClientCert
)
View Source
const (
	// RouterTypeSwitch routes based on evaluating an expression and matching the result.
	RouterTypeSwitch = core.RouterTypeSwitch

	// RouterTypeCondition routes based on evaluating multiple conditions and taking the first match.
	RouterTypeCondition = core.RouterTypeCondition

	// RouterTypeMultiPath allows taking multiple paths if their conditions are true.
	RouterTypeMultiPath = core.RouterTypeMultiPath
)
View Source
const (
	// BranchModeExpression uses a JavaScript expression to determine the branch
	BranchModeExpression = core.RouteModeExpression

	// BranchModeCondition uses field-based condition matching
	BranchModeCondition = core.RouteModeCondition

	// BranchModeValue uses direct value matching
	BranchModeValue = core.RouteModeValue
)
View Source
const (
	// ActionTypeAction represents a standard action.
	ActionTypeAction = core.ActionTypeAction

	// ActionTypeBranch represents a branch action that can conditionally execute different paths.
	ActionTypeBranch = core.ActionTypeBranch

	// ActionTypeBoolean represents a boolean-conditional action.
	ActionTypeBoolean = core.ActionTypeBoolean

	// ActionTypeLoop represents a loop action.
	ActionTypeLoop = core.ActionTypeLoop

	// ActionTypeRouter represents a router action that can direct flow based on conditions.
	ActionTypeRouter = core.ActionTypeRouter

	ActionTypeApproval = core.ActionTypeApproval

	ActionTypeDelay = core.ActionTypeDelay

	ActionTypeSubflow = core.ActionTypeSubflow

	ActionTypeParallel = core.ActionTypeParallel
)
View Source
const (
	// TriggerTypeScheduled indicates a workflow triggered by a schedule
	TriggerTypeScheduled = core.TriggerTypeScheduled

	// TriggerTypeEvent indicates a workflow triggered by an event
	TriggerTypeEvent = core.TriggerTypeEvent

	TriggerTypePubsub = core.TriggerTypePubsub

	// TriggerTypePolling indicates a workflow triggered by polling for changes
	TriggerTypePolling = core.TriggerTypePolling

	// TriggerTypeWebhook indicates a workflow triggered by a webhook
	TriggerTypeWebhook = core.TriggerTypeWebhook

	// TriggerTypeManual indicates a workflow triggered manually by a user
	TriggerTypeManual = core.TriggerTypeManual

	// TriggerTypeAPI indicates a workflow triggered via the API
	TriggerTypeAPI = core.TriggerTypeAPI

	// TriggerTypeWorkflow indicates a workflow triggered by another workflow
	TriggerTypeWorkflow = core.TriggerTypeWorkflow

	// TriggerTypeMessage indicates a workflow triggered by a message
	TriggerTypeMessage = core.TriggerTypeMessage

	// TriggerTypeButton indicates a workflow triggered by a button click
	TriggerTypeButton = core.TriggerTypeButton
)

Variables

This section is empty.

Functions

func DownloadFile added in v0.11.0

func DownloadFile(url string) (*grab.Response, error)

DownloadFile downloads a file from the specified URL using the grab package. It returns the grab.Response object and an error if any.

func DynamicInputToType added in v0.11.0

func DynamicInputToType[T any](ctx sdkcontext.BaseContext) *T

DynamicInputToType converts the resolved input of type `sdkcore.DynamicOptionsContext` to the desired type T. It uses JSON marshaling and unmarshalling to perform the conversion. If any error occurs during marshaling or unmarshaling, it returns nil. The function returns a pointer to the converted value of type T.

func GetRelativePathWithDepth added in v0.11.0

func GetRelativePathWithDepth(relativePath string, depth int) (string, error)

GetRelativePathWithDepth resolves a file path relative to the location of the caller, with adjustable depth.

func InputPropsToType added in v0.11.0

func InputPropsToType[T any](input sdkcore.JSON) (*T, error)

InputPropsToType returns a pointer to a value of type T by marshaling and unmarshaling the ResolvedInput field of the provided RunContext struct. If there is an error during the marshaling or unmarshaling process, nil is returned. The function signature is as follows:

func InputToType added in v0.11.0

func InputToType[T any](ctx sdkcontext.BaseContext) *T

InputToType returns a pointer to a value of type T by marshaling and unmarshaling the ResolvedInput field of the provided RunContext struct. If there is an error during the marshaling or unmarshaling process, nil is returned. The function signature is as follows:

func InputToTypeSafely added in v0.11.0

func InputToTypeSafely[T any](ctx sdkcontext.BaseContext) (*T, error)

InputToTypeSafely returns a pointer to a value of type T by marshaling and unmarshaling the ResolvedInput field of the provided RunContext struct. If there is an error during the marshaling or unmarshaling process, nil is returned. The function signature is as follows:

func ReadREADME added in v0.11.0

func ReadREADME(content string) (string, error)

ReadREADME extracts the content of README.md from the current directory.

func StringToFile added in v0.11.0

func StringToFile(fileStr string) (*autoform.File, error)

StringToFile converts a file string to a *autoform.File object.

The function checks if the file string is a base64-encoded data or a URL. If the file string is base64-encoded data, it decodes the data and assigns it to the `Data` field of the

func WithDynamicFunctionCalling added in v0.11.0

func WithDynamicFunctionCalling(fn *DynamicOptionsFn) smartform.DynamicFunction

WithDynamicFunctionCalling wraps a DynamicOptionsFn into a smartform.DynamicFunction to execute dynamic field actions. If the provided function is nil or required arguments are missing in the call context, it returns nil.

Types

type APITriggerCriteria added in v0.11.3

type APITriggerCriteria = core.APITriggerCriteria

type Action

type Action interface {
	// Metadata returns metadata about the action
	Metadata() ActionMetadata

	// Properties returns the schema for the action's input configuration
	Properties() *smartform.FormSchema

	// Auth returns the authentication requirements for the action
	Auth() *core.AuthMetadata

	// Perform executes the action with the given context and input
	Perform(ctx context.PerformContext) (core.JSON, error)
}

Action defines the interface for workflow actions.

type ActionDefinition

type ActionDefinition struct {
	// Name is the unique identifier for this action within its integration
	Name string `json:"id"`

	// DisplayName is the human-readable name of the action
	DisplayName string `json:"displayName"`

	// Description provides details about the action's purpose
	Description string `json:"description"`

	// HelpText provides additional guidance for configuring the action
	HelpText string `json:"helpText,omitempty"`

	// Icon is a URL or base64-encoded image for the action icon
	Icon string `json:"icon,omitempty"`

	// Type specifies the action type (e.g., ACTION, BRANCH, BOOLEAN)
	Type core.ActionType `json:"type"`

	// Auth represents the authentication configuration required to perform the action, encapsulated in core.AuthMetadata.
	Auth *core.AuthMetadata `json:"auth"`

	// Documentation provides comprehensive usage instructions
	Documentation string `json:"documentation,omitempty"`

	// SampleOutput contains an example of the action's output
	SampleOutput core.JSON `json:"sampleOutput,omitempty"`

	Properties *smartform.FormSchema `json:"properties"`

	// Tags are searchable labels for the action
	Tags []string `json:"tags,omitempty"`

	// Implementation specifies the action implementation logic or function to be executed.
	Implementation Action `json:"-"`

	// Settings provides a settings for this action
	Settings core.ActionSettings `json:"settings"`
}

ActionDefinition contains metadata about an action.

type ActionError

type ActionError struct {
	// Code is a machine-readable error code
	Code string `json:"code"`

	// Message is a human-readable error message
	Message string `json:"message"`

	// Retryable indicates if the error is temporary and the action can be retried
	Retryable bool `json:"retryable"`

	// Details contains additional context for the error
	Details map[string]interface{} `json:"details,omitempty"`
}

ActionError represents a specific error that can occur during action execution.

type ActionFactory

type ActionFactory interface {
	// CreateAction creates an action instance based on type
	CreateAction(actionType core.ActionType, config map[string]interface{}) (Action, error)

	// RegisterActionCreator registers a function to create a specific action type
	RegisterActionCreator(actionType core.ActionType, creator func(config map[string]interface{}) (Action, error)) error

	// ListSupportedActionTypes returns all action types supported by this factory
	ListSupportedActionTypes() []core.ActionType
}

ActionFactory creates instances of actions.

type ActionMetadata

type ActionMetadata struct {
	// ID is the unique identifier for this action within its integration
	ID string `json:"id"`

	// DisplayName is the human-readable name of the action
	DisplayName string `json:"displayName"`

	// Description provides details about the action's purpose
	Description string `json:"description"`

	// HelpText provides additional guidance for configuring the action
	HelpText string `json:"helpText,omitempty"`

	// Icon is a URL or base64-encoded image for the action icon
	Icon string `json:"icon,omitempty"`

	// Type specifies the action type (e.g., ACTION, BRANCH, BOOLEAN)
	Type core.ActionType `json:"type"`

	// Documentation provides comprehensive usage instructions
	Documentation string `json:"documentation,omitempty"`

	// SampleOutput contains an example of the action's output
	SampleOutput core.JSON `json:"sampleOutput,omitempty"`

	// Tags are searchable labels for the action
	Tags []string `json:"tags,omitempty"`

	// Category provides a categorization for this action
	Category string `json:"category,omitempty"`

	// Settings returns action-specific settings
	Settings core.ActionSettings `json:"settings"`
}

ActionMetadata contains metadata about an action.

type ActionRegistry

type ActionRegistry interface {
	// RegisterAction adds an action to the registry
	RegisterAction(integrationID string, action Action) error

	// UnregisterAction removes an action from the registry
	UnregisterAction(integrationID string, actionID string) error

	// GetAction retrieves an action by integration ID and action ID
	GetAction(integrationID string, actionID string) (Action, error)

	// ListActions returns all registered actions
	ListActions() map[string][]Action

	// ListActionsByType returns actions of a specific type
	ListActionsByType(actionType core.ActionType) []Action

	// ListActionsByIntegration returns all actions for a specific integration
	ListActionsByIntegration(integrationID string) []Action

	// ListActionsByCategory returns actions in a specific category
	ListActionsByCategory(category string) []Action

	// SearchActions searches for actions matching criteria
	SearchActions(query string, filters map[string]interface{}) []Action
}

ActionRegistry manages action registration and discovery.

type ActionSettings added in v0.11.3

type ActionSettings = core.ActionSettings

type ActionType added in v0.11.3

type ActionType = core.ActionType

type Auth

type Auth interface {
	// Initialize starts an authentication flow
	Initialize(ctx context.Context, request AuthRequest) (*AuthResponse, error)

	// CompleteOAuth finishes an OAuth flow with a code from the OAuth provider
	CompleteOAuth(ctx context.Context, connectionID xid.ID, code string, state string) (*AuthResponse, error)

	// Refresh renews an authentication token
	Refresh(ctx context.Context, connectionID xid.ID) (*AuthResponse, error)

	// Revoke explicitly revokes an authentication connection
	Revoke(ctx context.Context, connectionID xid.ID) error

	// Validate checks if an authentication connection is valid
	Validate(ctx context.Context, connectionID xid.ID) (*AuthResponse, error)

	// GetConnection retrieves authentication connection details
	GetConnection(ctx context.Context, connectionID xid.ID) (*AuthResponse, error)

	// ListConnections retrieves all authentication connections for a project
	ListConnections(ctx context.Context, projectID xid.ID) ([]AuthResponse, error)

	// GetToken retrieves an OAuth token for use in API calls
	GetToken(ctx context.Context, connectionID xid.ID) (*oauth2.Token, error)

	// GetAuthContext retrieves the auth context for use in integration operations
	GetAuthContext(ctx context.Context, connectionID xid.ID) (*wakcontext.AuthContext, error)

	// CreateAuthenticatedClient creates an HTTP client with authentication credentials
	CreateAuthenticatedClient(ctx context.Context, connectionID xid.ID) (*http.Client, error)
}

Auth defines the interface for authentication operations.

type AuthConnectionStatus

type AuthConnectionStatus string

AuthConnectionStatus represents the status of an authentication connection.

const (
	// AuthStatusPending indicates the authentication flow has been initiated but not completed.
	AuthStatusPending AuthConnectionStatus = "pending"

	// AuthStatusActive indicates the authentication is active and usable.
	AuthStatusActive AuthConnectionStatus = "active"

	// AuthStatusExpired indicates the authentication has expired and needs renewal.
	AuthStatusExpired AuthConnectionStatus = "expired"

	// AuthStatusRevoked indicates the authentication has been explicitly revoked.
	AuthStatusRevoked AuthConnectionStatus = "revoked"

	// AuthStatusFailed indicates the authentication attempt failed.
	AuthStatusFailed AuthConnectionStatus = "failed"
)

type AuthContext added in v0.11.3

type AuthContext = context.AuthContext

type AuthMetadata added in v0.11.3

type AuthMetadata = core.AuthMetadata

type AuthRequest

type AuthRequest struct {
	// IntegrationID is the identifier for the integration requiring authentication
	IntegrationID string `json:"integrationId"`

	// ProjectID is the identifier for the project this authentication belongs to
	ProjectID xid.ID `json:"projectId"`

	// UserID is the identifier for the user initiating the authentication
	UserID xid.ID `json:"userId,omitempty"`

	// Type specifies the authentication method to use
	Type core.AuthType `json:"type"`

	// ConnectionName is a user-defined name for this connection
	ConnectionName string `json:"connectionName"`

	// Credentials contains authentication credentials (for non-OAuth flows)
	Credentials map[string]interface{} `json:"credentials,omitempty"`

	// Metadata contains additional information about this authentication
	Metadata map[string]interface{} `json:"metadata,omitempty"`

	// RedirectURL is where to redirect after OAuth authentication
	RedirectURL string `json:"redirectUrl,omitempty"`

	// Scopes contains the OAuth scopes to request
	Scopes []string `json:"scopes,omitempty"`
}

AuthRequest represents a request to initialize an authentication flow.

type AuthResponse

type AuthResponse struct {
	// ConnectionID is the unique identifier for this authentication connection
	ConnectionID xid.ID `json:"connectionId"`

	// Status indicates the current status of this connection
	Status AuthConnectionStatus `json:"status"`

	// Type indicates the authentication method used
	Type core.AuthType `json:"type"`

	// ExpiresAt indicates when this authentication expires (if applicable)
	ExpiresAt *time.Time `json:"expiresAt,omitempty"`

	// Message contains additional information about the authentication result
	Message string `json:"message,omitempty"`

	// AuthorizationURL is the URL to redirect to for OAuth flows
	AuthorizationURL string `json:"authorizationUrl,omitempty"`

	// ConnectionDetails contains details about the connection (sanitized for display)
	ConnectionDetails map[string]interface{} `json:"connectionDetails,omitempty"`
}

AuthResponse represents the result of an authentication flow.

type AuthType added in v0.11.3

type AuthType = core.AuthType

type BaseContext added in v0.11.3

type BaseContext = context.BaseContext

type BranchMode added in v0.11.3

type BranchMode = core.RouteMode

type BranchSettings added in v0.11.3

type BranchSettings = core.BranchSettings

type DynamicFieldContext added in v0.11.3

type DynamicFieldContext = context.DynamicFieldContext

type DynamicIntegrationLoader

type DynamicIntegrationLoader interface {
	// LoadIntegration loads an integration from a file or URL
	LoadIntegration(ctx context.Context, source string) (*IntegrationDefinition, error)

	// ValidateIntegration checks if an integration package is valid
	ValidateIntegration(ctx context.Context, source string) (bool, error)

	// GetIntegrationDefinition extracts metadata from an integration package
	GetIntegrationDefinition(ctx context.Context, source string) (*IntegrationDefinition, error)

	// GetIntegrationMetadata extracts metadata from an integration package
	GetIntegrationMetadata(ctx context.Context, source string) (*IntegrationMetadata, error)

	// ExtractIntegration extracts and validates integration data from the given path and returns its identifier or an error.
	ExtractIntegration(ctx context.Context, path string) (string, error)

	// RegisterIntegration loads and registers an integration with the registry
	RegisterIntegration(ctx context.Context, source string, registry IntegrationRegistry) error
}

DynamicIntegrationLoader loads integrations from external sources.

type DynamicOptionsFilterParams added in v0.11.3

type DynamicOptionsFilterParams = core.DynamicOptionsFilterParams

type DynamicOptionsFn added in v0.11.0

type DynamicOptionsFn = func(ctx sdkcontext.DynamicFieldContext) (*core.DynamicOptionsResponse, error)

DynamicOptionsFn defines a function type that processes a DynamicFieldContext and returns a DynamicOptionsResponse or an error.

type DynamicOptionsResponse added in v0.11.3

type DynamicOptionsResponse = core.DynamicOptionsResponse

type Environment added in v0.11.3

type Environment = core.Environment

type EventTriggerCriteria added in v0.11.3

type EventTriggerCriteria = core.EventTriggerCriteria

type ExecuteContext added in v0.11.3

type ExecuteContext = context.ExecuteContext

type FieldType added in v0.11.0

type FieldType string

FieldType represents a string-based type used for categorizing various kinds of fields in the system.

const (
	FieldTypeCondition         FieldType = "condition"
	FieldTypeEnhancedCondition FieldType = "enhanced_condition"
	FieldTypeMap               FieldType = "map"
	FieldTypeKeyValue          FieldType = "keyvalue"
	FieldTypeKeyCode           FieldType = "code"
	FieldTypeKeyIDECode        FieldType = "ide_code"
	FieldTypeBranch            FieldType = "branch"
	FieldTypeRouter            FieldType = "router"
)

FieldTypeCondition represents a condition type field. FieldTypeEnhancedCondition represents an enhanced condition type field. FieldTypeMap represents a map type field. FieldTypeKeyValue represents a key-value type field. FieldTypeKeyCode represents a code type field. FieldTypeKeyIDECode represents an IDE code type field. FieldTypeBranch represents a branch type field. FieldTypeRouter represents a router type field.

func (FieldType) String added in v0.11.0

func (t FieldType) String() string

String converts the FieldType value to its string representation.

type FlowComponentType added in v0.11.3

type FlowComponentType = core.FlowComponentType

type FlowRouter added in v0.11.3

type FlowRouter = core.FlowRouter

type Heartbeat added in v0.11.3

type Heartbeat = worker.Heartbeat

type HeartbeatOptions added in v0.11.3

type HeartbeatOptions = worker.HeartbeatOptions

type HeartbeatStatus added in v0.11.3

type HeartbeatStatus = worker.HeartbeatStatus

type Integration

type Integration interface {
	// Metadata returns metadata about the integration
	Metadata() IntegrationMetadata

	// Auth returns the authentication requirements for the integration
	Auth() *core.AuthMetadata

	// Triggers returns all triggers provided by this integration
	Triggers() []Trigger

	// Actions returns all actions provided by this integration
	Actions() []Action
}

Integration defines the interface for integration plugins.

func Register added in v0.11.0

func Register(integration Integration) Integration

type IntegrationBuildMetadata added in v0.11.3

type IntegrationBuildMetadata = core.IntegrationBuildMetadata

type IntegrationDefinition

type IntegrationDefinition struct {
	IntegrationMetadata

	ID            string                        `json:"id"`
	DisplayName   string                        `json:"displayName"`
	Actions       map[string]*ActionDefinition  `json:"actions"`
	Triggers      map[string]*TriggerDefinition `json:"triggers"`
	Auth          *core.AuthMetadata            `json:"auth"`
	Metadata      IntegrationMetadata           `json:"metadata"`
	BuildMetadata core.IntegrationBuildMetadata `json:"buildMetadata"`
	License       *string                       `json:"license"`
	Copyright     *string                       `json:"copyright"`
	LicenseURL    *string                       `json:"licenseUrl"`
	CopyrightURL  *string                       `json:"copyrightUrl"`
	Source        *string                       `json:"source"`

	Implementation Integration `json:"-"`
}

IntegrationDefinition represents the definition of an integration

type IntegrationLanguage added in v0.11.3

type IntegrationLanguage = core.IntegrationLanguage

type IntegrationMetadata

type IntegrationMetadata struct {
	// Name is the human-readable name of the integration
	Name string `json:"name" toml:"name" yaml:"name" validate:"required"`

	// Description provides details about the integration's purpose
	Description string `json:"description" toml:"description"  yaml:"description" validate:"required"`

	// Type categorizes the integration functionality
	Type IntegrationType `json:"type"`

	FlowType core.FlowComponentType

	// Version is the semantic version of the integration
	Version string `json:"version" toml:"version" yaml:"version" validate:"required"`

	// Icon is a URL or base64-encoded image for the integration icon
	Icon string `json:"icon" toml:"icon" yaml:"icon" validate:"required"`

	// Publisher identifies who created the integration
	Authors []string `json:"authors" toml:"authors" yaml:"authors" validate:"required"`

	// Website is the URL to the integration's documentation or website
	Website string `json:"website" toml:"website" yaml:"website"`

	// Category provides a more specific categorization
	Categories []string `json:"categories" toml:"categories" yaml:"categories" validate:"required"`

	// Tags are searchable labels for the integration
	Tags []string `json:"tags,omitempty" toml:"tags,omitempty" yaml:"tags,omitempty"`

	// ReleaseNotes documents changes in this version
	ReleaseNotes string `json:"releaseNotes,omitempty"`

	// Documentation provides comprehensive usage instructions
	Documentation string `json:"documentation,omitempty"`
}

IntegrationMetadata contains metadata about an integration.

func LoadMetadataFromFlo added in v0.11.0

func LoadMetadataFromFlo(flo string, readme string) IntegrationMetadata

func ReadFloFile added in v0.11.0

func ReadFloFile(content string) (*IntegrationMetadata, error)

func (*IntegrationMetadata) LoadFromFlo added in v0.11.0

func (i *IntegrationMetadata) LoadFromFlo(flo string, readme string)

type IntegrationPlatform added in v0.11.3

type IntegrationPlatform = core.IntegrationPlatform

type IntegrationRegistry

type IntegrationRegistry interface {
	// RegisterIntegration adds an integration to the registry
	RegisterIntegration(integration Integration) error

	// RegisterIntegrationDefinition adds an integration to the registry
	RegisterIntegrationDefinition(integration IntegrationDefinition) error

	// UnregisterIntegration removes an integration from the registry
	UnregisterIntegration(name string, version string) error

	// GetIntegration retrieves a specific version of an integration by its name and version from the registry.
	GetIntegration(ctx context.Context, name string, version string) (Integration, error)

	// GetIntegrationDefinition retrieves a specific version of an integration by its name and version from the registry.
	GetIntegrationDefinition(ctx context.Context, name string, version string) (*IntegrationDefinition, error)

	// GetLatestIntegration retrieves the latest version of an integration
	GetLatestIntegration(ctx context.Context, name string) (*IntegrationDefinition, error)

	// ListIntegrations returns all registered integrations
	ListIntegrations() []*IntegrationDefinition

	// ListIntegrationsByType returns integrations of a specific type
	ListIntegrationsByType(integrationType IntegrationType) []*IntegrationDefinition

	// ListIntegrationVersions returns all versions of an integration
	ListIntegrationVersions(ctx context.Context, name string) ([]*IntegrationDefinition, error)

	// GetIntegrationMetadata retrieves metadata for a specific integration given its name and version. It returns the metadata or an error.
	GetIntegrationMetadata(ctx context.Context, name string, version string) (*IntegrationMetadata, error)

	RegisterActionDefinition(
		ctx context.Context,
		integrationName string,
		version string,
		actionID string,
		action ActionDefinition,
	) error

	RegisterTriggerDefinition(
		ctx context.Context,
		integrationName string,
		version string,
		triggerID string,
		trigger TriggerDefinition,
	) error

	RegisterAction(
		ctx context.Context,
		integrationName string,
		version string,
		actionID string,
		action Action,
	) error

	RegisterTrigger(
		ctx context.Context,
		integrationName string,
		version string,
		triggerID string,
		trigger Trigger,
	) error

	// GetAction retrieves an action by integration ID and action ID
	GetAction(integrationID, version, actionID string) (*ActionDefinition, error)

	LoadIntegrationsFromRegistrar(ctx context.Context, reg IntegrationsRegistrar) error

	// GetTrigger retrieves a trigger by integration ID and trigger ID
	GetTrigger(integrationID, version, actionID string) (*TriggerDefinition, error)

	// ListActions returns all actions for an integration version
	ListActions(
		ctx context.Context,
		integrationName string,
		version string,
	) (map[string]*ActionDefinition, error)

	// ListTriggers returns all triggers for an integration version
	ListTriggers(
		ctx context.Context,
		integrationName string,
		version string,
	) (map[string]*TriggerDefinition, error)

	// ListAllActions returns all registered actions across all integrations
	ListAllActions(ctx context.Context) map[string]map[string]map[string]*ActionDefinition

	// ListAllTriggers returns all registered triggers across all integrations
	ListAllTriggers(ctx context.Context) map[string]map[string]map[string]*TriggerDefinition

	// Initialize initializes all registered integrations
	Initialize(ctx context.Context) error

	// Shutdown performs cleanup for all registered integrations
	Shutdown(ctx context.Context) error
}

IntegrationRegistry manages available integrations.

type IntegrationSchemaModel added in v0.11.0

type IntegrationSchemaModel struct {
	Name        string   `json:"name" toml:"name" yaml:"name" validate:"required"`
	Description string   `json:"description" toml:"description"  yaml:"description" validate:"required"`
	Version     string   `json:"version" toml:"version" yaml:"version" validate:"required"`
	Authors     []string `json:"authors" toml:"authors" yaml:"authors" validate:"required"`
	Website     *string  `json:"website" toml:"website" yaml:"website"`
	Categories  []string `json:"categories" toml:"categories" yaml:"categories" validate:"required"`
	Icon        string   `json:"icon" toml:"icon" yaml:"icon" validate:"required"`
}

type IntegrationType

type IntegrationType string

IntegrationType defines the type of integration

const (
	// IntegrationTypeStandard represents a standard integration
	IntegrationTypeStandard IntegrationType = "STANDARD"

	// IntegrationTypeFlow represents a flow control integration
	IntegrationTypeFlow IntegrationType = "FLOW"

	// IntegrationTypeInternal represents an internal system integration
	IntegrationTypeInternal IntegrationType = "INTERNAL"

	// IntegrationTypeCustom represents a custom user-defined integration
	IntegrationTypeCustom IntegrationType = "CUSTOM"
)

func (IntegrationType) GormDataType added in v0.11.0

func (IntegrationType) GormDataType() string

GormDataType defines the data type for GORM.

func (IntegrationType) MarshalJSON added in v0.11.0

func (i IntegrationType) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (IntegrationType) MarshalText added in v0.11.0

func (i IntegrationType) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface

func (*IntegrationType) Scan added in v0.11.0

func (i *IntegrationType) Scan(value interface{}) error

Scan implements the sql.Scanner interface

func (IntegrationType) String added in v0.11.0

func (i IntegrationType) String() string

String returns the string representation of IntegrationType

func (*IntegrationType) UnmarshalJSON added in v0.11.0

func (i *IntegrationType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler interface.

func (*IntegrationType) UnmarshalText added in v0.11.0

func (i *IntegrationType) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface

func (IntegrationType) Value added in v0.11.0

func (i IntegrationType) Value() (driver.Value, error)

Value implements the driver.Valuer interface

func (IntegrationType) Values added in v0.11.0

func (IntegrationType) Values() []string

Values provides list valid values for Enum

type IntegrationsRegistrar added in v0.11.0

type IntegrationsRegistrar = map[string]RegistrationMap

type JSON added in v0.11.3

type JSON = core.JSON

type JSONObject added in v0.11.3

type JSONObject = core.JSONObject

type LifecycleContext added in v0.11.3

type LifecycleContext = context.LifecycleContext

type LogBuilder added in v0.11.3

type LogBuilder = core.LogBuilder

type LogEntry added in v0.11.3

type LogEntry = core.LogEntry

type LogLevel added in v0.11.3

type LogLevel = core.LogLevel

type LogLine added in v0.11.3

type LogLine = core.LogLine

type LogLineLevel added in v0.11.3

type LogLineLevel = core.LogLineLevel

type LogSink added in v0.11.3

type LogSink = core.LogSink

type Logger added in v0.11.3

type Logger = core.Logger

type ManualTriggerCriteria added in v0.11.3

type ManualTriggerCriteria = core.ManualTriggerCriteria

type MessageTriggerCriteria added in v0.11.3

type MessageTriggerCriteria = core.MessageTriggerCriteria

type NoopLogger added in v0.11.3

type NoopLogger = core.NoopLogger

type OffsetPaginationMeta added in v0.11.3

type OffsetPaginationMeta = core.OffsetPaginationMeta

type PerformContext added in v0.11.3

type PerformContext = context.PerformContext

type PollingTriggerCriteria added in v0.11.3

type PollingTriggerCriteria = core.PollingTriggerCriteria

type Registration added in v0.11.3

type Registration = worker.Registration

type RegistrationInfo added in v0.11.3

type RegistrationInfo = worker.RegistrationInfo

type RegistrationMap added in v0.11.0

type RegistrationMap struct {
	Versions map[string]Integration
}

type RetryPolicy added in v0.11.3

type RetryPolicy = core.RetryPolicy

type RouterSettings added in v0.11.3

type RouterSettings = core.RouterSettings

type RouterType added in v0.11.3

type RouterType = core.RouterType

type ScheduleTriggerCriteria added in v0.11.3

type ScheduleTriggerCriteria = core.ScheduleTriggerCriteria

type SchemaConfig added in v0.11.0

type SchemaConfig struct {
	Integration IntegrationMetadata `json:"integration" toml:"integration" yaml:"integration" validate:"required"`
}

type Specialization added in v0.11.3

type Specialization = worker.Specialization

type SpecializationCapability added in v0.11.3

type SpecializationCapability = worker.SpecializationCapability

type SpecializationMatch added in v0.11.3

type SpecializationMatch = worker.SpecializationMatch

type SpecializationRequirement added in v0.11.3

type SpecializationRequirement = worker.SpecializationRequirement

type SpecializationType added in v0.11.3

type SpecializationType = worker.SpecializationType
const (
	SpecializationTypeIntegration SpecializationType = worker.SpecializationTypeIntegration
	SpecializationTypeWorkflow    SpecializationType = worker.SpecializationTypeWorkflow
	SpecializationTypeRegion      SpecializationType = worker.SpecializationTypeRegion
	SpecializationTypeProject     SpecializationType = worker.SpecializationTypeProject
)

type StepRunStatus added in v0.11.3

type StepRunStatus = core.StepRunStatus

StepRunStatus represents the status of a step run.

const (
	// StepRunStatusPending indicates a step is queued to run but hasn't started
	StepRunStatusPending StepRunStatus = core.StepRunStatusPending

	// StepRunStatusPaused indicates a step is paused and waiting for manual continuation
	StepRunStatusPaused StepRunStatus = core.StepRunStatusPaused

	// StepRunStatusRunning indicates a step is currently executing
	StepRunStatusRunning StepRunStatus = core.StepRunStatusRunning

	// StepRunStatusCompleted indicates a step has completed successfully
	StepRunStatusCompleted StepRunStatus = core.StepRunStatusCompleted

	// StepRunStatusFailed indicates a step has failed
	StepRunStatusFailed StepRunStatus = core.StepRunStatusFailed

	// StepRunStatusCancelled indicates a step was manually cancelled
	StepRunStatusCancelled StepRunStatus = core.StepRunStatusCancelled

	// StepRunStatusSkipped indicates a step was skipped due to conditions or branching
	StepRunStatusSkipped StepRunStatus = core.StepRunStatusSkipped

	// StepRunStatusTimeout indicates a step exceeded its allowed execution time
	StepRunStatusTimeout StepRunStatus = core.StepRunStatusTimeout

	// StepRunStatusWaiting indicates a step is waiting for an external event or condition
	StepRunStatusWaiting StepRunStatus = core.StepRunStatusWaiting

	// StepRunStatusBlocked indicates a step is blocked by a dependency or condition
	StepRunStatusBlocked StepRunStatus = core.StepRunStatusBlocked

	// StepRunStatusApproved indicates a step has been manually approved
	StepRunStatusApproved StepRunStatus = core.StepRunStatusApproved

	// StepRunStatusRejected indicates a step was manually rejected
	StepRunStatusRejected StepRunStatus = core.StepRunStatusRejected

	StepRunStatusRetrying StepRunStatus = core.StepRunStatusRetrying
)

Enum values for StepRunStatus.

type SystemActivityLog added in v0.11.3

type SystemActivityLog = core.SystemActivityLog

type SystemActivityLogs added in v0.11.3

type SystemActivityLogs = core.SystemActivityLogs

type Trigger

type Trigger interface {
	// Metadata returns metadata about the trigger
	Metadata() TriggerMetadata

	// Props returns the schema for the trigger's input configuration
	Props() *smartform.FormSchema

	// Auth returns the authentication requirements for the trigger
	Auth() *core.AuthMetadata

	// Start prepares and activates the trigger (e.g., start polling, event listening, cron schedules)
	Start(ctx context.LifecycleContext) error

	// Stop gracefully stops or disables the trigger
	Stop(ctx context.LifecycleContext) error

	// Execute handles the trigger's action when manually invoked with an input schema
	Execute(ctx context.ExecuteContext) (core.JSON, error)
}

Trigger defines the interface for workflow triggers.

type TriggerCriteria added in v0.11.3

type TriggerCriteria = core.TriggerCriteria

type TriggerDefinition

type TriggerDefinition struct {
	// ID is the unique identifier for this trigger within its integration
	Name string `json:"name"`

	// DisplayName is the human-readable name of the trigger
	DisplayName string `json:"displayName"`

	// Description provides details about the trigger's purpose
	Description string `json:"description"`

	// HelpText provides additional guidance for configuring the trigger
	HelpText string `json:"helpText,omitempty"`

	// Icon is a URL or base64-encoded image for the trigger icon
	Icon string `json:"icon,omitempty"`

	// Type specifies the trigger type (e.g., POLLING, WEBHOOK)
	Type core.TriggerType `json:"type"`

	// Auth represents the authentication configuration required to perform the action, encapsulated in core.AuthMetadata.
	Auth *core.AuthMetadata `json:"auth"`

	// Documentation provides comprehensive usage instructions
	Documentation string `json:"documentation,omitempty"`

	// SampleOutput contains an example of the trigger's output
	SampleOutput core.JSON `json:"sampleOutput,omitempty"`

	// Properties defines the schema for additional configuration required for the trigger in the form of a smartform.
	Properties *smartform.FormSchema `json:"properties"`

	// Settings provides a settings for this trigger
	Settings core.TriggerSettings `json:"settings"`

	// Implementation specifies the action implementation logic or function to be executed.
	Implementation Trigger `json:"-"`
}

TriggerDefinition contains metadata about a trigger.

type TriggerFactory

type TriggerFactory interface {
	// CreateTrigger creates a trigger instance based on type
	CreateTrigger(triggerType core.TriggerType, config map[string]interface{}) (Trigger, error)

	// RegisterTriggerCreator registers a function to create a specific trigger type
	RegisterTriggerCreator(triggerType core.TriggerType, creator func(config map[string]interface{}) (Trigger, error)) error

	// ListSupportedTriggerTypes returns all trigger types supported by this factory
	ListSupportedTriggerTypes() []core.TriggerType
}

TriggerFactory creates instances of triggers.

type TriggerMetadata

type TriggerMetadata struct {
	// ID is the unique identifier for this trigger within its integration
	ID string `json:"id"`

	// DisplayName is the human-readable name of the trigger
	DisplayName string `json:"displayName"`

	// Description provides details about the trigger's purpose
	Description string `json:"description"`

	// HelpText provides additional guidance for configuring the trigger
	HelpText string `json:"helpText,omitempty"`

	// Icon is a URL or base64-encoded image for the trigger icon
	Icon string `json:"icon,omitempty"`

	// Type specifies the trigger type (e.g., POLLING, WEBHOOK)
	Type core.TriggerType `json:"type"`

	// Documentation provides comprehensive usage instructions
	Documentation string `json:"documentation,omitempty"`

	// SampleOutput contains an example of the trigger's output
	SampleOutput core.JSON `json:"sampleOutput,omitempty"`

	// Criteria returns additional trigger criteria configuration
	Criteria *core.TriggerCriteria `json:"criteria"`
}

TriggerMetadata contains metadata about a trigger.

type TriggerRegistry

type TriggerRegistry interface {
	// RegisterTrigger adds a trigger to the registry
	RegisterTrigger(integrationID string, trigger Trigger) error

	// UnregisterTrigger removes a trigger from the registry
	UnregisterTrigger(integrationID string, triggerID string) error

	// GetTrigger retrieves a trigger by integration ID and trigger ID
	GetTrigger(integrationID string, triggerID string) (Trigger, error)

	// ListTriggers returns all registered triggers
	ListTriggers() map[string][]Trigger

	// ListTriggersByType returns triggers of a specific type
	ListTriggersByType(triggerType core.TriggerType) []Trigger

	// ListTriggersByIntegration returns all triggers for a specific integration
	ListTriggersByIntegration(integrationID string) []Trigger
}

TriggerRegistry manages trigger registration and discovery.

type TriggerSettings added in v0.11.3

type TriggerSettings = core.TriggerSettings

type TriggerType added in v0.11.3

type TriggerType = core.TriggerType

type WebhookTriggerCriteria added in v0.11.3

type WebhookTriggerCriteria = core.WebhookTriggerCriteria

type WorkerMetadata added in v0.11.3

type WorkerMetadata = worker.WorkerMetadata

type WorkerStatus added in v0.11.3

type WorkerStatus = worker.WorkerStatus
const (
	// WorkerStatusIdle indicates the worker is available but not processing any tasks.
	WorkerStatusIdle WorkerStatus = worker.WorkerStatusIdle

	// WorkerStatusBusy indicates the worker is currently processing tasks.
	WorkerStatusBusy WorkerStatus = worker.WorkerStatusBusy

	WorkerStatusOffline = worker.WorkerStatusOffline

	// WorkerStatusStarting indicates the worker is in the process of starting up.
	WorkerStatusStarting WorkerStatus = worker.WorkerStatusStarting

	// WorkerStatusStopping indicates the worker is in the process of shutting down.
	WorkerStatusStopping WorkerStatus = worker.WorkerStatusStopping

	// WorkerStatusError indicates the worker has encountered an error.
	WorkerStatusError WorkerStatus = worker.WorkerStatusError

	// WorkerStatusMaintenance indicates the worker is in maintenance mode.
	WorkerStatusMaintenance WorkerStatus = worker.WorkerStatusMaintenance

	// WorkerStatusOnline indicates the worker is available and actively connected.
	WorkerStatusOnline WorkerStatus = worker.WorkerStatusOnline

	// WorkerStatusDraining indicates the worker is completing current tasks and not accepting new ones.
	WorkerStatusDraining WorkerStatus = worker.WorkerStatusDraining
)

type WorkflowTriggerCriteria added in v0.11.3

type WorkflowTriggerCriteria = core.WorkflowTriggerCriteria

type WriteLogLineOpts added in v0.11.3

type WriteLogLineOpts = core.WriteLogLineOpts

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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