services

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 46 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const SchemaTableName = "__schemas"
View Source
const UploadSessionTableName = "__uploadSessions"

Variables

This section is empty.

Functions

func RegisterCMSTools

func RegisterCMSTools(entityService IEntityService, schemaService *SchemaService, a2uiService *A2UIService)

Types

type A2AService

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

func NewA2AService

func NewA2AService(chatService *ChatService, domain string) *A2AService

func (*A2AService) GetAgentCard

func (s *A2AService) GetAgentCard() *a2a.AgentCard

func (*A2AService) GetHandler

func (s *A2AService) GetHandler() a2asrv.RequestHandler

type A2UIComponent

type A2UIComponent struct {
	ID         string                 `json:"id"`
	Type       string                 `json:"type"`
	Attributes map[string]interface{} `json:"attributes,omitempty"`
	Children   []string               `json:"children,omitempty"`
}

A2UIComponent represents a single component in the adjacency list.

type A2UIMessage

type A2UIMessage struct {
	Components []A2UIComponent `json:"components"`
}

A2UIMessage is the payload sent over the SSE stream.

type A2UIService

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

func NewA2UIService

func NewA2UIService() *A2UIService

func (*A2UIService) GetComponent

func (s *A2UIService) GetComponent(id string) (A2UIComponent, bool)

func (*A2UIService) GetFullState

func (s *A2UIService) GetFullState() []A2UIComponent

func (*A2UIService) Subscribe

func (s *A2UIService) Subscribe() (chan []A2UIComponent, string)

func (*A2UIService) Unsubscribe

func (s *A2UIService) Unsubscribe(id string)

func (*A2UIService) UpdateComponent

func (s *A2UIService) UpdateComponent(ctx context.Context, component A2UIComponent)

type AssetService

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

func (*AssetService) ChunkStatus

func (s *AssetService) ChunkStatus(ctx context.Context, userId, fileName string, fileSize int64) (*datamodels.ChunkStatus, error)

func (*AssetService) CommitChunks

func (s *AssetService) CommitChunks(ctx context.Context, path, fileName string) (*descriptors.Asset, error)

func (*AssetService) GetAssetByPath

func (s *AssetService) GetAssetByPath(ctx context.Context, path string) (*descriptors.Asset, error)

func (*AssetService) ProcessImage

func (s *AssetService) ProcessImage(reader io.Reader) (io.Reader, error)

func (*AssetService) Save

func (s *AssetService) UpdateAssetsLinks(ctx context.Context, oldAssetIds []int64, newAssetPaths []string, entityName string, recordId int64) error

func (*AssetService) Upload

func (s *AssetService) Upload(ctx context.Context, path string, reader io.Reader) error

func (*AssetService) UploadChunk

func (s *AssetService) UploadChunk(ctx context.Context, path string, chunkNumber int, reader io.Reader) error

type AuditService

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

func NewAuditService

func NewAuditService(dao relationdbdao.IPrimaryDao) *AuditService

func (*AuditService) ById

func (*AuditService) List

func (s *AuditService) List(ctx context.Context, pagination datamodels.Pagination) ([]*descriptors.AuditLog, error)

func (*AuditService) Log

type AuthService

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

func NewAuthService

func NewAuthService(dao relationdbdao.IPrimaryDao, secret string, channelService IChannelService) *AuthService

func (*AuthService) GetRoleByName

func (s *AuthService) GetRoleByName(ctx context.Context, name string) (*descriptors.Role, error)

func (*AuthService) Login

func (s *AuthService) Login(ctx context.Context, email, password string) (string, error)

func (*AuthService) LoginByChannel

func (s *AuthService) LoginByChannel(ctx context.Context, channelType descriptors.ChannelType, identifier string, token string, ip, ua string) (string, error)

func (*AuthService) Me

func (s *AuthService) Me(ctx context.Context, userId int64) (*descriptors.User, error)

func (*AuthService) Register

