{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package store\n\n## Constants\n\n```go\nconst (\n\tEventExecutionStarted   = \"execution.started\"\n\tEventStepStarted        = \"step.started\"\n\tEventStepInputRecorded  = \"step.input_recorded\"\n\tEventStepOutputRecorded = \"step.output_recorded\"\n\tEventStepCompleted      = \"step.completed\"\n\tEventStepFailed         = \"step.failed\"\n\tEventStepSkipped        = \"step.skipped\"\n\tEventStepCompensated    = \"step.compensated\"\n\tEventConditionalRouted  = \"conditional.routed\"\n\tEventRetryAttempted     = \"retry.attempted\"\n\tEventExecutionCompleted = \"execution.completed\"\n\tEventExecutionFailed    = \"execution.failed\"\n\tEventExecutionCancelled = \"execution.cancelled\"\n\tEventSagaCompensating   = \"saga.compensating\"\n\tEventSagaCompensated    = \"saga.compensated\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\tErrKeyExpired  = fmt.Errorf(\"api key expired\")\n\tErrKeyInactive = fmt.Errorf(\"api key inactive\")\n)\n```\nSentinel errors for API key operations.\n\n```go\nvar (\n\tErrNotFound  = errors.New(\"not found\")\n\tErrDuplicate = errors.New(\"duplicate entry\")\n\tErrConflict  = errors.New(\"conflict\")\n\tErrForbidden = errors.New(\"forbidden\")\n)\n```\nSentinel errors for store operations.\n\n```go\nvar ValidRoles = map[Role]bool{\n\tRoleOwner:  true,\n\tRoleAdmin:  true,\n\tRoleEditor: true,\n\tRoleViewer: true,\n}\n```\nValidRoles is the set of valid role values.\n\n```go\nvar ValidWorkflowStatuses = map[WorkflowStatus]bool{\n\tWorkflowStatusDraft:   true,\n\tWorkflowStatusActive:  true,\n\tWorkflowStatusStopped: true,\n\tWorkflowStatusError:   true,\n}\n```\nValidWorkflowStatuses is the set of valid workflow status values.\n\n## Types\n\n```go\ntype APIKey struct {\n\tID          uuid.UUID  `json:\"id\"`\n\tName        string     `json:\"name\"`\n\tKeyHash     string     `json:\"-\"`          // SHA-256 hash, never exposed\n\tKeyPrefix   string     `json:\"key_prefix\"` // first 8 chars for identification\n\tCompanyID   uuid.UUID  `json:\"company_id\"`\n\tOrgID       *uuid.UUID `json:\"org_id,omitempty\"`     // optional scoping\n\tProjectID   *uuid.UUID `json:\"project_id,omitempty\"` // optional scoping\n\tPermissions []string   `json:\"permissions\"`          // e.g., [\"read\", \"write\", \"admin\"]\n\tCreatedBy   uuid.UUID  `json:\"created_by\"`\n\tCreatedAt   time.Time  `json:\"created_at\"`\n\tExpiresAt   *time.Time `json:\"expires_at,omitempty\"`\n\tLastUsedAt  *time.Time `json:\"last_used_at,omitempty\"`\n\tIsActive    bool       `json:\"is_active\"`\n}\n```\nAPIKey represents an API key for programmatic access to the platform.\n\n```go\ntype APIKeyStore interface {\n\t// Create creates a new API key and returns the raw key (only available at creation time).\n\tCreate(ctx context.Context, key *APIKey) (rawKey string, err error)\n\t// Get retrieves an API key by ID.\n\tGet(ctx context.Context, id uuid.UUID) (*APIKey, error)\n\t// GetByHash retrieves an API key by its hash.\n\tGetByHash(ctx context.Context, keyHash string) (*APIKey, error)\n\t// List returns all API keys for a company.\n\tList(ctx context.Context, companyID uuid.UUID) ([]*APIKey, error)\n\t// Delete removes an API key by ID.\n\tDelete(ctx context.Context, id uuid.UUID) error\n\t// UpdateLastUsed updates the last_used_at timestamp for an API key.\n\tUpdateLastUsed(ctx context.Context, id uuid.UUID) error\n\t// Validate hashes the raw key and looks up the corresponding API key.\n\t// Returns ErrNotFound if no matching key exists, or ErrKeyExpired / ErrKeyInactive\n\t// for keys that exist but cannot be used.\n\tValidate(ctx context.Context, rawKey string) (*APIKey, error)\n}\n```\nAPIKeyStore defines persistence operations for API keys.\n\n```go\ntype AuditEntry struct {\n\tID           int64           `json:\"id\"`\n\tUserID       *uuid.UUID      `json:\"user_id,omitempty\"`\n\tAction       string          `json:\"action\"`\n\tResourceType string          `json:\"resource_type\"`\n\tResourceID   *uuid.UUID      `json:\"resource_id,omitempty\"`\n\tDetails      json.RawMessage `json:\"details,omitempty\"`\n\tIPAddress    string          `json:\"ip_address,omitempty\"`\n\tUserAgent    string          `json:\"user_agent,omitempty\"`\n\tCreatedAt    time.Time       `json:\"created_at\"`\n}\n```\nAuditEntry represents an entry in the audit log.\n\n```go\ntype AuditFilter struct {\n\tUserID       *uuid.UUID\n\tAction       string\n\tResourceType string\n\tResourceID   *uuid.UUID\n\tSince        *time.Time\n\tUntil        *time.Time\n\tPagination   Pagination\n}\n```\nAuditFilter specifies criteria for querying audit entries.\n\n```go\ntype AuditStore interface {\n\t// Record adds an audit entry.\n\tRecord(ctx context.Context, e *AuditEntry) error\n\t// Query returns audit entries matching the filter.\n\tQuery(ctx context.Context, f AuditFilter) ([]*AuditEntry, error)\n}\n```\nAuditStore defines persistence operations for audit log entries.\n\n```go\ntype AuthSessionStoreAdapter struct {\n\t// contains filtered or unexported fields\n}\n```\nAuthSessionStoreAdapter adapts a store.SessionStore to the auth.SessionStore interface.\n\n```go\nfunc NewAuthSessionStoreAdapter(store SessionStore) *AuthSessionStoreAdapter\n```\nNewAuthSessionStoreAdapter creates a new adapter.\n\n```go\nfunc (a *AuthSessionStoreAdapter) Cleanup(ctx context.Context) error\n```\n\n```go\nfunc (a *AuthSessionStoreAdapter) Delete(ctx context.Context, sessionID string) error\n```\n\n```go\nfunc (a *AuthSessionStoreAdapter) Get(ctx context.Context, sessionID string) (*auth.Session, error)\n```\n\n```go\nfunc (a *AuthSessionStoreAdapter) Store(ctx context.Context, session *auth.Session) error\n```\n\n```go\ntype AuthUserStoreAdapter struct {\n\t// contains filtered or unexported fields\n}\n```\nAuthUserStoreAdapter adapts a store.UserStore to the auth.UserStore interface.\n\n```go\nfunc NewAuthUserStoreAdapter(store UserStore) *AuthUserStoreAdapter\n```\nNewAuthUserStoreAdapter creates a new adapter.\n\n```go\nfunc (a *AuthUserStoreAdapter) CreateUser(ctx context.Context, user *auth.User) error\n```\n\n```go\nfunc (a *AuthUserStoreAdapter) DeleteUser(ctx context.Context, userID string) error\n```\n\n```go\nfunc (a *AuthUserStoreAdapter) GetUser(ctx context.Context, userID string) (*auth.User, error)\n```\n\n```go\nfunc (a *AuthUserStoreAdapter) GetUserByEmail(ctx context.Context, email string) (*auth.User, error)\n```\n\n```go\nfunc (a *AuthUserStoreAdapter) UpdateUser(ctx context.Context, user *auth.User) error\n```\n\n```go\ntype BackfillMockDiffHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nBackfillMockDiffHandler provides HTTP endpoints for backfill, step mock, and execution diff management.\n\n```go\nfunc NewBackfillMockDiffHandler(\n\tbackfillStore BackfillStore,\n\tmockStore StepMockStore,\n\tdiffCalc *DiffCalculator,\n\tlogger *slog.Logger,\n) *BackfillMockDiffHandler\n```\nNewBackfillMockDiffHandler creates a new handler with the given stores and calculator.\n\n```go\nfunc (h *BackfillMockDiffHandler) RegisterRoutes(mux *http.ServeMux)\n```\nRegisterRoutes registers all backfill, mock, and diff API routes on the given mux.\n\n```go\ntype BackfillRequest struct {\n\tID           uuid.UUID      `json:\"id\"`\n\tPipelineName string         `json:\"pipeline_name\"`\n\tSourceQuery  string         `json:\"source_query\"`\n\tStartTime    *time.Time     `json:\"start_time,omitempty\"`\n\tEndTime      *time.Time     `json:\"end_time,omitempty\"`\n\tStatus       BackfillStatus `json:\"status\"`\n\tCreatedAt    time.Time      `json:\"created_at\"`\n\tCompletedAt  *time.Time     `json:\"completed_at,omitempty\"`\n\tTotalEvents  int64          `json:\"total_events\"`\n\tProcessed    int64          `json:\"processed\"`\n\tFailed       int64          `json:\"failed\"`\n\tErrorMsg     string         `json:\"error_message,omitempty\"`\n}\n```\nBackfillRequest defines a request to replay historical events through a pipeline.\n\n```go\ntype BackfillStatus string\n```\nBackfillStatus represents the status of a backfill operation.\n\n```go\nconst (\n\tBackfillStatusPending   BackfillStatus = \"pending\"\n\tBackfillStatusRunning   BackfillStatus = \"running\"\n\tBackfillStatusCompleted BackfillStatus = \"completed\"\n\tBackfillStatusFailed    BackfillStatus = \"failed\"\n\tBackfillStatusCancelled BackfillStatus = \"cancelled\"\n)\n```\n\n```go\ntype BackfillStore interface {\n\t// Create inserts a new backfill request.\n\tCreate(ctx context.Context, req *BackfillRequest) error\n\t// Get retrieves a backfill request by ID.\n\tGet(ctx context.Context, id uuid.UUID) (*BackfillRequest, error)\n\t// List returns all backfill requests, ordered by creation time descending.\n\tList(ctx context.Context) ([]*BackfillRequest, error)\n\t// UpdateProgress updates the processed and failed counts for a backfill request.\n\tUpdateProgress(ctx context.Context, id uuid.UUID, processed, failed int64) error\n\t// UpdateStatus sets the status and optional error message for a backfill request.\n\tUpdateStatus(ctx context.Context, id uuid.UUID, status BackfillStatus, errMsg string) error\n\t// Cancel cancels a pending or running backfill request.\n\tCancel(ctx context.Context, id uuid.UUID) error\n}\n```\nBackfillStore manages backfill operations.\n\n```go\ntype Company struct {\n\tID        uuid.UUID       `json:\"id\"`\n\tName      string          `json:\"name\"`\n\tSlug      string          `json:\"slug\"`\n\tOwnerID   uuid.UUID       `json:\"owner_id\"`\n\tMetadata  json.RawMessage `json:\"metadata,omitempty\"`\n\tCreatedAt time.Time       `json:\"created_at\"`\n\tUpdatedAt time.Time       `json:\"updated_at\"`\n}\n```\nCompany represents a top-level organization or company.\n\n```go\ntype CompanyFilter struct {\n\tOwnerID    *uuid.UUID\n\tSlug       string\n\tPagination Pagination\n}\n```\nCompanyFilter specifies criteria for listing companies.\n\n```go\ntype CompanyStore interface {\n\tCreate(ctx context.Context, c *Company) error\n\tGet(ctx context.Context, id uuid.UUID) (*Company, error)\n\tGetBySlug(ctx context.Context, slug string) (*Company, error)\n\tUpdate(ctx context.Context, c *Company) error\n\tDelete(ctx context.Context, id uuid.UUID) error\n\tList(ctx context.Context, f CompanyFilter) ([]*Company, error)\n\tListForUser(ctx context.Context, userID uuid.UUID) ([]*Company, error)\n}\n```\nCompanyStore defines persistence operations for companies.\n\n```go\ntype ConfigDocument struct {\n\tKey       string\n\tData      []byte\n\tHash      string\n\tVersion   int\n\tUpdatedAt time.Time\n}\n```\nConfigDocument represents a config record in the database.\n\n```go\ntype CrossWorkflowLink struct {\n\tID               uuid.UUID       `json:\"id\"`\n\tSourceWorkflowID uuid.UUID       `json:\"source_workflow_id\"`\n\tTargetWorkflowID uuid.UUID       `json:\"target_workflow_id\"`\n\tLinkType         string          `json:\"link_type\"`\n\tConfig           json.RawMessage `json:\"config,omitempty\"`\n\tCreatedBy        uuid.UUID       `json:\"created_by\"`\n\tCreatedAt        time.Time       `json:\"created_at\"`\n}\n```\nCrossWorkflowLink represents a directed link between two workflows.\n\n```go\ntype CrossWorkflowLinkFilter struct {\n\tSourceWorkflowID *uuid.UUID\n\tTargetWorkflowID *uuid.UUID\n\tLinkType         string\n\tPagination       Pagination\n}\n```\nCrossWorkflowLinkFilter specifies criteria for listing cross-workflow links.\n\n```go\ntype CrossWorkflowLinkStore interface {\n\tCreate(ctx context.Context, l *CrossWorkflowLink) error\n\tGet(ctx context.Context, id uuid.UUID) (*CrossWorkflowLink, error)\n\tDelete(ctx context.Context, id uuid.UUID) error\n\tList(ctx context.Context, f CrossWorkflowLinkFilter) ([]*CrossWorkflowLink, error)\n}\n```\nCrossWorkflowLinkStore defines persistence operations for cross-workflow links.\n\n```go\ntype DLQEntry struct {\n\tID            uuid.UUID       `json:\"id\"`\n\tOriginalEvent json.RawMessage `json:\"original_event\"`\n\tPipelineName  string          `json:\"pipeline_name\"`\n\tStepName      string          `json:\"step_name\"`\n\tErrorMessage  string          `json:\"error_message\"`\n\tErrorType     string          `json:\"error_type\"`\n\tRetryCount    int             `json:\"retry_count\"`\n\tMaxRetries    int             `json:\"max_retries\"`\n\tStatus        DLQStatus       `json:\"status\"`\n\tCreatedAt     time.Time       `json:\"created_at\"`\n\tUpdatedAt     time.Time       `json:\"updated_at\"`\n\tResolvedAt    *time.Time      `json:\"resolved_at,omitempty\"`\n\tMetadata      map[string]any  `json:\"metadata,omitempty\"`\n}\n```\nDLQEntry represents a failed event/message in the dead letter queue.\n\n```go\ntype DLQFilter struct {\n\tPipelineName string\n\tStepName     string\n\tStatus       DLQStatus\n\tErrorType    string\n\tLimit        int\n\tOffset       int\n}\n```\nDLQFilter specifies criteria for listing DLQ entries.\n\n```go\ntype DLQHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nDLQHandler provides HTTP endpoints for dead letter queue management.\n\n```go\nfunc NewDLQHandler(store DLQStore, logger *slog.Logger) *DLQHandler\n```\nNewDLQHandler creates a new DLQHandler.\n\n```go\nfunc (h *DLQHandler) RegisterRoutes(mux *http.ServeMux)\n```\nRegisterRoutes registers the DLQ API routes on the given mux.\n\n```go\ntype DLQStatus string\n```\nDLQStatus represents the status of a dead letter queue entry.\n\n```go\nconst (\n\tDLQStatusPending   DLQStatus = \"pending\"\n\tDLQStatusRetrying  DLQStatus = \"retrying\"\n\tDLQStatusResolved  DLQStatus = \"resolved\"\n\tDLQStatusDiscarded DLQStatus = \"discarded\"\n)\n```\n\n```go\ntype DLQStore interface {\n\t// Add inserts a new DLQ entry.\n\tAdd(ctx context.Context, entry *DLQEntry) error\n\t// Get retrieves a DLQ entry by ID.\n\tGet(ctx context.Context, id uuid.UUID) (*DLQEntry, error)\n\t// List returns DLQ entries matching the given filter.\n\tList(ctx context.Context, filter DLQFilter) ([]*DLQEntry, error)\n\t// Count returns the number of DLQ entries matching the given filter.\n\tCount(ctx context.Context, filter DLQFilter) (int64, error)\n\t// UpdateStatus sets the status of a DLQ entry.\n\tUpdateStatus(ctx context.Context, id uuid.UUID, status DLQStatus) error\n\t// Retry increments retry_count and sets status to \"retrying\".\n\tRetry(ctx context.Context, id uuid.UUID) error\n\t// Discard sets the status to \"discarded\".\n\tDiscard(ctx context.Context, id uuid.UUID) error\n\t// Resolve sets the status to \"resolved\" and sets resolved_at.\n\tResolve(ctx context.Context, id uuid.UUID) error\n\t// Purge removes resolved/discarded entries older than the given duration.\n\tPurge(ctx context.Context, olderThan time.Duration) (int64, error)\n}\n```\nDLQStore defines persistence operations for dead letter queue entries.\n\n```go\ntype DiffCalculator struct {\n\t// contains filtered or unexported fields\n}\n```\nDiffCalculator computes diffs between executions.\n\n```go\nfunc NewDiffCalculator(eventStore EventStore) *DiffCalculator\n```\nNewDiffCalculator creates a new DiffCalculator using the given EventStore.\n\n```go\nfunc (d *DiffCalculator) Compare(ctx context.Context, execA, execB uuid.UUID) (*ExecutionDiff, error)\n```\nCompare computes a structured diff between two executions.\n\n```go\ntype DiffSummary struct {\n\tTotalSteps   int `json:\"total_steps\"`\n\tSameSteps    int `json:\"same_steps\"`\n\tDiffSteps    int `json:\"different_steps\"`\n\tAddedSteps   int `json:\"added_steps\"`\n\tRemovedSteps int `json:\"removed_steps\"`\n}\n```\nDiffSummary provides aggregate counts for an execution diff.\n\n```go\ntype EventRecorderAdapter struct {\n\t// contains filtered or unexported fields\n}\n```\nEventRecorderAdapter wraps an EventStore to satisfy the module.EventRecorder interface used by pipeline execution. The adapter converts string execution IDs to uuid.UUID before delegating to the underlying EventStore.Append method.\n\n```go\nfunc NewEventRecorderAdapter(store EventStore) *EventRecorderAdapter\n```\nNewEventRecorderAdapter creates an adapter that bridges EventStore to module.EventRecorder.\n\n```go\nfunc (a *EventRecorderAdapter) RecordEvent(ctx context.Context, executionID string, eventType string, data map[string]any) error\n```\nRecordEvent implements module.EventRecorder.\n\n```go\ntype EventStore interface {\n\t// Append adds a new event to the log for a given execution.\n\tAppend(ctx context.Context, executionID uuid.UUID, eventType string, data map[string]any) error\n\t// GetEvents returns all events for an execution ordered by sequence number.\n\tGetEvents(ctx context.Context, executionID uuid.UUID) ([]ExecutionEvent, error)\n\t// GetTimeline materializes a complete execution view from its event stream.\n\tGetTimeline(ctx context.Context, executionID uuid.UUID) (*MaterializedExecution, error)\n\t// ListExecutions returns materialized executions matching the given filter.\n\tListExecutions(ctx context.Context, filter ExecutionEventFilter) ([]MaterializedExecution, error)\n}\n```\nEventStore defines persistence operations for execution events using an append-only event sourcing pattern.\n\n```go\ntype ExecutionDiff struct {\n\tExecutionA uuid.UUID   `json:\"execution_a\"`\n\tExecutionB uuid.UUID   `json:\"execution_b\"`\n\tStepDiffs  []StepDiff  `json:\"step_diffs\"`\n\tSummary    DiffSummary `json:\"summary\"`\n}\n```\nExecutionDiff compares two executions step by step.\n\n```go\ntype ExecutionEvent struct {\n\tID          uuid.UUID       `json:\"id\"`\n\tExecutionID uuid.UUID       `json:\"execution_id\"`\n\tSequenceNum int64           `json:\"sequence_num\"`\n\tEventType   string          `json:\"event_type\"`\n\tEventData   json.RawMessage `json:\"event_data\"`\n\tCreatedAt   time.Time       `json:\"created_at\"`\n}\n```\nExecutionEvent represents a single immutable event in the execution log.\n\n```go\ntype ExecutionEventFilter struct {\n\tPipeline string\n\tTenantID string\n\tStatus   string\n\tSince    *time.Time\n\tUntil    *time.Time\n\tLimit    int\n\tOffset   int\n}\n```\nExecutionEventFilter specifies criteria for listing materialized executions.\n\n```go\ntype ExecutionFilter struct {\n\tWorkflowID *uuid.UUID\n\tStatus     ExecutionStatus\n\tSince      *time.Time\n\tUntil      *time.Time\n\tPagination Pagination\n}\n```\nExecutionFilter specifies criteria for listing executions.\n\n```go\ntype ExecutionLog struct {\n\tID          int64           `json:\"id\"`\n\tWorkflowID  uuid.UUID       `json:\"workflow_id\"`\n\tExecutionID *uuid.UUID      `json:\"execution_id,omitempty\"`\n\tLevel       LogLevel        `json:\"level\"`\n\tMessage     string          `json:\"message\"`\n\tModuleName  string          `json:\"module_name,omitempty\"`\n\tFields      json.RawMessage `json:\"fields,omitempty\"`\n\tCreatedAt   time.Time       `json:\"created_at\"`\n}\n```\nExecutionLog represents a log entry for a workflow execution.\n\n```go\ntype ExecutionStatus string\n```\nExecutionStatus represents the status of a workflow execution.\n\n```go\nconst (\n\tExecutionStatusPending   ExecutionStatus = \"pending\"\n\tExecutionStatusRunning   ExecutionStatus = \"running\"\n\tExecutionStatusCompleted ExecutionStatus = \"completed\"\n\tExecutionStatusFailed    ExecutionStatus = \"failed\"\n\tExecutionStatusCancelled ExecutionStatus = \"cancelled\"\n)\n```\n\n```go\ntype ExecutionStep struct {\n\tID           uuid.UUID       `json:\"id\"`\n\tExecutionID  uuid.UUID       `json:\"execution_id\"`\n\tStepName     string          `json:\"step_name\"`\n\tStepType     string          `json:\"step_type\"`\n\tInputData    json.RawMessage `json:\"input_data,omitempty\"`\n\tOutputData   json.RawMessage `json:\"output_data,omitempty\"`\n\tStatus       StepStatus      `json:\"status\"`\n\tErrorMessage string          `json:\"error_message,omitempty\"`\n\tStartedAt    *time.Time      `json:\"started_at,omitempty\"`\n\tCompletedAt  *time.Time      `json:\"completed_at,omitempty\"`\n\tDurationMs   *int64          `json:\"duration_ms,omitempty\"`\n\tSequenceNum  int             `json:\"sequence_num\"`\n\tMetadata     json.RawMessage `json:\"metadata,omitempty\"`\n}\n```\nExecutionStep represents a single step within a workflow execution.\n\n```go\ntype ExecutionStore interface {\n\t// CreateExecution creates a new workflow execution record.\n\tCreateExecution(ctx context.Context, e *WorkflowExecution) error\n\t// GetExecution retrieves an execution by ID.\n\tGetExecution(ctx context.Context, id uuid.UUID) (*WorkflowExecution, error)\n\t// UpdateExecution updates an execution record.\n\tUpdateExecution(ctx context.Context, e *WorkflowExecution) error\n\t// ListExecutions lists executions matching the filter.\n\tListExecutions(ctx context.Context, f ExecutionFilter) ([]*WorkflowExecution, error)\n\n\t// CreateStep creates a new execution step.\n\tCreateStep(ctx context.Context, s *ExecutionStep) error\n\t// UpdateStep updates an execution step.\n\tUpdateStep(ctx context.Context, s *ExecutionStep) error\n\t// ListSteps lists steps for an execution.\n\tListSteps(ctx context.Context, executionID uuid.UUID) ([]*ExecutionStep, error)\n\n\t// CountByStatus returns execution counts grouped by status for a workflow.\n\tCountByStatus(ctx context.Context, workflowID uuid.UUID) (map[ExecutionStatus]int, error)\n}\n```\nExecutionStore defines persistence operations for workflow executions.\n\n```go\ntype FieldChange struct {\n\tPath   string `json:\"path\"`\n\tValueA any    `json:\"value_a\"`\n\tValueB any    `json:\"value_b\"`\n}\n```\nFieldChange represents a single field difference between two maps.\n\n```go\nfunc DiffMaps(a, b map[string]any) []FieldChange\n```\nDiffMaps recursively compares two maps and returns a list of field changes. Paths are dot-separated for nested keys.\n\n```go\ntype FileInfo struct {\n\tName        string    `json:\"name\"`\n\tPath        string    `json:\"path\"`\n\tSize        int64     `json:\"size\"`\n\tModTime     time.Time `json:\"modTime\"`\n\tIsDir       bool      `json:\"isDir\"`\n\tContentType string    `json:\"contentType,omitempty\"`\n}\n```\nFileInfo describes metadata about a file in a storage provider.\n\n```go\ntype IAMProviderConfig struct {\n\tID           uuid.UUID       `json:\"id\"`\n\tCompanyID    uuid.UUID       `json:\"company_id\"`\n\tProviderType IAMProviderType `json:\"provider_type\"`\n\tName         string          `json:\"name\"`\n\tConfig       json.RawMessage `json:\"config\"`\n\tEnabled      bool            `json:\"enabled\"`\n\tCreatedAt    time.Time       `json:\"created_at\"`\n\tUpdatedAt    time.Time       `json:\"updated_at\"`\n}\n```\nIAMProviderConfig represents a configured IAM provider for a company.\n\n```go\ntype IAMProviderFilter struct {\n\tCompanyID    *uuid.UUID\n\tProviderType IAMProviderType\n\tEnabled      *bool\n\tPagination   Pagination\n}\n```\nIAMProviderFilter specifies criteria for listing IAM providers.\n\n```go\ntype IAMProviderType string\n```\nIAMProviderType represents the type of an IAM provider.\n\n```go\nconst (\n\tIAMProviderAWS        IAMProviderType = \"aws_iam\"\n\tIAMProviderKubernetes IAMProviderType = \"kubernetes\"\n\tIAMProviderOIDC       IAMProviderType = \"oidc\"\n\tIAMProviderSAML       IAMProviderType = \"saml\"\n\tIAMProviderLDAP       IAMProviderType = \"ldap\"\n\tIAMProviderCustom     IAMProviderType = \"custom\"\n)\n```\n\n```go\ntype IAMRoleMapping struct {\n\tID                 uuid.UUID `json:\"id\"`\n\tProviderID         uuid.UUID `json:\"provider_id\"`\n\tExternalIdentifier string    `json:\"external_identifier\"`\n\tResourceType       string    `json:\"resource_type\"`\n\tResourceID         uuid.UUID `json:\"resource_id\"`\n\tRole               Role      `json:\"role\"`\n\tCreatedAt          time.Time `json:\"created_at\"`\n}\n```\nIAMRoleMapping maps an external identity to a role on a resource.\n\n```go\ntype IAMRoleMappingFilter struct {\n\tProviderID         *uuid.UUID\n\tExternalIdentifier string\n\tResourceType       string\n\tResourceID         *uuid.UUID\n\tPagination         Pagination\n}\n```\nIAMRoleMappingFilter specifies criteria for listing IAM role mappings.\n\n```go\ntype IAMStore interface {\n\t// CreateProvider creates a new IAM provider config.\n\tCreateProvider(ctx context.Context, p *IAMProviderConfig) error\n\t// GetProvider retrieves an IAM provider by ID.\n\tGetProvider(ctx context.Context, id uuid.UUID) (*IAMProviderConfig, error)\n\t// UpdateProvider updates an IAM provider config.\n\tUpdateProvider(ctx context.Context, p *IAMProviderConfig) error\n\t// DeleteProvider deletes an IAM provider config.\n\tDeleteProvider(ctx context.Context, id uuid.UUID) error\n\t// ListProviders lists IAM providers matching the filter.\n\tListProviders(ctx context.Context, f IAMProviderFilter) ([]*IAMProviderConfig, error)\n\n\t// CreateMapping creates a new IAM role mapping.\n\tCreateMapping(ctx context.Context, m *IAMRoleMapping) error\n\t// GetMapping retrieves an IAM role mapping by ID.\n\tGetMapping(ctx context.Context, id uuid.UUID) (*IAMRoleMapping, error)\n\t// DeleteMapping deletes an IAM role mapping.\n\tDeleteMapping(ctx context.Context, id uuid.UUID) error\n\t// ListMappings lists IAM role mappings matching the filter.\n\tListMappings(ctx context.Context, f IAMRoleMappingFilter) ([]*IAMRoleMapping, error)\n\n\t// ResolveRole resolves the role for an external identifier on a resource.\n\tResolveRole(ctx context.Context, providerID uuid.UUID, externalID string, resourceType string, resourceID uuid.UUID) (Role, error)\n}\n```\nIAMStore defines persistence operations for IAM providers and role mappings.\n\n```go\ntype IdempotencyRecord struct {\n\tKey         string          `json:\"key\"`\n\tExecutionID uuid.UUID       `json:\"execution_id\"`\n\tStepName    string          `json:\"step_name\"`\n\tResult      json.RawMessage `json:\"result\"`\n\tCreatedAt   time.Time       `json:\"created_at\"`\n\tExpiresAt   time.Time       `json:\"expires_at\"`\n}\n```\nIdempotencyRecord represents a stored result for an idempotency key.\n\n```go\ntype IdempotencyStore interface {\n\t// Check returns the stored result if the key exists and hasn't expired.\n\t// Returns nil, nil if the key doesn't exist.\n\tCheck(ctx context.Context, key string) (*IdempotencyRecord, error)\n\t// Store saves a result for an idempotency key with an expiration time.\n\tStore(ctx context.Context, record *IdempotencyRecord) error\n\t// Cleanup removes expired keys.\n\tCleanup(ctx context.Context) (int64, error)\n}\n```\nIdempotencyStore defines persistence operations for idempotency keys.\n\n```go\ntype InMemoryAPIKeyStore struct {\n\t// contains filtered or unexported fields\n}\n```\nInMemoryAPIKeyStore is a thread-safe in-memory implementation of APIKeyStore.\n\n```go\nfunc NewInMemoryAPIKeyStore() *InMemoryAPIKeyStore\n```\nNewInMemoryAPIKeyStore creates a new InMemoryAPIKeyStore.\n\n```go\nfunc (s *InMemoryAPIKeyStore) Create(_ context.Context, key *APIKey) (string, error)\n```\n\n```go\nfunc (s *InMemoryAPIKeyStore) Delete(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *InMemoryAPIKeyStore) Get(_ context.Context, id uuid.UUID) (*APIKey, error)\n```\n\n```go\nfunc (s *InMemoryAPIKeyStore) GetByHash(_ context.Context, keyHash string) (*APIKey, error)\n```\n\n```go\nfunc (s *InMemoryAPIKeyStore) List(_ context.Context, companyID uuid.UUID) ([]*APIKey, error)\n```\n\n```go\nfunc (s *InMemoryAPIKeyStore) UpdateLastUsed(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *InMemoryAPIKeyStore) Validate(_ context.Context, rawKey string) (*APIKey, error)\n```\n\n```go\ntype InMemoryBackfillStore struct {\n\t// contains filtered or unexported fields\n}\n```\nInMemoryBackfillStore is a thread-safe in-memory implementation of BackfillStore.\n\n```go\nfunc NewInMemoryBackfillStore() *InMemoryBackfillStore\n```\nNewInMemoryBackfillStore creates a new InMemoryBackfillStore.\n\n```go\nfunc (s *InMemoryBackfillStore) Cancel(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *InMemoryBackfillStore) Create(_ context.Context, req *BackfillRequest) error\n```\n\n```go\nfunc (s *InMemoryBackfillStore) Get(_ context.Context, id uuid.UUID) (*BackfillRequest, error)\n```\n\n```go\nfunc (s *InMemoryBackfillStore) List(_ context.Context) ([]*BackfillRequest, error)\n```\n\n```go\nfunc (s *InMemoryBackfillStore) UpdateProgress(_ context.Context, id uuid.UUID, processed, failed int64) error\n```\n\n```go\nfunc (s *InMemoryBackfillStore) UpdateStatus(_ context.Context, id uuid.UUID, status BackfillStatus, errMsg string) error\n```\n\n```go\ntype InMemoryDLQStore struct {\n\t// contains filtered or unexported fields\n}\n```\nInMemoryDLQStore is a thread-safe in-memory implementation of DLQStore.\n\n```go\nfunc NewInMemoryDLQStore() *InMemoryDLQStore\n```\nNewInMemoryDLQStore creates a new InMemoryDLQStore.\n\n```go\nfunc (s *InMemoryDLQStore) Add(_ context.Context, entry *DLQEntry) error\n```\n\n```go\nfunc (s *InMemoryDLQStore) Count(_ context.Context, filter DLQFilter) (int64, error)\n```\n\n```go\nfunc (s *InMemoryDLQStore) Discard(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *InMemoryDLQStore) Get(_ context.Context, id uuid.UUID) (*DLQEntry, error)\n```\n\n```go\nfunc (s *InMemoryDLQStore) List(_ context.Context, filter DLQFilter) ([]*DLQEntry, error)\n```\n\n```go\nfunc (s *InMemoryDLQStore) Purge(_ context.Context, olderThan time.Duration) (int64, error)\n```\n\n```go\nfunc (s *InMemoryDLQStore) Resolve(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *InMemoryDLQStore) Retry(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *InMemoryDLQStore) UpdateStatus(_ context.Context, id uuid.UUID, status DLQStatus) error\n```\n\n```go\ntype InMemoryEventStore struct {\n\t// contains filtered or unexported fields\n}\n```\nInMemoryEventStore is a thread-safe in-memory implementation of EventStore. Suitable for testing and single-server use.\n\n```go\nfunc NewInMemoryEventStore() *InMemoryEventStore\n```\nNewInMemoryEventStore creates a new InMemoryEventStore.\n\n```go\nfunc (s *InMemoryEventStore) Append(_ context.Context, executionID uuid.UUID, eventType string, data map[string]any) error\n```\n\n```go\nfunc (s *InMemoryEventStore) GetEvents(_ context.Context, executionID uuid.UUID) ([]ExecutionEvent, error)\n```\n\n```go\nfunc (s *InMemoryEventStore) GetTimeline(_ context.Context, executionID uuid.UUID) (*MaterializedExecution, error)\n```\n\n```go\nfunc (s *InMemoryEventStore) ListExecutions(_ context.Context, filter ExecutionEventFilter) ([]MaterializedExecution, error)\n```\n\n```go\ntype InMemoryIdempotencyStore struct {\n\t// contains filtered or unexported fields\n}\n```\nInMemoryIdempotencyStore is a thread-safe in-memory implementation of IdempotencyStore for testing and single-server use.\n\n```go\nfunc NewInMemoryIdempotencyStore() *InMemoryIdempotencyStore\n```\nNewInMemoryIdempotencyStore creates a new InMemoryIdempotencyStore.\n\n```go\nfunc (s *InMemoryIdempotencyStore) Check(_ context.Context, key string) (*IdempotencyRecord, error)\n```\n\n```go\nfunc (s *InMemoryIdempotencyStore) Cleanup(_ context.Context) (int64, error)\n```\n\n```go\nfunc (s *InMemoryIdempotencyStore) Store(_ context.Context, record *IdempotencyRecord) error\n```\n\n```go\ntype InMemoryStepMockStore struct {\n\t// contains filtered or unexported fields\n}\n```\nInMemoryStepMockStore is a thread-safe in-memory implementation of StepMockStore.\n\n```go\nfunc NewInMemoryStepMockStore() *InMemoryStepMockStore\n```\nNewInMemoryStepMockStore creates a new InMemoryStepMockStore.\n\n```go\nfunc (s *InMemoryStepMockStore) ClearAll(_ context.Context) error\n```\n\n```go\nfunc (s *InMemoryStepMockStore) Get(_ context.Context, pipeline, step string) (*StepMock, error)\n```\n\n```go\nfunc (s *InMemoryStepMockStore) IncrementHitCount(_ context.Context, pipeline, step string) error\n```\n\n```go\nfunc (s *InMemoryStepMockStore) List(_ context.Context, pipeline string) ([]*StepMock, error)\n```\n\n```go\nfunc (s *InMemoryStepMockStore) Remove(_ context.Context, pipeline, step string) error\n```\n\n```go\nfunc (s *InMemoryStepMockStore) Set(_ context.Context, mock *StepMock) error\n```\n\n```go\ntype LocalStorage struct {\n\t// contains filtered or unexported fields\n}\n```\nLocalStorage implements StorageProvider backed by the local filesystem.\n\n```go\nfunc NewLocalStorage(root string) (*LocalStorage, error)\n```\nNewLocalStorage creates a new LocalStorage rooted at the given directory. The directory is created if it does not exist.\n\n```go\nfunc (l *LocalStorage) Delete(_ context.Context, path string) error\n```\n\n```go\nfunc (l *LocalStorage) Get(_ context.Context, path string) (io.ReadCloser, error)\n```\n\n```go\nfunc (l *LocalStorage) List(_ context.Context, prefix string) ([]FileInfo, error)\n```\n\n```go\nfunc (l *LocalStorage) MkdirAll(_ context.Context, path string) error\n```\nMkdirAll creates a directory path and all parents that do not exist.\n\n```go\nfunc (l *LocalStorage) Put(_ context.Context, path string, reader io.Reader) error\n```\n\n```go\nfunc (l *LocalStorage) Root() string\n```\nRoot returns the absolute root path.\n\n```go\nfunc (l *LocalStorage) Stat(_ context.Context, path string) (FileInfo, error)\n```\n\n```go\ntype LogFilter struct {\n\tWorkflowID  *uuid.UUID\n\tExecutionID *uuid.UUID\n\tLevel       LogLevel\n\tModuleName  string\n\tSince       *time.Time\n\tUntil       *time.Time\n\tPagination  Pagination\n}\n```\nLogFilter specifies criteria for querying logs.\n\n```go\ntype LogLevel string\n```\nLogLevel represents a log severity level.\n\n```go\nconst (\n\tLogLevelDebug LogLevel = \"debug\"\n\tLogLevelInfo  LogLevel = \"info\"\n\tLogLevelWarn  LogLevel = \"warn\"\n\tLogLevelError LogLevel = \"error\"\n\tLogLevelFatal LogLevel = \"fatal\"\n)\n```\n\n```go\ntype LogQuerier interface {\n\t// ListExecutionLogs returns log entries for an execution, optionally filtered by level.\n\t// limit=0 means no limit. Results are ordered by created_at ASC.\n\tListExecutionLogs(executionID string, level string, limit int) ([]map[string]any, error)\n}\n```\nLogQuerier is an optional interface for querying execution log entries. \\*module.V1Store implements this interface; it is defined here to avoid a circular import between the store and module packages.\n\n```go\ntype LogStore interface {\n\t// Append adds a log entry.\n\tAppend(ctx context.Context, l *ExecutionLog) error\n\t// Query returns log entries matching the filter.\n\tQuery(ctx context.Context, f LogFilter) ([]*ExecutionLog, error)\n\t// CountByLevel returns log counts grouped by level for a workflow.\n\tCountByLevel(ctx context.Context, workflowID uuid.UUID) (map[LogLevel]int, error)\n}\n```\nLogStore defines persistence operations for execution logs.\n\n```go\ntype MaterializedExecution struct {\n\tExecutionID uuid.UUID          `json:\"execution_id\"`\n\tPipeline    string             `json:\"pipeline,omitempty\"`\n\tTenantID    string             `json:\"tenant_id,omitempty\"`\n\tStatus      string             `json:\"status\"`\n\tSteps       []MaterializedStep `json:\"steps,omitempty\"`\n\tError       string             `json:\"error,omitempty\"`\n\tStartedAt   *time.Time         `json:\"started_at,omitempty\"`\n\tCompletedAt *time.Time         `json:\"completed_at,omitempty\"`\n\tEventCount  int                `json:\"event_count\"`\n}\n```\nMaterializedExecution is a read-optimized view of a complete execution, materialized from the event stream.\n\n```go\ntype MaterializedStep struct {\n\tStepName    string          `json:\"step_name\"`\n\tStepType    string          `json:\"step_type,omitempty\"`\n\tStatus      string          `json:\"status\"`\n\tInputData   json.RawMessage `json:\"input_data,omitempty\"`\n\tOutputData  json.RawMessage `json:\"output_data,omitempty\"`\n\tError       string          `json:\"error,omitempty\"`\n\tRoute       string          `json:\"route,omitempty\"`\n\tRetries     int             `json:\"retries,omitempty\"`\n\tStartedAt   *time.Time      `json:\"started_at,omitempty\"`\n\tCompletedAt *time.Time      `json:\"completed_at,omitempty\"`\n}\n```\nMaterializedStep is a read-optimized view of a single step within an execution.\n\n```go\ntype Membership struct {\n\tID        uuid.UUID  `json:\"id\"`\n\tUserID    uuid.UUID  `json:\"user_id\"`\n\tCompanyID uuid.UUID  `json:\"company_id\"`\n\tProjectID *uuid.UUID `json:\"project_id,omitempty\"` // nil means company-level membership\n\tRole      Role       `json:\"role\"`\n\tCreatedAt time.Time  `json:\"created_at\"`\n\tUpdatedAt time.Time  `json:\"updated_at\"`\n}\n```\nMembership represents a user's role within a company or project.\n\n```go\ntype MembershipFilter struct {\n\tUserID     *uuid.UUID\n\tCompanyID  *uuid.UUID\n\tProjectID  *uuid.UUID\n\tRole       Role\n\tPagination Pagination\n}\n```\nMembershipFilter specifies criteria for listing memberships.\n\n```go\ntype MembershipStore interface {\n\tCreate(ctx context.Context, m *Membership) error\n\tGet(ctx context.Context, id uuid.UUID) (*Membership, error)\n\tUpdate(ctx context.Context, m *Membership) error\n\tDelete(ctx context.Context, id uuid.UUID) error\n\tList(ctx context.Context, f MembershipFilter) ([]*Membership, error)\n\t// GetEffectiveRole resolves the effective role for a user in a project,\n\t// cascading from company-level if no project-level membership exists.\n\tGetEffectiveRole(ctx context.Context, userID, companyID uuid.UUID, projectID *uuid.UUID) (Role, error)\n}\n```\nMembershipStore defines persistence operations for memberships.\n\n```go\ntype Migrator struct {\n\t// contains filtered or unexported fields\n}\n```\nMigrator applies SQL migrations from the embedded filesystem.\n\n```go\nfunc NewMigrator(pool *pgxpool.Pool) *Migrator\n```\nNewMigrator creates a new Migrator.\n\n```go\nfunc (m *Migrator) Migrate(ctx context.Context) error\n```\nMigrate applies all pending migrations in order. It uses an advisory lock to prevent concurrent migration runs and tracks applied migrations in a schema\\_migrations table.\n\n```go\ntype MockAuditStore struct {\n\t// contains filtered or unexported fields\n}\n```\nMockAuditStore is an in-memory implementation of AuditStore for testing.\n\n```go\nfunc NewMockAuditStore() *MockAuditStore\n```\nNewMockAuditStore creates a new MockAuditStore.\n\n```go\nfunc (s *MockAuditStore) Query(_ context.Context, f AuditFilter) ([]*AuditEntry, error)\n```\n\n```go\nfunc (s *MockAuditStore) Record(_ context.Context, e *AuditEntry) error\n```\n\n```go\ntype MockCompanyStore struct {\n\t// contains filtered or unexported fields\n}\n```\nMockCompanyStore is an in-memory implementation of CompanyStore for testing.\n\n```go\nfunc NewMockCompanyStore() *MockCompanyStore\n```\nNewMockCompanyStore creates a new MockCompanyStore.\n\n```go\nfunc (s *MockCompanyStore) Create(_ context.Context, c *Company) error\n```\n\n```go\nfunc (s *MockCompanyStore) Delete(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *MockCompanyStore) Get(_ context.Context, id uuid.UUID) (*Company, error)\n```\n\n```go\nfunc (s *MockCompanyStore) GetBySlug(_ context.Context, slug string) (*Company, error)\n```\n\n```go\nfunc (s *MockCompanyStore) List(_ context.Context, f CompanyFilter) ([]*Company, error)\n```\n\n```go\nfunc (s *MockCompanyStore) ListForUser(_ context.Context, userID uuid.UUID) ([]*Company, error)\n```\n\n```go\nfunc (s *MockCompanyStore) SetMembershipStore(ms *MockMembershipStore)\n```\nSetMembershipStore links a MockMembershipStore for ListForUser support.\n\n```go\nfunc (s *MockCompanyStore) Update(_ context.Context, c *Company) error\n```\n\n```go\ntype MockCrossWorkflowLinkStore struct {\n\t// contains filtered or unexported fields\n}\n```\nMockCrossWorkflowLinkStore is an in-memory implementation of CrossWorkflowLinkStore for testing.\n\n```go\nfunc NewMockCrossWorkflowLinkStore() *MockCrossWorkflowLinkStore\n```\nNewMockCrossWorkflowLinkStore creates a new MockCrossWorkflowLinkStore.\n\n```go\nfunc (s *MockCrossWorkflowLinkStore) Create(_ context.Context, l *CrossWorkflowLink) error\n```\n\n```go\nfunc (s *MockCrossWorkflowLinkStore) Delete(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *MockCrossWorkflowLinkStore) Get(_ context.Context, id uuid.UUID) (*CrossWorkflowLink, error)\n```\n\n```go\nfunc (s *MockCrossWorkflowLinkStore) List(_ context.Context, f CrossWorkflowLinkFilter) ([]*CrossWorkflowLink, error)\n```\n\n```go\ntype MockExecutionStore struct {\n\t// contains filtered or unexported fields\n}\n```\nMockExecutionStore is an in-memory implementation of ExecutionStore for testing.\n\n```go\nfunc NewMockExecutionStore() *MockExecutionStore\n```\nNewMockExecutionStore creates a new MockExecutionStore.\n\n```go\nfunc (s *MockExecutionStore) CountByStatus(_ context.Context, workflowID uuid.UUID) (map[ExecutionStatus]int, error)\n```\n\n```go\nfunc (s *MockExecutionStore) CreateExecution(_ context.Context, e *WorkflowExecution) error\n```\n\n```go\nfunc (s *MockExecutionStore) CreateStep(_ context.Context, step *ExecutionStep) error\n```\n\n```go\nfunc (s *MockExecutionStore) GetExecution(_ context.Context, id uuid.UUID) (*WorkflowExecution, error)\n```\n\n```go\nfunc (s *MockExecutionStore) ListExecutions(_ context.Context, f ExecutionFilter) ([]*WorkflowExecution, error)\n```\n\n```go\nfunc (s *MockExecutionStore) ListSteps(_ context.Context, executionID uuid.UUID) ([]*ExecutionStep, error)\n```\n\n```go\nfunc (s *MockExecutionStore) UpdateExecution(_ context.Context, e *WorkflowExecution) error\n```\n\n```go\nfunc (s *MockExecutionStore) UpdateStep(_ context.Context, step *ExecutionStep) error\n```\n\n```go\ntype MockIAMStore struct {\n\t// contains filtered or unexported fields\n}\n```\nMockIAMStore is an in-memory implementation of IAMStore for testing.\n\n```go\nfunc NewMockIAMStore() *MockIAMStore\n```\nNewMockIAMStore creates a new MockIAMStore.\n\n```go\nfunc (s *MockIAMStore) CreateMapping(_ context.Context, m *IAMRoleMapping) error\n```\n\n```go\nfunc (s *MockIAMStore) CreateProvider(_ context.Context, p *IAMProviderConfig) error\n```\n\n```go\nfunc (s *MockIAMStore) DeleteMapping(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *MockIAMStore) DeleteProvider(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *MockIAMStore) GetMapping(_ context.Context, id uuid.UUID) (*IAMRoleMapping, error)\n```\n\n```go\nfunc (s *MockIAMStore) GetProvider(_ context.Context, id uuid.UUID) (*IAMProviderConfig, error)\n```\n\n```go\nfunc (s *MockIAMStore) ListMappings(_ context.Context, f IAMRoleMappingFilter) ([]*IAMRoleMapping, error)\n```\n\n```go\nfunc (s *MockIAMStore) ListProviders(_ context.Context, f IAMProviderFilter) ([]*IAMProviderConfig, error)\n```\n\n```go\nfunc (s *MockIAMStore) ResolveRole(_ context.Context, providerID uuid.UUID, externalID string, resourceType string, resourceID uuid.UUID) (Role, error)\n```\n\n```go\nfunc (s *MockIAMStore) UpdateProvider(_ context.Context, p *IAMProviderConfig) error\n```\n\n```go\ntype MockLogStore struct {\n\t// contains filtered or unexported fields\n}\n```\nMockLogStore is an in-memory implementation of LogStore for testing.\n\n```go\nfunc NewMockLogStore() *MockLogStore\n```\nNewMockLogStore creates a new MockLogStore.\n\n```go\nfunc (s *MockLogStore) Append(_ context.Context, l *ExecutionLog) error\n```\n\n```go\nfunc (s *MockLogStore) CountByLevel(_ context.Context, workflowID uuid.UUID) (map[LogLevel]int, error)\n```\n\n```go\nfunc (s *MockLogStore) Query(_ context.Context, f LogFilter) ([]*ExecutionLog, error)\n```\n\n```go\ntype MockMembershipStore struct {\n\t// contains filtered or unexported fields\n}\n```\nMockMembershipStore is an in-memory implementation of MembershipStore for testing.\n\n```go\nfunc NewMockMembershipStore() *MockMembershipStore\n```\nNewMockMembershipStore creates a new MockMembershipStore.\n\n```go\nfunc (s *MockMembershipStore) Create(_ context.Context, m *Membership) error\n```\n\n```go\nfunc (s *MockMembershipStore) Delete(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *MockMembershipStore) Get(_ context.Context, id uuid.UUID) (*Membership, error)\n```\n\n```go\nfunc (s *MockMembershipStore) GetEffectiveRole(_ context.Context, userID, companyID uuid.UUID, projectID *uuid.UUID) (Role, error)\n```\n\n```go\nfunc (s *MockMembershipStore) List(_ context.Context, f MembershipFilter) ([]*Membership, error)\n```\n\n```go\nfunc (s *MockMembershipStore) Update(_ context.Context, m *Membership) error\n```\n\n```go\ntype MockProjectStore struct {\n\t// contains filtered or unexported fields\n}\n```\nMockProjectStore is an in-memory implementation of ProjectStore for testing.\n\n```go\nfunc NewMockProjectStore() *MockProjectStore\n```\nNewMockProjectStore creates a new MockProjectStore.\n\n```go\nfunc (s *MockProjectStore) Create(_ context.Context, p *Project) error\n```\n\n```go\nfunc (s *MockProjectStore) Delete(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *MockProjectStore) Get(_ context.Context, id uuid.UUID) (*Project, error)\n```\n\n```go\nfunc (s *MockProjectStore) GetBySlug(_ context.Context, companyID uuid.UUID, slug string) (*Project, error)\n```\n\n```go\nfunc (s *MockProjectStore) List(_ context.Context, f ProjectFilter) ([]*Project, error)\n```\n\n```go\nfunc (s *MockProjectStore) ListForUser(_ context.Context, userID uuid.UUID) ([]*Project, error)\n```\n\n```go\nfunc (s *MockProjectStore) SetMembershipStore(ms *MockMembershipStore)\n```\nSetMembershipStore links a MockMembershipStore for ListForUser support.\n\n```go\nfunc (s *MockProjectStore) Update(_ context.Context, p *Project) error\n```\n\n```go\ntype MockSessionStore struct {\n\t// contains filtered or unexported fields\n}\n```\nMockSessionStore is an in-memory implementation of SessionStore for testing.\n\n```go\nfunc NewMockSessionStore() *MockSessionStore\n```\nNewMockSessionStore creates a new MockSessionStore.\n\n```go\nfunc (s *MockSessionStore) Create(_ context.Context, sess *Session) error\n```\n\n```go\nfunc (s *MockSessionStore) Delete(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *MockSessionStore) DeleteExpired(_ context.Context) (int64, error)\n```\n\n```go\nfunc (s *MockSessionStore) Get(_ context.Context, id uuid.UUID) (*Session, error)\n```\n\n```go\nfunc (s *MockSessionStore) GetByToken(_ context.Context, token string) (*Session, error)\n```\n\n```go\nfunc (s *MockSessionStore) List(_ context.Context, f SessionFilter) ([]*Session, error)\n```\n\n```go\nfunc (s *MockSessionStore) Update(_ context.Context, sess *Session) error\n```\n\n```go\ntype MockUserStore struct {\n\t// contains filtered or unexported fields\n}\n```\nMockUserStore is an in-memory implementation of UserStore for testing.\n\n```go\nfunc NewMockUserStore() *MockUserStore\n```\nNewMockUserStore creates a new MockUserStore.\n\n```go\nfunc (s *MockUserStore) Create(_ context.Context, u *User) error\n```\n\n```go\nfunc (s *MockUserStore) Delete(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *MockUserStore) Get(_ context.Context, id uuid.UUID) (*User, error)\n```\n\n```go\nfunc (s *MockUserStore) GetByEmail(_ context.Context, email string) (*User, error)\n```\n\n```go\nfunc (s *MockUserStore) GetByOAuth(_ context.Context, provider OAuthProvider, oauthID string) (*User, error)\n```\n\n```go\nfunc (s *MockUserStore) List(_ context.Context, f UserFilter) ([]*User, error)\n```\n\n```go\nfunc (s *MockUserStore) Update(_ context.Context, u *User) error\n```\n\n```go\ntype MockWorkflowStore struct {\n\t// contains filtered or unexported fields\n}\n```\nMockWorkflowStore is an in-memory implementation of WorkflowStore for testing.\n\n```go\nfunc NewMockWorkflowStore() *MockWorkflowStore\n```\nNewMockWorkflowStore creates a new MockWorkflowStore.\n\n```go\nfunc (s *MockWorkflowStore) Create(_ context.Context, w *WorkflowRecord) error\n```\n\n```go\nfunc (s *MockWorkflowStore) Delete(_ context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *MockWorkflowStore) Get(_ context.Context, id uuid.UUID) (*WorkflowRecord, error)\n```\n\n```go\nfunc (s *MockWorkflowStore) GetBySlug(_ context.Context, projectID uuid.UUID, slug string) (*WorkflowRecord, error)\n```\n\n```go\nfunc (s *MockWorkflowStore) GetVersion(_ context.Context, id uuid.UUID, version int) (*WorkflowRecord, error)\n```\n\n```go\nfunc (s *MockWorkflowStore) List(_ context.Context, f WorkflowFilter) ([]*WorkflowRecord, error)\n```\n\n```go\nfunc (s *MockWorkflowStore) ListVersions(_ context.Context, id uuid.UUID) ([]*WorkflowRecord, error)\n```\n\n```go\nfunc (s *MockWorkflowStore) Update(_ context.Context, w *WorkflowRecord) error\n```\n\n```go\ntype OAuthProvider string\n```\nOAuthProvider represents the provider for an OAuth connection.\n\n```go\nconst (\n\tOAuthProviderGitHub OAuthProvider = \"github\"\n\tOAuthProviderGoogle OAuthProvider = \"google\"\n)\n```\n\n```go\ntype Organization = Company\n```\nOrganization is an alias for Company for code clarity where \"organization\" terminology is preferred.\n\n```go\ntype OrganizationStore = CompanyStore\n```\nOrganizationStore is an alias for CompanyStore.\n\n```go\ntype PGAPIKeyStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGAPIKeyStore implements APIKeyStore backed by PostgreSQL using pgxpool.\n\n```go\nfunc NewPGAPIKeyStore(pool *pgxpool.Pool) (*PGAPIKeyStore, error)\n```\nNewPGAPIKeyStore creates a new PGAPIKeyStore backed by the given connection pool and ensures the required schema exists.\n\n```go\nfunc (s *PGAPIKeyStore) Create(ctx context.Context, key *APIKey) (string, error)\n```\n\n```go\nfunc (s *PGAPIKeyStore) Delete(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGAPIKeyStore) Get(ctx context.Context, id uuid.UUID) (*APIKey, error)\n```\n\n```go\nfunc (s *PGAPIKeyStore) GetByHash(ctx context.Context, keyHash string) (*APIKey, error)\n```\n\n```go\nfunc (s *PGAPIKeyStore) List(ctx context.Context, companyID uuid.UUID) ([]*APIKey, error)\n```\n\n```go\nfunc (s *PGAPIKeyStore) UpdateLastUsed(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGAPIKeyStore) Validate(ctx context.Context, rawKey string) (*APIKey, error)\n```\n\n```go\ntype PGAuditStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGAuditStore implements AuditStore backed by PostgreSQL.\n\n```go\nfunc (s *PGAuditStore) Query(ctx context.Context, f AuditFilter) ([]*AuditEntry, error)\n```\n\n```go\nfunc (s *PGAuditStore) Record(ctx context.Context, e *AuditEntry) error\n```\n\n```go\ntype PGCompanyStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGCompanyStore implements CompanyStore backed by PostgreSQL.\n\n```go\nfunc (s *PGCompanyStore) Create(ctx context.Context, c *Company) error\n```\n\n```go\nfunc (s *PGCompanyStore) Delete(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGCompanyStore) Get(ctx context.Context, id uuid.UUID) (*Company, error)\n```\n\n```go\nfunc (s *PGCompanyStore) GetBySlug(ctx context.Context, slug string) (*Company, error)\n```\n\n```go\nfunc (s *PGCompanyStore) List(ctx context.Context, f CompanyFilter) ([]*Company, error)\n```\n\n```go\nfunc (s *PGCompanyStore) ListForUser(ctx context.Context, userID uuid.UUID) ([]*Company, error)\n```\n\n```go\nfunc (s *PGCompanyStore) Update(ctx context.Context, c *Company) error\n```\n\n```go\ntype PGConfig struct {\n\tURL             string `yaml:\"url\" json:\"url\"`\n\tMaxConns        int32  `yaml:\"max_conns\" json:\"max_conns\"`\n\tMinConns        int32  `yaml:\"min_conns\" json:\"min_conns\"`\n\tMaxConnIdleTime string `yaml:\"max_conn_idle_time\" json:\"max_conn_idle_time\"`\n}\n```\nPGConfig holds PostgreSQL connection configuration.\n\n```go\ntype PGConfigStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGConfigStore manages config documents in PostgreSQL.\n\n```go\nfunc NewPGConfigStore(pool *pgxpool.Pool) *PGConfigStore\n```\nNewPGConfigStore creates a config store backed by the given connection pool.\n\n```go\nfunc (s *PGConfigStore) GetConfigDocument(ctx context.Context, key string) ([]byte, error)\n```\n\n```go\nfunc (s *PGConfigStore) GetConfigDocumentHash(ctx context.Context, key string) (string, error)\n```\n\n```go\nfunc (s *PGConfigStore) ListConfigDocuments(ctx context.Context) ([]ConfigDocument, error)\n```\n\n```go\nfunc (s *PGConfigStore) PutConfigDocument(ctx context.Context, key string, data []byte) error\n```\n\n```go\ntype PGCrossWorkflowLinkStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGCrossWorkflowLinkStore implements CrossWorkflowLinkStore backed by PostgreSQL.\n\n```go\nfunc (s *PGCrossWorkflowLinkStore) Create(ctx context.Context, l *CrossWorkflowLink) error\n```\n\n```go\nfunc (s *PGCrossWorkflowLinkStore) Delete(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGCrossWorkflowLinkStore) Get(ctx context.Context, id uuid.UUID) (*CrossWorkflowLink, error)\n```\n\n```go\nfunc (s *PGCrossWorkflowLinkStore) List(ctx context.Context, f CrossWorkflowLinkFilter) ([]*CrossWorkflowLink, error)\n```\n\n```go\ntype PGDLQStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGDLQStore implements DLQStore backed by PostgreSQL using pgxpool.\n\n```go\nfunc NewPGDLQStore(pool *pgxpool.Pool) (*PGDLQStore, error)\n```\nNewPGDLQStore creates a new PGDLQStore backed by the given connection pool and ensures the required schema exists.\n\n```go\nfunc (s *PGDLQStore) Add(ctx context.Context, entry *DLQEntry) error\n```\n\n```go\nfunc (s *PGDLQStore) Count(ctx context.Context, filter DLQFilter) (int64, error)\n```\n\n```go\nfunc (s *PGDLQStore) Discard(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGDLQStore) Get(ctx context.Context, id uuid.UUID) (*DLQEntry, error)\n```\n\n```go\nfunc (s *PGDLQStore) List(ctx context.Context, filter DLQFilter) ([]*DLQEntry, error)\n```\n\n```go\nfunc (s *PGDLQStore) Purge(ctx context.Context, olderThan time.Duration) (int64, error)\n```\n\n```go\nfunc (s *PGDLQStore) Resolve(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGDLQStore) Retry(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGDLQStore) UpdateStatus(ctx context.Context, id uuid.UUID, status DLQStatus) error\n```\n\n```go\ntype PGEventStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGEventStore implements EventStore backed by PostgreSQL using pgxpool.\n\n```go\nfunc NewPGEventStore(pool *pgxpool.Pool) (*PGEventStore, error)\n```\nNewPGEventStore creates a new PGEventStore backed by the given connection pool and ensures the required schema exists.\n\n```go\nfunc (s *PGEventStore) Append(ctx context.Context, executionID uuid.UUID, eventType string, data map[string]any) error\n```\n\n```go\nfunc (s *PGEventStore) GetEvents(ctx context.Context, executionID uuid.UUID) ([]ExecutionEvent, error)\n```\n\n```go\nfunc (s *PGEventStore) GetTimeline(ctx context.Context, executionID uuid.UUID) (*MaterializedExecution, error)\n```\n\n```go\nfunc (s *PGEventStore) ListExecutions(ctx context.Context, filter ExecutionEventFilter) ([]MaterializedExecution, error)\n```\n\n```go\ntype PGExecutionStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGExecutionStore implements ExecutionStore backed by PostgreSQL.\n\n```go\nfunc (s *PGExecutionStore) CountByStatus(ctx context.Context, workflowID uuid.UUID) (map[ExecutionStatus]int, error)\n```\n\n```go\nfunc (s *PGExecutionStore) CreateExecution(ctx context.Context, e *WorkflowExecution) error\n```\n\n```go\nfunc (s *PGExecutionStore) CreateStep(ctx context.Context, step *ExecutionStep) error\n```\n\n```go\nfunc (s *PGExecutionStore) GetExecution(ctx context.Context, id uuid.UUID) (*WorkflowExecution, error)\n```\n\n```go\nfunc (s *PGExecutionStore) ListExecutions(ctx context.Context, f ExecutionFilter) ([]*WorkflowExecution, error)\n```\n\n```go\nfunc (s *PGExecutionStore) ListSteps(ctx context.Context, executionID uuid.UUID) ([]*ExecutionStep, error)\n```\n\n```go\nfunc (s *PGExecutionStore) UpdateExecution(ctx context.Context, e *WorkflowExecution) error\n```\n\n```go\nfunc (s *PGExecutionStore) UpdateStep(ctx context.Context, step *ExecutionStep) error\n```\n\n```go\ntype PGIAMStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGIAMStore implements IAMStore backed by PostgreSQL.\n\n```go\nfunc (s *PGIAMStore) CreateMapping(ctx context.Context, m *IAMRoleMapping) error\n```\n\n```go\nfunc (s *PGIAMStore) CreateProvider(ctx context.Context, p *IAMProviderConfig) error\n```\n\n```go\nfunc (s *PGIAMStore) DeleteMapping(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGIAMStore) DeleteProvider(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGIAMStore) GetMapping(ctx context.Context, id uuid.UUID) (*IAMRoleMapping, error)\n```\n\n```go\nfunc (s *PGIAMStore) GetProvider(ctx context.Context, id uuid.UUID) (*IAMProviderConfig, error)\n```\n\n```go\nfunc (s *PGIAMStore) ListMappings(ctx context.Context, f IAMRoleMappingFilter) ([]*IAMRoleMapping, error)\n```\n\n```go\nfunc (s *PGIAMStore) ListProviders(ctx context.Context, f IAMProviderFilter) ([]*IAMProviderConfig, error)\n```\n\n```go\nfunc (s *PGIAMStore) ResolveRole(ctx context.Context, providerID uuid.UUID, externalID string, resourceType string, resourceID uuid.UUID) (Role, error)\n```\n\n```go\nfunc (s *PGIAMStore) UpdateProvider(ctx context.Context, p *IAMProviderConfig) error\n```\n\n```go\ntype PGIdempotencyStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGIdempotencyStore implements IdempotencyStore backed by PostgreSQL using pgxpool.\n\n```go\nfunc NewPGIdempotencyStore(pool *pgxpool.Pool) (*PGIdempotencyStore, error)\n```\nNewPGIdempotencyStore creates a new PGIdempotencyStore backed by the given connection pool and ensures the required schema exists.\n\n```go\nfunc (s *PGIdempotencyStore) Check(ctx context.Context, key string) (*IdempotencyRecord, error)\n```\n\n```go\nfunc (s *PGIdempotencyStore) Cleanup(ctx context.Context) (int64, error)\n```\n\n```go\nfunc (s *PGIdempotencyStore) Store(ctx context.Context, record *IdempotencyRecord) error\n```\n\n```go\ntype PGLogStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGLogStore implements LogStore backed by PostgreSQL.\n\n```go\nfunc (s *PGLogStore) Append(ctx context.Context, l *ExecutionLog) error\n```\n\n```go\nfunc (s *PGLogStore) CountByLevel(ctx context.Context, workflowID uuid.UUID) (map[LogLevel]int, error)\n```\n\n```go\nfunc (s *PGLogStore) Query(ctx context.Context, f LogFilter) ([]*ExecutionLog, error)\n```\n\n```go\ntype PGMembershipStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGMembershipStore implements MembershipStore backed by PostgreSQL.\n\n```go\nfunc (s *PGMembershipStore) Create(ctx context.Context, m *Membership) error\n```\n\n```go\nfunc (s *PGMembershipStore) Delete(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGMembershipStore) Get(ctx context.Context, id uuid.UUID) (*Membership, error)\n```\n\n```go\nfunc (s *PGMembershipStore) GetEffectiveRole(ctx context.Context, userID, companyID uuid.UUID, projectID *uuid.UUID) (Role, error)\n```\nGetEffectiveRole resolves the effective role for a user. If projectID is non-nil, it first checks for a project-level membership; if none is found it falls back to the company-level membership.\n\n```go\nfunc (s *PGMembershipStore) List(ctx context.Context, f MembershipFilter) ([]*Membership, error)\n```\n\n```go\nfunc (s *PGMembershipStore) Update(ctx context.Context, m *Membership) error\n```\n\n```go\ntype PGProjectStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGProjectStore implements ProjectStore backed by PostgreSQL.\n\n```go\nfunc (s *PGProjectStore) Create(ctx context.Context, p *Project) error\n```\n\n```go\nfunc (s *PGProjectStore) Delete(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGProjectStore) Get(ctx context.Context, id uuid.UUID) (*Project, error)\n```\n\n```go\nfunc (s *PGProjectStore) GetBySlug(ctx context.Context, companyID uuid.UUID, slug string) (*Project, error)\n```\n\n```go\nfunc (s *PGProjectStore) List(ctx context.Context, f ProjectFilter) ([]*Project, error)\n```\n\n```go\nfunc (s *PGProjectStore) ListForUser(ctx context.Context, userID uuid.UUID) ([]*Project, error)\n```\n\n```go\nfunc (s *PGProjectStore) Update(ctx context.Context, p *Project) error\n```\n\n```go\ntype PGSessionStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGSessionStore implements SessionStore backed by PostgreSQL.\n\n```go\nfunc (s *PGSessionStore) Create(ctx context.Context, sess *Session) error\n```\n\n```go\nfunc (s *PGSessionStore) Delete(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGSessionStore) DeleteExpired(ctx context.Context) (int64, error)\n```\n\n```go\nfunc (s *PGSessionStore) Get(ctx context.Context, id uuid.UUID) (*Session, error)\n```\n\n```go\nfunc (s *PGSessionStore) GetByToken(ctx context.Context, token string) (*Session, error)\n```\n\n```go\nfunc (s *PGSessionStore) List(ctx context.Context, f SessionFilter) ([]*Session, error)\n```\n\n```go\nfunc (s *PGSessionStore) Update(ctx context.Context, sess *Session) error\n```\n\n```go\ntype PGStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGStore wraps a pgxpool.Pool and provides access to all domain stores.\n\n```go\nfunc NewPGStore(ctx context.Context, cfg PGConfig) (*PGStore, error)\n```\nNewPGStore connects to PostgreSQL and returns a PGStore with all sub-stores.\n\n```go\nfunc (s *PGStore) Audit() AuditStore\n```\nAudit returns the AuditStore.\n\n```go\nfunc (s *PGStore) Close()\n```\nClose closes the connection pool.\n\n```go\nfunc (s *PGStore) Companies() CompanyStore\n```\nCompanies returns the CompanyStore.\n\n```go\nfunc (s *PGStore) ConfigDocs() *PGConfigStore\n```\nConfigDocs returns the PGConfigStore.\n\n```go\nfunc (s *PGStore) CrossWorkflowLinks() CrossWorkflowLinkStore\n```\nCrossWorkflowLinks returns the CrossWorkflowLinkStore.\n\n```go\nfunc (s *PGStore) Executions() ExecutionStore\n```\nExecutions returns the ExecutionStore.\n\n```go\nfunc (s *PGStore) IAM() IAMStore\n```\nIAM returns the IAMStore.\n\n```go\nfunc (s *PGStore) Logs() LogStore\n```\nLogs returns the LogStore.\n\n```go\nfunc (s *PGStore) Memberships() MembershipStore\n```\nMemberships returns the MembershipStore.\n\n```go\nfunc (s *PGStore) Pool() *pgxpool.Pool\n```\nPool returns the underlying pgxpool.Pool.\n\n```go\nfunc (s *PGStore) Projects() ProjectStore\n```\nProjects returns the ProjectStore.\n\n```go\nfunc (s *PGStore) Sessions() SessionStore\n```\nSessions returns the SessionStore.\n\n```go\nfunc (s *PGStore) Users() UserStore\n```\nUsers returns the UserStore.\n\n```go\nfunc (s *PGStore) Workflows() WorkflowStore\n```\nWorkflows returns the WorkflowStore.\n\n```go\ntype PGUserStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGUserStore implements UserStore backed by PostgreSQL.\n\n```go\nfunc (s *PGUserStore) Create(ctx context.Context, u *User) error\n```\n\n```go\nfunc (s *PGUserStore) Delete(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGUserStore) Get(ctx context.Context, id uuid.UUID) (*User, error)\n```\n\n```go\nfunc (s *PGUserStore) GetByEmail(ctx context.Context, email string) (*User, error)\n```\n\n```go\nfunc (s *PGUserStore) GetByOAuth(ctx context.Context, provider OAuthProvider, oauthID string) (*User, error)\n```\n\n```go\nfunc (s *PGUserStore) List(ctx context.Context, f UserFilter) ([]*User, error)\n```\n\n```go\nfunc (s *PGUserStore) Update(ctx context.Context, u *User) error\n```\n\n```go\ntype PGWorkflowStore struct {\n\t// contains filtered or unexported fields\n}\n```\nPGWorkflowStore implements WorkflowStore backed by PostgreSQL. Versioning is handled via a workflow\\_versions table; the main workflows table always reflects the latest version.\n\n```go\nfunc (s *PGWorkflowStore) Create(ctx context.Context, w *WorkflowRecord) error\n```\n\n```go\nfunc (s *PGWorkflowStore) Delete(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *PGWorkflowStore) Get(ctx context.Context, id uuid.UUID) (*WorkflowRecord, error)\n```\n\n```go\nfunc (s *PGWorkflowStore) GetBySlug(ctx context.Context, projectID uuid.UUID, slug string) (*WorkflowRecord, error)\n```\n\n```go\nfunc (s *PGWorkflowStore) GetVersion(ctx context.Context, id uuid.UUID, version int) (*WorkflowRecord, error)\n```\n\n```go\nfunc (s *PGWorkflowStore) List(ctx context.Context, f WorkflowFilter) ([]*WorkflowRecord, error)\n```\n\n```go\nfunc (s *PGWorkflowStore) ListVersions(ctx context.Context, id uuid.UUID) ([]*WorkflowRecord, error)\n```\n\n```go\nfunc (s *PGWorkflowStore) Update(ctx context.Context, w *WorkflowRecord) error\n```\n\n```go\ntype Pagination struct {\n\tOffset int\n\tLimit  int\n}\n```\nPagination holds common pagination parameters.\n\n```go\nfunc DefaultPagination() Pagination\n```\nDefaultPagination returns a Pagination with sensible defaults.\n\n```go\ntype Project struct {\n\tID          uuid.UUID       `json:\"id\"`\n\tCompanyID   uuid.UUID       `json:\"company_id\"`\n\tName        string          `json:\"name\"`\n\tSlug        string          `json:\"slug\"`\n\tDescription string          `json:\"description,omitempty\"`\n\tMetadata    json.RawMessage `json:\"metadata,omitempty\"`\n\tCreatedAt   time.Time       `json:\"created_at\"`\n\tUpdatedAt   time.Time       `json:\"updated_at\"`\n}\n```\nProject represents a project within a company.\n\n```go\ntype ProjectFilter struct {\n\tCompanyID  *uuid.UUID\n\tSlug       string\n\tPagination Pagination\n}\n```\nProjectFilter specifies criteria for listing projects.\n\n```go\ntype ProjectStore interface {\n\tCreate(ctx context.Context, p *Project) error\n\tGet(ctx context.Context, id uuid.UUID) (*Project, error)\n\tGetBySlug(ctx context.Context, companyID uuid.UUID, slug string) (*Project, error)\n\tUpdate(ctx context.Context, p *Project) error\n\tDelete(ctx context.Context, id uuid.UUID) error\n\tList(ctx context.Context, f ProjectFilter) ([]*Project, error)\n\tListForUser(ctx context.Context, userID uuid.UUID) ([]*Project, error)\n}\n```\nProjectStore defines persistence operations for projects.\n\n```go\ntype ReplayHandler struct {\n\n\t// ReplayFunc is called to actually replay an execution. It receives the\n\t// original execution's timeline and returns a new execution ID.\n\t// If nil, replays are queued but not executed.\n\tReplayFunc func(original *MaterializedExecution, mode string, modifications map[string]any) (uuid.UUID, error)\n\t// contains filtered or unexported fields\n}\n```\nReplayHandler provides HTTP endpoints for the Request Replay API.\n\n```go\nfunc NewReplayHandler(store EventStore, logger *slog.Logger) *ReplayHandler\n```\nNewReplayHandler creates a new ReplayHandler.\n\n```go\nfunc (h *ReplayHandler) RegisterRoutes(mux *http.ServeMux)\n```\nRegisterRoutes registers replay API routes.\n\n```go\ntype ReplayRequest struct {\n\tMode          string         `json:\"mode\"`                    // \"exact\" or \"modified\"\n\tModifications map[string]any `json:\"modifications,omitempty\"` // step overrides for \"modified\" mode\n}\n```\nReplayRequest defines a request to replay an execution.\n\n```go\ntype ReplayResult struct {\n\tOriginalExecutionID uuid.UUID `json:\"original_execution_id\"`\n\tNewExecutionID      uuid.UUID `json:\"new_execution_id\"`\n\tType                string    `json:\"type\"` // \"replay\"\n\tMode                string    `json:\"mode\"`\n\tStatus              string    `json:\"status\"` // \"queued\", \"started\"\n}\n```\nReplayResult describes the outcome of a replay operation.\n\n```go\ntype Role string\n```\nRole represents a membership role within a company or project.\n\n```go\nconst (\n\tRoleOwner  Role = \"owner\"\n\tRoleAdmin  Role = \"admin\"\n\tRoleEditor Role = \"editor\"\n\tRoleViewer Role = \"viewer\"\n)\n```\n\n```go\ntype SQLiteAPIKeyStore struct {\n\t// contains filtered or unexported fields\n}\n```\nSQLiteAPIKeyStore is a SQLite-backed implementation of APIKeyStore.\n\n```go\nfunc NewSQLiteAPIKeyStore(dbPath string) (*SQLiteAPIKeyStore, error)\n```\nNewSQLiteAPIKeyStore creates a new SQLiteAPIKeyStore and initializes the schema.\n\n```go\nfunc NewSQLiteAPIKeyStoreFromDB(db *sql.DB) (*SQLiteAPIKeyStore, error)\n```\nNewSQLiteAPIKeyStoreFromDB creates a SQLiteAPIKeyStore from an existing \\*sql.DB.\n\n```go\nfunc (s *SQLiteAPIKeyStore) Close() error\n```\nClose closes the underlying database connection.\n\n```go\nfunc (s *SQLiteAPIKeyStore) Create(ctx context.Context, key *APIKey) (string, error)\n```\n\n```go\nfunc (s *SQLiteAPIKeyStore) Delete(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *SQLiteAPIKeyStore) Get(ctx context.Context, id uuid.UUID) (*APIKey, error)\n```\n\n```go\nfunc (s *SQLiteAPIKeyStore) GetByHash(ctx context.Context, keyHash string) (*APIKey, error)\n```\n\n```go\nfunc (s *SQLiteAPIKeyStore) List(ctx context.Context, companyID uuid.UUID) ([]*APIKey, error)\n```\n\n```go\nfunc (s *SQLiteAPIKeyStore) UpdateLastUsed(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *SQLiteAPIKeyStore) Validate(ctx context.Context, rawKey string) (*APIKey, error)\n```\n\n```go\ntype SQLiteDLQStore struct {\n\t// contains filtered or unexported fields\n}\n```\nSQLiteDLQStore implements DLQStore backed by SQLite.\n\n```go\nfunc NewSQLiteDLQStore(dbPath string) (*SQLiteDLQStore, error)\n```\nNewSQLiteDLQStore creates a new SQLiteDLQStore using the given database path.\n\n```go\nfunc NewSQLiteDLQStoreFromDB(db *sql.DB) (*SQLiteDLQStore, error)\n```\nNewSQLiteDLQStoreFromDB wraps an existing \\*sql.DB connection.\n\n```go\nfunc (s *SQLiteDLQStore) Add(ctx context.Context, entry *DLQEntry) error\n```\n\n```go\nfunc (s *SQLiteDLQStore) Close() error\n```\nClose closes the underlying database connection.\n\n```go\nfunc (s *SQLiteDLQStore) Count(ctx context.Context, filter DLQFilter) (int64, error)\n```\n\n```go\nfunc (s *SQLiteDLQStore) Discard(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *SQLiteDLQStore) Get(ctx context.Context, id uuid.UUID) (*DLQEntry, error)\n```\n\n```go\nfunc (s *SQLiteDLQStore) List(ctx context.Context, filter DLQFilter) ([]*DLQEntry, error)\n```\n\n```go\nfunc (s *SQLiteDLQStore) Purge(ctx context.Context, olderThan time.Duration) (int64, error)\n```\n\n```go\nfunc (s *SQLiteDLQStore) Resolve(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *SQLiteDLQStore) Retry(ctx context.Context, id uuid.UUID) error\n```\n\n```go\nfunc (s *SQLiteDLQStore) UpdateStatus(ctx context.Context, id uuid.UUID, status DLQStatus) error\n```\n\n```go\ntype SQLiteEventStore struct {\n\t// contains filtered or unexported fields\n}\n```\nSQLiteEventStore implements EventStore backed by SQLite using database/sql. Writes are serialized with a mutex to avoid SQLITE\\_BUSY errors under concurrent load, which is the standard approach for SQLite.\n\n```go\nfunc NewSQLiteEventStore(dbPath string) (*SQLiteEventStore, error)\n```\nNewSQLiteEventStore creates a new SQLiteEventStore using the given database path. It opens the database and creates the required table if it does not exist.\n\n```go\nfunc NewSQLiteEventStoreFromDB(db *sql.DB) (*SQLiteEventStore, error)\n```\nNewSQLiteEventStoreFromDB wraps an existing \\*sql.DB connection. It creates the required table if it does not exist.\n\n```go\nfunc (s *SQLiteEventStore) Append(ctx context.Context, executionID uuid.UUID, eventType string, data map[string]any) error\n```\n\n```go\nfunc (s *SQLiteEventStore) Close() error\n```\nClose closes the underlying database connection.\n\n```go\nfunc (s *SQLiteEventStore) GetEvents(ctx context.Context, executionID uuid.UUID) ([]ExecutionEvent, error)\n```\n\n```go\nfunc (s *SQLiteEventStore) GetTimeline(ctx context.Context, executionID uuid.UUID) (*MaterializedExecution, error)\n```\n\n```go\nfunc (s *SQLiteEventStore) ListExecutions(ctx context.Context, filter ExecutionEventFilter) ([]MaterializedExecution, error)\n```\n\n```go\ntype SQLiteIdempotencyStore struct {\n\t// contains filtered or unexported fields\n}\n```\nSQLiteIdempotencyStore is a SQLite-backed implementation of IdempotencyStore.\n\n```go\nfunc NewSQLiteIdempotencyStore(db *sql.DB) (*SQLiteIdempotencyStore, error)\n```\nNewSQLiteIdempotencyStore creates a new SQLiteIdempotencyStore and ensures the required table exists. The caller is responsible for opening and closing the \\*sql.DB connection.\n\n```go\nfunc (s *SQLiteIdempotencyStore) Check(ctx context.Context, key string) (*IdempotencyRecord, error)\n```\n\n```go\nfunc (s *SQLiteIdempotencyStore) Cleanup(ctx context.Context) (int64, error)\n```\n\n```go\nfunc (s *SQLiteIdempotencyStore) Store(ctx context.Context, record *IdempotencyRecord) error\n```\n\n```go\ntype Session struct {\n\tID        uuid.UUID       `json:\"id\"`\n\tUserID    uuid.UUID       `json:\"user_id\"`\n\tToken     string          `json:\"-\"`\n\tIPAddress string          `json:\"ip_address\"`\n\tUserAgent string          `json:\"user_agent\"`\n\tMetadata  json.RawMessage `json:\"metadata,omitempty\"`\n\tActive    bool            `json:\"active\"`\n\tCreatedAt time.Time       `json:\"created_at\"`\n\tExpiresAt time.Time       `json:\"expires_at\"`\n}\n```\nSession represents an active user session.\n\n```go\ntype SessionFilter struct {\n\tUserID     *uuid.UUID\n\tActive     *bool\n\tPagination Pagination\n}\n```\nSessionFilter specifies criteria for listing sessions.\n\n```go\ntype SessionStore interface {\n\tCreate(ctx context.Context, s *Session) error\n\tGet(ctx context.Context, id uuid.UUID) (*Session, error)\n\tGetByToken(ctx context.Context, token string) (*Session, error)\n\tUpdate(ctx context.Context, s *Session) error\n\tDelete(ctx context.Context, id uuid.UUID) error\n\tList(ctx context.Context, f SessionFilter) ([]*Session, error)\n\tDeleteExpired(ctx context.Context) (int64, error)\n}\n```\nSessionStore defines persistence operations for sessions.\n\n```go\ntype StepDiff struct {\n\tStepName  string         `json:\"step_name\"`\n\tStatus    string         `json:\"status\"` // \"same\", \"different\", \"added\", \"removed\"\n\tOutputA   map[string]any `json:\"output_a,omitempty\"`\n\tOutputB   map[string]any `json:\"output_b,omitempty\"`\n\tDurationA time.Duration  `json:\"duration_a\"`\n\tDurationB time.Duration  `json:\"duration_b\"`\n\tChanges   []FieldChange  `json:\"changes,omitempty\"`\n}\n```\nStepDiff represents the difference between a step across two executions.\n\n```go\ntype StepMock struct {\n\tID            uuid.UUID      `json:\"id\"`\n\tPipelineName  string         `json:\"pipeline_name\"`\n\tStepName      string         `json:\"step_name\"`\n\tResponse      map[string]any `json:\"response\"`\n\tErrorResponse string         `json:\"error_response,omitempty\"`\n\tDelay         time.Duration  `json:\"delay,omitempty\"`\n\tEnabled       bool           `json:\"enabled\"`\n\tHitCount      int64          `json:\"hit_count\"`\n\tCreatedAt     time.Time      `json:\"created_at\"`\n}\n```\nStepMock defines a mock response for a specific pipeline step.\n\n```go\ntype StepMockStore interface {\n\t// Set creates or updates a mock for a specific pipeline step.\n\tSet(ctx context.Context, mock *StepMock) error\n\t// Get retrieves a mock for a specific pipeline and step.\n\tGet(ctx context.Context, pipeline, step string) (*StepMock, error)\n\t// List returns all mocks for a given pipeline.\n\tList(ctx context.Context, pipeline string) ([]*StepMock, error)\n\t// Remove deletes a mock for a specific pipeline and step.\n\tRemove(ctx context.Context, pipeline, step string) error\n\t// ClearAll removes all mocks.\n\tClearAll(ctx context.Context) error\n\t// IncrementHitCount increments the hit count for a mock.\n\tIncrementHitCount(ctx context.Context, pipeline, step string) error\n}\n```\nStepMockStore manages step mocks for pipeline testing.\n\n```go\ntype StepStatus string\n```\nStepStatus represents the status of an execution step.\n\n```go\nconst (\n\tStepStatusPending   StepStatus = \"pending\"\n\tStepStatusRunning   StepStatus = \"running\"\n\tStepStatusCompleted StepStatus = \"completed\"\n\tStepStatusFailed    StepStatus = \"failed\"\n\tStepStatusSkipped   StepStatus = \"skipped\"\n)\n```\n\n```go\ntype StorageProvider interface {\n\t// List returns file entries under the given prefix.\n\tList(ctx context.Context, prefix string) ([]FileInfo, error)\n\t// Get retrieves a file by path.\n\tGet(ctx context.Context, path string) (io.ReadCloser, error)\n\t// Put writes a file at the given path.\n\tPut(ctx context.Context, path string, reader io.Reader) error\n\t// Delete removes a file at the given path.\n\tDelete(ctx context.Context, path string) error\n\t// Stat returns metadata for a file.\n\tStat(ctx context.Context, path string) (FileInfo, error)\n\t// MkdirAll creates a directory path and all parents that do not exist.\n\tMkdirAll(ctx context.Context, path string) error\n}\n```\nStorageProvider defines the interface for file storage backends.\n\n```go\ntype TimelineHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nTimelineHandler provides HTTP endpoints for the Execution Timeline API.\n\n```go\nfunc NewTimelineHandler(store EventStore, logger *slog.Logger) *TimelineHandler\n```\nNewTimelineHandler creates a new TimelineHandler.\n\n```go\nfunc (h *TimelineHandler) RegisterRoutes(mux *http.ServeMux)\n```\nRegisterRoutes registers the timeline API routes on the given mux.\n\n```go\nfunc (h *TimelineHandler) WithLogQuerier(lq LogQuerier) *TimelineHandler\n```\nWithLogQuerier sets the optional LogQuerier used to serve the logs endpoint.\n\n```go\ntype User struct {\n\tID            uuid.UUID       `json:\"id\"`\n\tEmail         string          `json:\"email\"`\n\tPasswordHash  string          `json:\"-\"`\n\tDisplayName   string          `json:\"display_name\"`\n\tAvatarURL     string          `json:\"avatar_url,omitempty\"`\n\tOAuthProvider OAuthProvider   `json:\"oauth_provider,omitempty\"`\n\tOAuthID       string          `json:\"oauth_id,omitempty\"`\n\tActive        bool            `json:\"active\"`\n\tMetadata      json.RawMessage `json:\"metadata,omitempty\"`\n\tCreatedAt     time.Time       `json:\"created_at\"`\n\tUpdatedAt     time.Time       `json:\"updated_at\"`\n\tLastLoginAt   *time.Time      `json:\"last_login_at,omitempty\"`\n}\n```\nUser represents a platform user.\n\n```go\ntype UserFilter struct {\n\tEmail         string\n\tActive        *bool\n\tOAuthProvider OAuthProvider\n\tPagination    Pagination\n}\n```\nUserFilter specifies criteria for listing users.\n\n```go\ntype UserStore interface {\n\tCreate(ctx context.Context, u *User) error\n\tGet(ctx context.Context, id uuid.UUID) (*User, error)\n\tGetByEmail(ctx context.Context, email string) (*User, error)\n\tGetByOAuth(ctx context.Context, provider OAuthProvider, oauthID string) (*User, error)\n\tUpdate(ctx context.Context, u *User) error\n\tDelete(ctx context.Context, id uuid.UUID) error\n\tList(ctx context.Context, f UserFilter) ([]*User, error)\n}\n```\nUserStore defines persistence operations for users.\n\n```go\ntype WorkflowExecution struct {\n\tID           uuid.UUID       `json:\"id\"`\n\tWorkflowID   uuid.UUID       `json:\"workflow_id\"`\n\tTriggerType  string          `json:\"trigger_type\"`\n\tTriggerData  json.RawMessage `json:\"trigger_data,omitempty\"`\n\tStatus       ExecutionStatus `json:\"status\"`\n\tOutputData   json.RawMessage `json:\"output_data,omitempty\"`\n\tErrorMessage string          `json:\"error_message,omitempty\"`\n\tErrorStack   string          `json:\"error_stack,omitempty\"`\n\tStartedAt    time.Time       `json:\"started_at\"`\n\tCompletedAt  *time.Time      `json:\"completed_at,omitempty\"`\n\tDurationMs   *int64          `json:\"duration_ms,omitempty\"`\n\tMetadata     json.RawMessage `json:\"metadata,omitempty\"`\n}\n```\nWorkflowExecution represents a single execution of a workflow.\n\n```go\ntype WorkflowFilter struct {\n\tProjectID  *uuid.UUID\n\tStatus     WorkflowStatus\n\tSlug       string\n\tPagination Pagination\n}\n```\nWorkflowFilter specifies criteria for listing workflow records.\n\n```go\ntype WorkflowRecord struct {\n\tID          uuid.UUID      `json:\"id\"`\n\tProjectID   uuid.UUID      `json:\"project_id\"`\n\tName        string         `json:\"name\"`\n\tSlug        string         `json:\"slug\"`\n\tDescription string         `json:\"description,omitempty\"`\n\tConfigYAML  string         `json:\"config_yaml\"`\n\tVersion     int            `json:\"version\"`\n\tStatus      WorkflowStatus `json:\"status\"`\n\tCreatedBy   uuid.UUID      `json:\"created_by\"`\n\tUpdatedBy   uuid.UUID      `json:\"updated_by\"`\n\tCreatedAt   time.Time      `json:\"created_at\"`\n\tUpdatedAt   time.Time      `json:\"updated_at\"`\n}\n```\nWorkflowRecord represents a stored workflow configuration with version tracking.\n\n```go\ntype WorkflowStatus string\n```\nWorkflowStatus represents the lifecycle status of a workflow record.\n\n```go\nconst (\n\tWorkflowStatusDraft   WorkflowStatus = \"draft\"\n\tWorkflowStatusActive  WorkflowStatus = \"active\"\n\tWorkflowStatusStopped WorkflowStatus = \"stopped\"\n\tWorkflowStatusError   WorkflowStatus = \"error\"\n)\n```\n\n```go\ntype WorkflowStore interface {\n\tCreate(ctx context.Context, w *WorkflowRecord) error\n\tGet(ctx context.Context, id uuid.UUID) (*WorkflowRecord, error)\n\tGetBySlug(ctx context.Context, projectID uuid.UUID, slug string) (*WorkflowRecord, error)\n\tUpdate(ctx context.Context, w *WorkflowRecord) error\n\tDelete(ctx context.Context, id uuid.UUID) error\n\tList(ctx context.Context, f WorkflowFilter) ([]*WorkflowRecord, error)\n\t// GetVersion retrieves a specific version of a workflow.\n\tGetVersion(ctx context.Context, id uuid.UUID, version int) (*WorkflowRecord, error)\n\t// ListVersions returns all versions for a given workflow ID.\n\tListVersions(ctx context.Context, id uuid.UUID) ([]*WorkflowRecord, error)\n}\n```\nWorkflowStore defines persistence operations for workflow records.\n\n```go\ntype WorkspaceManager struct {\n\t// contains filtered or unexported fields\n}\n```\nWorkspaceManager manages project workspace directories and their storage.\n\n```go\nfunc NewWorkspaceManager(dataDir string) *WorkspaceManager\n```\nNewWorkspaceManager creates a new WorkspaceManager rooted at the given data directory.\n\n```go\nfunc (wm *WorkspaceManager) StorageForProject(projectID string) (*LocalStorage, error)\n```\nStorageForProject returns a LocalStorage provider scoped to a project workspace. The projectID is user-supplied (from a URL segment), so we verify the resolved workspace path stays inside wm.dataDir/workspaces/ to prevent path traversal (e.g. projectID=\"../../etc\" must not escape the workspaces base directory).\n\n```go\nfunc (wm *WorkspaceManager) WorkspacePath(projectID string) string\n```\nWorkspacePath returns the filesystem path for a project workspace.\n\n","path":"github.com/GoCodeAlone/workflow/store","name":"store","synopsis":"","isRedistributable":true}
