registry

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Timeout = getTimeoutFromEnv()

Timeout defines the maximum duration for GraphQL network operations.

Functions

func NewRuntime

func NewRuntime(d *Dependencies) mdk.Runtime

NewRuntime wraps Dependencies to satisfy the mdk.Runtime interface.

func NormalizeModuleID

func NormalizeModuleID(id string) string

NormalizeModuleID standardizes module IDs by removing common repo prefixes and replacing slashes with dots. E.g., "github.com/GoHyperrr/commerce/hotel" -> "commerce.hotel"

func QueryGraphQL

func QueryGraphQL(serverURL string, query string, variables map[string]any, out any) error

QueryGraphQL performs HTTP POST queries to retrieve and deserialize remote data.

func Register

func Register(m Module)

Register adds a module to the global registry.

func RegisterCommand

func RegisterCommand(cmd CLICommand)

RegisterCommand adds a dynamic CLI subcommand to the registry.

func RegisterFactory

func RegisterFactory(id string, factory ModuleFactory)

RegisterFactory registers a module constructor in the global factory registry.

func RegisterMiddleware

func RegisterMiddleware(name string, mw Middleware)

RegisterMiddleware adds a named middleware to the registry.

Types

type ActorResolver

type ActorResolver interface {
	GetActorByAPIKey(ctx context.Context, key string) (identity.Actor, error)
}

ActorResolver defines the interface for resolving identities.

type CLICommand

type CLICommand struct {
	Group       string   // Command group: "auth", "commerce", etc.
	Name        string   // Subcommand name: "apikey", "product", etc.
	Aliases     []string // Alternative names
	Short       string   // One-line description
	Long        string   // Detailed description (shown in --help)
	Usage       string   // Args pattern: "generate", "<email> <password>"
	Run         func(rt mdk.Runtime, args []string) error
	NeedsDB     bool // If true, auto-connect DB before Run
	NeedsServer bool // If true, requires running server (validates connectivity)
}

CLICommand represents a dynamic subcommand registered by a module.

func GetCommand

func GetCommand(key string) (CLICommand, bool)

GetCommand retrieves a registered custom command by its group/name key.

func ListCommands

func ListCommands() []CLICommand

ListCommands returns a list of all registered custom CLI commands.

type Dependencies

type Dependencies struct {
	Config    *config.Config
	DB        *db.DB
	EventBus  eventbus.EventBus
	Runner    WorkflowRunner
	Registry  WorkflowRegistry
	Locker    locking.Locker
	Resolver  ActorResolver
	ServerURL string
}

Dependencies provides common utilities to modules.

type Factory

type Factory = mdk.Factory

type GetPromptResult

type GetPromptResult = mdk.GetPromptResult

type GraphQLProvider

type GraphQLProvider interface {
	// Queries returns resolver function pointers keyed by GraphQL field name.
	Queries() map[string]any
	// Mutations returns resolver function pointers keyed by GraphQL field name.
	Mutations() map[string]any
	// FieldResolvers returns nested field resolvers (e.g. "WorkflowLineage.events").
	FieldResolvers() map[string]any
}

GraphQLProvider is implemented by modules that expose GraphQL queries/mutations.

type GraphQLRequest

type GraphQLRequest struct {
	Query     string         `json:"query"`
	Variables map[string]any `json:"variables,omitempty"`
}

GraphQLRequest defines the structure for outbound GraphQL operations.

type GraphQLResponse

type GraphQLResponse struct {
	Data   json.RawMessage `json:"data"`
	Errors []struct {
		Message string `json:"message"`
	} `json:"errors"`
}

GraphQLResponse wraps response payload format of GraphQL endpoints.

type LineageData

type LineageData = mdk.LineageData

LineageData defines the minimal interface for accessing workflow execution data.

type MCPPrompt

type MCPPrompt = mdk.MCPPrompt

type MCPPromptArgument

type MCPPromptArgument = mdk.MCPPromptArgument

type MCPPromptMessage

type MCPPromptMessage = mdk.MCPPromptMessage

type MCPPromptMessageContent

type MCPPromptMessageContent = mdk.MCPPromptMessageContent

type MCPResource

type MCPResource = mdk.MCPResource

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware is a standard HTTP middleware function.

func GetMiddleware

func GetMiddleware(name string) (Middleware, bool)

GetMiddleware retrieves a middleware by name.

type Module

type Module = mdk.Module

Type aliases linking to mdk module/mcp structures to preserve backward compatibility.

func Get

func Get(id string) (Module, bool)

Get returns a module by its ID from the global registry.

func List

func List() []Module

List returns all registered modules from the global registry.

type ModuleFactory

type ModuleFactory func(options map[string]any) (Module, error)

ModuleFactory is a constructor function that instantiates a module with options. A module factory can also be auto-implemented or registered in package init().

func GetFactory

func GetFactory(id string) (ModuleFactory, bool)

GetFactory retrieves a registered module constructor by its ID.

type OrderResult

type OrderResult interface {
	GetOrderID() string
	GetTotal() float64
	GetCustomerID() string
}

OrderResult defines the minimal interface for accessing order data across modules.

type Projector

type Projector = mdk.Projector

Projector defines the interface for querying execution lineages.

type PromptProvider

type PromptProvider = mdk.PromptProvider

type Registry

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

Registry manages the set of available hyperrr modules.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new, independent module registry.

func (*Registry) Get

func (r *Registry) Get(id string) (Module, bool)

Get returns a module by its ID.

func (*Registry) List

func (r *Registry) List() []Module

List returns all registered modules.

func (*Registry) Register

func (r *Registry) Register(m Module)

Register adds a module to the registry. It logs a warning if the ID is already taken.

type ResourceProvider

type ResourceProvider = mdk.ResourceProvider

type Route

type Route = mdk.Route

type WorkflowRegistry

type WorkflowRegistry interface {
	Register(wf *workflow.Workflow) error
	Get(name string) (*workflow.Workflow, error)
	List() []*workflow.Workflow
}

WorkflowRegistry defines the interface for managing workflow definitions.

type WorkflowRunner

type WorkflowRunner interface {
	ExecuteSyncWorkflow(ctx context.Context, id string, wf *workflow.Workflow, input any) (map[string]any, error)
}

WorkflowRunner defines the interface for executing workflows.

Jump to

Keyboard shortcuts

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