func (s *AuthService) Register(ctx context.Context, email, password string) (*descriptors.User, error)

func (*AuthService) ValidateChannelToken

func (s *AuthService) ValidateChannelToken(ctx context.Context, channelType descriptors.ChannelType, tokenString string) (int64, string, error)

func (*AuthService) ValidateToken

func (s *AuthService) ValidateToken(tokenString string) (int64, []string, error)

type ChannelService

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

func (*ChannelService) GetAuthLogs

func (s *ChannelService) GetAuthLogs(ctx context.Context, userId int64, pagination datamodels.Pagination) ([]*descriptors.AuthLog, int64, error)

func (*ChannelService) GetChannelsByUserId

func (s *ChannelService) GetChannelsByUserId(ctx context.Context, userId int64) ([]*descriptors.UserChannel, error)

func (*ChannelService) HandleInbound

func (s *ChannelService) HandleInbound(ctx context.Context, channelType descriptors.ChannelType, identifier string, payload map[string]interface{}) error

func (*ChannelService) LogAuthAttempt

func (s *ChannelService) LogAuthAttempt(ctx context.Context, log *descriptors.AuthLog) error

func (*ChannelService) RegisterChannel

func (s *ChannelService) RegisterChannel(ctx context.Context, userId int64, channelType descriptors.ChannelType, identifier string, metadata map[string]interface{}) (*descriptors.UserChannel, error)

func (*ChannelService) SendNotification

func (s *ChannelService) SendNotification(ctx context.Context, userId int64, message string, preferredChannels []descriptors.ChannelType) error

func (*ChannelService) VerifyChannel

func (s *ChannelService) VerifyChannel(ctx context.Context, userId int64, channelType descriptors.ChannelType, token string) (bool, error)

type ChatService

type ChatService struct {
	Registry       *registry.Registry
	EntityService  IEntityService
	SchemaService  *SchemaService
	A2UIService    *A2UIService
	SessionService session.Service
}

func NewChatService

func NewChatService(configPath string, entityService IEntityService, schemaService *SchemaService, a2uiService *A2UIService) (*ChatService, error)

func (*ChatService) ProcessMessage

func (s *ChatService) ProcessMessage(ctx context.Context, message string, history []string) (string, error)

type CommentService

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

func NewCommentService

func NewCommentService(dao relationdbdao.IPrimaryDao) *CommentService

func (*CommentService) Delete

func (s *CommentService) Delete(ctx context.Context, userId, id string) error

func (*CommentService) List

func (s *CommentService) List(ctx context.Context, entityName string, recordId int64, pagination datamodels.Pagination) ([]*descriptors.Comment, error)

func (*CommentService) Save

func (*CommentService) Single

func (s *CommentService) Single(ctx context.Context, id string) (*descriptors.Comment, error)

type EngagementService

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

func NewEngagementService

func NewEngagementService(dao relationdbdao.IPrimaryDao) *EngagementService

func (*EngagementService) Track

type EntityService

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

func NewEntityService

func NewEntityService(schemaService ISchemaService, dao relationdbdao.IPrimaryDao, permissionService IPermissionService) *EntityService

func (*EntityService) CollectionInsert

func (s *EntityService) CollectionInsert(ctx context.Context, name, id, attrName string, data datamodels.Record) (datamodels.Record, error)

func (*EntityService) CollectionList

func (s *EntityService) CollectionList(ctx context.Context, name, id, attrName string, pagination datamodels.Pagination, filters []datamodels.Filter, sorts []datamodels.Sort) ([]datamodels.Record, int64, error)

func (*EntityService) Delete

func (s *EntityService) Delete(ctx context.Context, name string, id interface{}) error

func (*EntityService) Insert

func (s *EntityService) Insert(ctx context.Context, name string, data datamodels.Record) (datamodels.Record, error)

func (*EntityService) JunctionDelete

func (s *EntityService) JunctionDelete(ctx context.Context, name, id, attrName string, targetIds []interface{}) error

func (*EntityService) JunctionList

func (s *EntityService) JunctionList(ctx context.Context, name, id, attrName string, exclude bool, pagination datamodels.Pagination, filters []datamodels.Filter, sorts []datamodels.Sort) ([]datamodels.Record, int64, error)

func (*EntityService) JunctionSave

func (s *EntityService) JunctionSave(ctx context.Context, name, id, attrName string, targetIds []interface{}) error

func (*EntityService) List

func (s *EntityService) List(ctx context.Context, name string, pagination datamodels.Pagination, filters []datamodels.Filter, sorts []datamodels.Sort) ([]datamodels.Record, int64, error)

func (*EntityService) Single

func (s *EntityService) Single(ctx context.Context, name string, id interface{}) (datamodels.Record, error)

func (*EntityService) Update

func (s *EntityService) Update(ctx context.Context, name string, data datamodels.Record) (datamodels.Record, error)

type GraphQLService

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

func NewGraphQLService

func NewGraphQLService(schemaService ISchemaService, entityService IEntityService) *GraphQLService

func (*GraphQLService) BuildSchema

func (s *GraphQLService) BuildSchema(ctx context.Context) (graphql.Schema, error)

func (*GraphQLService) ExecuteStoredQuery

func (s *GraphQLService) ExecuteStoredQuery(ctx context.Context, name string, variables map[string]interface{}) (interface{}, error)

func (*GraphQLService) Query

func (s *GraphQLService) Query(ctx context.Context, query string, variables map[string]interface{}) (interface{}, error)

type IA2AService

type IA2AService interface {
	GetHandler() a2asrv.RequestHandler
	GetAgentCard() *a2a.AgentCard
}

type IA2UIService

type IA2UIService interface {
	UpdateComponent(ctx context.Context, component A2UIComponent)
	GetComponent(id string) (A2UIComponent, bool)
	GetFullState() []A2UIComponent
	Subscribe() (chan []A2UIComponent, string)
	Unsubscribe(id string)
}

IA2UIService defines the methods for managing A2UI state.

type IAssetService

type IAssetService interface {
	Save(ctx context.Context, asset *descriptors.Asset) (*descriptors.Asset, error)
	UpdateAssetsLinks(ctx context.Context, oldAssetIds []int64, newAssetPaths []string, entityName string, recordId int64) error
	GetAssetByPath(ctx context.Context, path string) (*descriptors.Asset, error)
}

type IAuditService

type IAuditService interface {
	List(ctx context.Context, pagination datamodels.Pagination) ([]*descriptors.AuditLog, error)
	ById(ctx context.Context, id int64) (*descriptors.AuditLog, error)
	Log(ctx context.Context, log *descriptors.AuditLog) error
}

type IAuthService

type IAuthService interface {
	Register(ctx context.Context, email, password string) (*descriptors.User, error)
	Login(ctx context.Context, email, password string) (string, error)
	LoginByChannel(ctx context.Context, channelType descriptors.ChannelType, identifier string, token string, ip, ua string) (string, error)
	Me(ctx context.Context, userId int64) (*descriptors.User, error)
	ValidateToken(token string) (int64, []string, error)
	ValidateChannelToken(ctx context.Context, channelType descriptors.ChannelType, token string) (int64, string, error)
	GetRoleByName(ctx context.Context, name string) (*descriptors.Role, error)
}

type IChannelService

type IChannelService interface {
	RegisterChannel(ctx context.Context, userId int64, channelType descriptors.ChannelType, identifier string, metadata map[string]interface{}) (*descriptors.UserChannel, error)
	VerifyChannel(ctx context.Context, userId int64, channelType descriptors.ChannelType, token string) (bool, error)
	GetChannelsByUserId(ctx context.Context, userId int64) ([]*descriptors.UserChannel, error)
	LogAuthAttempt(ctx context.Context, log *descriptors.AuthLog) error
	GetAuthLogs(ctx context.Context, userId int64, pagination datamodels.Pagination) ([]*descriptors.AuthLog, int64, error)
	SendNotification(ctx context.Context, userId int64, message string, preferredChannels []descriptors.ChannelType) error
	HandleInbound(ctx context.Context, channelType descriptors.ChannelType, identifier string, payload map[string]interface{}) error
}

type ICommentService

type ICommentService interface {
	List(ctx context.Context, entityName string, recordId int64, pagination datamodels.Pagination) ([]*descriptors.Comment, error)
	Single(ctx context.Context, id string) (*descriptors.Comment, error)
	Save(ctx context.Context, comment *descriptors.Comment) (*descriptors.Comment, error)
	Delete(ctx context.Context, userId, id string) error
}

type IEngagementService

type IEngagementService interface {
	Track(ctx context.Context, status *descriptors.EngagementStatus) error
}

type IEntityService

type IEntityService interface {
	List(ctx context.Context, name string, pagination datamodels.Pagination, filters []datamodels.Filter, sorts []datamodels.Sort) ([]datamodels.Record, int64, error)
	Single(ctx context.Context, name string, id interface{}) (datamodels.Record, error)
	Insert(ctx context.Context, name string, data datamodels.Record) (datamodels.Record, error)
	Update(ctx context.Context, name string, data datamodels.Record) (datamodels.Record, error)
	Delete(ctx context.Context, name string, id interface{}) error

	CollectionList(ctx context.Context, name, id, attr string, pagination datamodels.Pagination, filters []datamodels.Filter, sorts []datamodels.Sort) ([]datamodels.Record, int64, error)
	CollectionInsert(ctx context.Context, name, id, attr string, data datamodels.Record) (datamodels.Record, error)

	JunctionList(ctx context.Context, name, id, attr string, exclude bool, pagination datamodels.Pagination, filters []datamodels.Filter, sorts []datamodels.Sort) ([]datamodels.Record, int64, error)
	JunctionSave(ctx context.Context, name, id, attr string, targetIds []interface{}) error
	JunctionDelete(ctx context.Context, name, id, attr string, targetIds []interface{}) error
}

type IGraphQLService

type IGraphQLService interface {
	Query(ctx context.Context, query string, variables map[string]interface{}) (interface{}, error)
	ExecuteStoredQuery(ctx context.Context, name string, variables map[string]interface{}) (interface{}, error)
}

type IMCPService

type IMCPService interface {
	GetServer() *mcp.Server
}

type INotificationService

type INotificationService interface {
	List(ctx context.Context, userId string, pagination datamodels.Pagination) ([]*descriptors.Notification, error)
	Send(ctx context.Context, notification *descriptors.Notification) error
	MarkAsRead(ctx context.Context, userId string, id int64) error
	MarkAllAsRead(ctx context.Context, userId string) error
}

type IPageService

type IPageService interface {
	Render(ctx context.Context, path string, strArgs datamodels.StrArgs) (string, error)
}

type IPermissionService

type IPermissionService interface {
	HasAccess(ctx context.Context, userId int64, roles []string, entityName, action string) (bool, error)
	GetRowFilters(ctx context.Context, userId int64, entityName string) ([]datamodels.Filter, error)
	GetFieldPermissions(ctx context.Context, entityName string, roles []string) (map[string]map[string]bool, error)
}

type ISchemaService

type ISchemaService interface {
	All(ctx context.Context, schemaType *descriptors.SchemaType, names []string, status *descriptors.PublicationStatus) ([]*descriptors.Schema, error)
	ById(ctx context.Context, id int64) (*descriptors.Schema, error)
	BySchemaId(ctx context.Context, schemaId string) (*descriptors.Schema, error)
	ByNameOrDefault(ctx context.Context, name string, schemaType descriptors.SchemaType, status *descriptors.PublicationStatus) (*descriptors.Schema, error)
	ByStartsOrDefault(ctx context.Context, name string, schemaType descriptors.SchemaType, status *descriptors.PublicationStatus) (*descriptors.Schema, error)
	LoadEntity(ctx context.Context, name string) (*descriptors.Entity, error)
	LoadLoadedEntity(ctx context.Context, name string) (*descriptors.LoadedEntity, error)
	Save(ctx context.Context, schema *descriptors.Schema, asPublished bool) (*descriptors.Schema, error)
	Delete(ctx context.Context, schemaId string) error
}

type MCPService

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

func NewMCPService

func NewMCPService(schemaService ISchemaService, entityService IEntityService, authService IAuthService, config descriptors.MCPConfig) *MCPService

func (*MCPService) Authenticate

func (s *MCPService) Authenticate(ctx context.Context, apiKey string) (int64, []string, error)

func (*MCPService) GetServer

func (s *MCPService) GetServer() *mcp.Server

type NotificationService

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

func NewNotificationService

func NewNotificationService(dao relationdbdao.IPrimaryDao) *NotificationService

func (*NotificationService) List

func (*NotificationService) MarkAllAsRead

func (s *NotificationService) MarkAllAsRead(ctx context.Context, userId string) error

func (*NotificationService) MarkAsRead

func (s *NotificationService) MarkAsRead(ctx context.Context, userId string, id int64) error

func (*NotificationService) Send

type PageService

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

func NewPageService

func NewPageService(schemaService ISchemaService, graphqlService IGraphQLService) *PageService

func (*PageService) GetPageData

func (s *PageService) GetPageData(ctx context.Context, page *descriptors.Page, strArgs datamodels.StrArgs) (map[string]interface{}, error)

func (*PageService) Render

func (s *PageService) Render(ctx context.Context, path string, strArgs datamodels.StrArgs) (string, error)

type PermissionService

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

func NewPermissionService

func NewPermissionService(dao relationdbdao.IPrimaryDao, schemaService ISchemaService) *PermissionService

func (*PermissionService) GetFieldPermissions

func (s *PermissionService) GetFieldPermissions(ctx context.Context, entityName string, roles []string) (map[string]map[string]bool, error)

func (*PermissionService) GetRowFilters

func (s *PermissionService) GetRowFilters(ctx context.Context, userId int64, entityName string) ([]datamodels.Filter, error)

func (*PermissionService) HasAccess

func (s *PermissionService) HasAccess(ctx context.Context, userId int64, roles []string, entityName, action string) (bool, error)

type SchemaService

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

func NewSchemaService

func NewSchemaService(dao relationdbdao.IPrimaryDao) *SchemaService

func (*SchemaService) All

func (*SchemaService) ById

func (s *SchemaService) ById(ctx context.Context, id int64) (*descriptors.Schema, error)

func (*SchemaService) ByNameOrDefault

func (s *SchemaService) ByNameOrDefault(ctx context.Context, name string, schemaType descriptors.SchemaType, status *descriptors.PublicationStatus) (*descriptors.Schema, error)

func (*SchemaService) BySchemaId

func (s *SchemaService) BySchemaId(ctx context.Context, schemaId string) (*descriptors.Schema, error)

func (*SchemaService) ByStartsOrDefault

func (s *SchemaService) ByStartsOrDefault(ctx context.Context, name string, schemaType descriptors.SchemaType, status *descriptors.PublicationStatus) (*descriptors.Schema, error)

func (*SchemaService) Delete

func (s *SchemaService) Delete(ctx context.Context, schemaId string) error

func (*SchemaService) LoadEntity

func (s *SchemaService) LoadEntity(ctx context.Context, name string) (*descriptors.Entity, error)

func (*SchemaService) LoadLoadedEntity

func (s *SchemaService) LoadLoadedEntity(ctx context.Context, name string) (*descriptors.LoadedEntity, error)

func (*SchemaService) Save

func (s *SchemaService) Save(ctx context.Context, schema *descriptors.Schema, asPublished bool) (*descriptors.Schema, error)

Jump to

Keyboard shortcuts

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