resolver

package
v1.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	HEALTH_CHECK_INTERVAL      = 30 * time.Second // Check plugin health every 30 seconds
	RESTART_BACKOFF_BASE       = 1 * time.Second  // Base backoff time between restart attempts
	MAX_RESTART_ATTEMPTS       = 5                // Maximum restart attempts before marking as failed
	RESTART_BACKOFF_MULTIPLIER = 2                // Exponential backoff multiplier
	PLUGIN_STARTUP_TIMEOUT     = 10 * time.Second // Timeout for plugin startup
)

Plugin health monitoring constants

View Source
const DEFAULT_INTERNAL_PREFIX = "ext"
View Source
const PROJECT_PLUGIN_PREFIX = "plg"
View Source
const RealtimeSystemConsoleNotifyTopic = "system.console.notify"

RealtimeSystemConsoleNotifyTopic is the engine-wide console operator broadcast subject.

Variables

View Source
var UserItemGraphQLObject *graphql.Object

UserItemGraphQLObject is the open-core UserItem GraphQL type.

Functions

func BuildGraphQLWithFactory added in v1.1.7

func BuildGraphQLWithFactory(ctx context.Context, cfg *models.Config, extensionRouter *echo.Group, mainEcho *echo.Echo) (interfaces.GraphQLServerInterface, error)

BuildGraphQLWithFactory creates a GraphQL server using the factory pattern This is the main entry point that routers should use

func GetArgInt added in v1.7.0

func GetArgInt(args map[string]interface{}, key string, def int) int

GetArgInt reads an int GraphQL argument with a default.

func GetArgString added in v1.7.0

func GetArgString(args map[string]interface{}, key string) string

GetArgString reads a string GraphQL argument.

func GetGraphQLServerFactory added in v1.1.7

func GetGraphQLServerFactory() interfaces.GraphQLServerFactory

GetGraphQLServerFactory returns the appropriate factory (pro if available, otherwise core)

func ModelReadableForRole added in v1.7.0

func ModelReadableForRole(role *models.Role, modelName string) bool

ModelReadableForRole reports whether a role may read a model (used to shape the public subscription schema like the query/mutation schema).

func NewCoreGraphQLServerFactory added in v1.1.7

func NewCoreGraphQLServerFactory() interfaces.GraphQLServerFactory

NewCoreGraphQLServerFactory creates a new core GraphQL server factory

func NormalizeUserUsernameArg added in v1.7.0

func NormalizeUserUsernameArg(s string) string

NormalizeUserUsernameArg normalizes an optional create/update username argument.

func PublicProjectDBContext added in v1.7.0

func PublicProjectDBContext(cache *models.ApplicationCache, requestCtx context.Context) context.Context

PublicProjectDBContext returns the context used for GetProjectDriver on project DB operations. Pro SaaS hooks attach tenant routing keys to cache.Ctx; prefer that over the raw request context.

func RealtimeBroadcastBaseTopic added in v1.7.0

func RealtimeBroadcastBaseTopic(projectID, channel string) string

RealtimeBroadcastBaseTopic is the neutral fan-out topic for a broadcast channel.

func RealtimeModelBaseTopic added in v1.7.0

func RealtimeModelBaseTopic(projectID, model string) string

RealtimeModelBaseTopic is the neutral fan-out topic for a model's change stream. Pro may rewrite it (tenant scoping) via Config.RealtimeTopicHook.

func RealtimeSystemProjectEventTopic added in v1.7.0

func RealtimeSystemProjectEventTopic(projectID, eventType string) string

RealtimeSystemProjectEventTopic is the project-scoped subject for fan-out events.

func RealtimeSystemUserNotifyTopic added in v1.7.0

func RealtimeSystemUserNotifyTopic(userID string) string

RealtimeSystemUserNotifyTopic is the per-user subject for operator notifications.

func RequireProjectAdmin added in v1.7.0

func RequireProjectAdmin(cache *models.ApplicationCache) error

RequireProjectAdmin ensures the caller has project admin role.

func RequireProjectArg added in v1.7.0

func RequireProjectArg(args map[string]interface{}, expectedProjectID string) error

RequireProjectArg ensures project_id arg matches the authenticated project.

func ResolveNewUserRole added in v1.7.0

func ResolveNewUserRole(project *models.Project, roleArg string) string

ResolveNewUserRole returns an explicit role arg when set, otherwise the project's registration default.

func SetGraphQLServerFactory added in v1.1.7

func SetGraphQLServerFactory(factory interfaces.GraphQLServerFactory)

SetGraphQLServerFactory allows pro version to inject its own factory

Types

type CodedError

type CodedError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Details string `json:"details,omitempty"`
}

CodedError represents an error with an HTTP status code (mirrors SDK structure)

func (*CodedError) Error

func (e *CodedError) Error() string

type ConvertedGraphQLSchemas

type ConvertedGraphQLSchemas struct {
	Queries   graphql.Fields
	Mutations graphql.Fields
}

ConvertedGraphQLSchemas holds converted GraphQL fields

type CoreGraphQLServerFactory added in v1.1.7

type CoreGraphQLServerFactory struct{}

CoreGraphQLServerFactory implements GraphQLServerFactory for open-core version

func (*CoreGraphQLServerFactory) CreateGraphQLServer added in v1.1.7

func (f *CoreGraphQLServerFactory) CreateGraphQLServer(ctx context.Context, cfg *models.Config, extensionRouter *echo.Group, mainEcho *echo.Echo) (interfaces.GraphQLServerInterface, error)

CreateGraphQLServer creates a core GraphQL server instance

func (*CoreGraphQLServerFactory) SupportsVersion added in v1.1.7

func (f *CoreGraphQLServerFactory) SupportsVersion(version string) bool

SupportsVersion returns true if this factory can create servers for the given version/edition

type GraphQLError added in v1.1.6

type GraphQLError struct {
	Message    string                   `json:"message"`
	Extensions map[string]interface{}   `json:"extensions,omitempty"`
	Path       []interface{}            `json:"path,omitempty"`
	Locations  []map[string]interface{} `json:"locations,omitempty"`
}

GraphQLError represents a GraphQL error with extensions (mirrors GraphQL spec)

func (*GraphQLError) Error added in v1.1.6

func (e *GraphQLError) Error() string

type GraphQLServer

type GraphQLServer struct {
	sync.Mutex

	Cfg *models.Config

	SystemDriver          interfaces.ApitoSystemDB
	SystemDriverReadyChan chan interfaces.ApitoSystemDB

	PrivateSchemObjects *objects.SchemaObjects
	SystemDataloaders   *dl.SystemDataloader

	SystemQueries       graphql.Fields
	SystemQueriesChan   chan *graphql.Fields
	SystemMutations     graphql.Fields
	SystemMutationsChan chan *graphql.Fields

	GraphQLExecutor interfaces.GraphQLExecutorInterface

	BlankaTokenService *services.BrankaToken
	ProjectKeyManager  *services.ProjectKeyManager

	ApitoTokenService *services.ApitoTokenService
	JWTTokenService   *services.JWTService

	//S3          *storage_driver.S3
	AuthService services.AuthServiceInterface
	//JwtService         *services.JWTService
	ProjectDBConnPools *sync.Map

	ProjectCache interfaces.CacheDBInterface

	// for HashiCorp plugins only
	HashiCorpPluginCache map[string]*models.HashiCorpPluginCache
	PluginLoadingState   map[string]bool // Track which plugins are currently being loaded
	PluginMonitor        *PluginMonitor  // Health monitoring and auto-restart for plugins

	// Connection pool monitoring
	ConnectionMonitor *database.ConnectionMonitor // Health monitoring for database connections

	InstalledPluginList   []string
	InstalledHCPluginList []string

	ExtensionRouterList []string
	ExtensionRouter     *echo.Group
	MainEchoInstance    *echo.Echo // Reference to the main Echo instance for route introspection

	RealtimeBus interfaces.RealtimeBus
	KVService   interfaces.KeyValueServiceInterface

	PluginManagerSwapper *hotswap.PluginManagerSwapper

	MicroServiceClient *sync.Map
	// contains filtered or unexported fields
}

func BuildGraphQL

func BuildGraphQL(ctx context.Context, cfg *models.Config, extensionRouter *echo.Group, mainEcho *echo.Echo) (*GraphQLServer, error)

func (*GraphQLServer) AddModelToProjectResolverFn

func (s *GraphQLServer) AddModelToProjectResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) AggregateResolverFn

func (s *GraphQLServer) AggregateResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ApitoFunctionResolverFn

func (s *GraphQLServer) ApitoFunctionResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ApplyNamingV2AfterProjectLoad added in v1.6.0

func (s *GraphQLServer) ApplyNamingV2AfterProjectLoad(ctx context.Context, project *models.Project) error

ApplyNamingV2AfterProjectLoad runs optional Arango physical migration, then in-memory naming V2 schema migration and persistence. Safe to call on every load (no-op when already on V2).

func (*GraphQLServer) Authorize

func (s *GraphQLServer) Authorize() echo.MiddlewareFunc

func (*GraphQLServer) BroadcastSubscribeFn added in v1.7.0

func (s *GraphQLServer) BroadcastSubscribeFn(projectID string) graphql.FieldResolveFn

BroadcastSubscribeFn builds the Subscribe function for the generic `broadcast(channel)` subscription field.

func (*GraphQLServer) BuildServerQueriesAndMutations

func (s *GraphQLServer) BuildServerQueriesAndMutations()

func (*GraphQLServer) BuildSystemParam

func (s *GraphQLServer) BuildSystemParam(i echo.Context, project *models.Project) (*models.CommonSystemParams, error)

func (*GraphQLServer) CacheGraphQLFieldsGeneration

func (s *GraphQLServer) CacheGraphQLFieldsGeneration(ctx context.Context, projectId string, modelName string, val interface{}) error

func (*GraphQLServer) CheckHashiCorpPluginExists

func (s *GraphQLServer) CheckHashiCorpPluginExists(dir string) (int32, error)

func (*GraphQLServer) CheckHashiCorpPluginExistsWithRegistry

func (s *GraphQLServer) CheckHashiCorpPluginExistsWithRegistry(dir string, _hashiCorpPlugins map[string]*protobuff.PluginDetails) (int32, error)

func (*GraphQLServer) ConnectSupportResolverFn

func (s *GraphQLServer) ConnectSupportResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) CountResolverFn

func (s *GraphQLServer) CountResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) CreateConnectionTypeResolverFn

func (s *GraphQLServer) CreateConnectionTypeResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) CreateUserResolverFn added in v1.7.0

func (s *GraphQLServer) CreateUserResolverFn(p graphql.ResolveParams) (interface{}, error)

CreateUserResolverFn creates a project end-user with a bcrypt password.

func (*GraphQLServer) CreateWebHookResolverFn

func (s *GraphQLServer) CreateWebHookResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) DataLoaderFn

func (s *GraphQLServer) DataLoaderFn(ctx context.Context, keys dataloader.Keys) []*dataloader.Result

func (*GraphQLServer) DeleteConnectionFromModelResolverFn added in v1.6.4

func (s *GraphQLServer) DeleteConnectionFromModelResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) DeleteFunctionResolverFn

func (s *GraphQLServer) DeleteFunctionResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) DeleteModelDataFn added in v1.6.4

func (s *GraphQLServer) DeleteModelDataFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) DeleteModelDataFnFn

func (s *GraphQLServer) DeleteModelDataFnFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) DeleteProjectTokenResolverFn added in v1.2.1

func (s *GraphQLServer) DeleteProjectTokenResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) DeleteRoleResolverFn

func (s *GraphQLServer) DeleteRoleResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) DeleteUserResolverFn added in v1.7.0

func (s *GraphQLServer) DeleteUserResolverFn(p graphql.ResolveParams) (interface{}, error)

DeleteUserResolverFn removes a project end-user.

func (*GraphQLServer) DeleteWebHookResolverFn

func (s *GraphQLServer) DeleteWebHookResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) DuplicateModelDataFnFn

func (s *GraphQLServer) DuplicateModelDataFnFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) DuplicateRoleInProjectResolverFn added in v1.7.0

func (s *GraphQLServer) DuplicateRoleInProjectResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) EmitModelChange added in v1.7.0

func (s *GraphQLServer) EmitModelChange(ctx context.Context, projectID, model, event, id string, node interface{})

EmitModelChange publishes a CREATED/UPDATED/DELETED event for a document onto the realtime bus. Best-effort: never blocks or fails the originating mutation.

func (*GraphQLServer) EmitPluginStatusChanged added in v1.7.0

func (s *GraphQLServer) EmitPluginStatusChanged(ctx context.Context, pluginID, status, reason string)

EmitPluginStatusChanged notifies console clients of a plugin load/health transition.

func (*GraphQLServer) EmitProjectLifecycle added in v1.7.0

func (s *GraphQLServer) EmitProjectLifecycle(ctx context.Context, userID, projectID, projectName, eventType string)

EmitProjectLifecycle notifies the project owner of create/update events.

func (*GraphQLServer) EventSubscription

func (s *GraphQLServer) EventSubscription(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ExpireGraphQLFieldCache

func (s *GraphQLServer) ExpireGraphQLFieldCache(ctx context.Context, projectId string, modelName string) error

func (*GraphQLServer) ExpireGraphQLProjectCache

func (s *GraphQLServer) ExpireGraphQLProjectCache(ctx context.Context, projectId string) error

func (*GraphQLServer) GatherFileInfo

func (s *GraphQLServer) GatherFileInfo(image []byte) (*models.FileDetails, error)

upload

func (*GraphQLServer) GenerateProjectTokenResolverFn added in v1.2.1

func (s *GraphQLServer) GenerateProjectTokenResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) GetApplicationCache

func (s *GraphQLServer) GetApplicationCache(router echo.Context) (*models.ApplicationCache, error)

func (*GraphQLServer) GetCacheGraphQLFieldsGeneration

func (s *GraphQLServer) GetCacheGraphQLFieldsGeneration(ctx context.Context, projectId string, modelName string) (*QueryBuilderInformation, error)

func (*GraphQLServer) GetConcreteServer added in v1.1.7

func (s *GraphQLServer) GetConcreteServer() interface{}

GetConcreteServer returns the concrete server instance for controller compatibility

func (*GraphQLServer) GetConnectionManager added in v1.4.0

func (s *GraphQLServer) GetConnectionManager() *database.ConnectionManager

GetConnectionManager returns the connection manager from the executor

func (*GraphQLServer) GetConnectionMonitor added in v1.4.0

func (s *GraphQLServer) GetConnectionMonitor() *database.ConnectionMonitor

GetConnectionMonitor returns the connection monitor

func (*GraphQLServer) GetCurrentProjectResolverFn

func (s *GraphQLServer) GetCurrentProjectResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) GetFunctionProvider

func (s *GraphQLServer) GetFunctionProvider() ([]string, error)

func (*GraphQLServer) GetHashiCorpPluginIDs added in v1.1.7

func (s *GraphQLServer) GetHashiCorpPluginIDs() []string

GetHashiCorpPluginIDs returns the list of loaded HashiCorp plugin IDs

func (*GraphQLServer) GetLoggedInUserFn

func (s *GraphQLServer) GetLoggedInUserFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) GetOrganizationsResolverFn

func (s *GraphQLServer) GetOrganizationsResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) GetPhotosAndCountInfoResolverFn

func (s *GraphQLServer) GetPhotosAndCountInfoResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) GetProjectResolverFn

func (s *GraphQLServer) GetProjectResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) GetSchemaBaseProjectDriverIfNeeded added in v1.7.0

func (s *GraphQLServer) GetSchemaBaseProjectDriverIfNeeded(ctx context.Context, project *models.Project) (interfaces.ProjectDBInterface, bool, error)

GetSchemaBaseProjectDriverIfNeeded returns the base project driver for schema DDL when needed.

func (*GraphQLServer) GetStorageProvider

func (s *GraphQLServer) GetStorageProvider() ([]string, error)

func (*GraphQLServer) GetTeamsResolverFn

func (s *GraphQLServer) GetTeamsResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) GoogleOAuthStateResolverFn added in v1.7.0

func (s *GraphQLServer) GoogleOAuthStateResolverFn(p graphql.ResolveParams) (interface{}, error)

GoogleOAuthStateResolverFn returns an HMAC-signed OAuth state bound to the project and configured redirect URI.

func (*GraphQLServer) HandleApitoFunction

func (s *GraphQLServer) HandleApitoFunction(ctx context.Context, cache *models.ApplicationCache, fnName string, args map[string]interface{}) (interface{}, *models.ApitoFunction, error)

func (*GraphQLServer) HandlePayloadFormattingOld

func (s *GraphQLServer) HandlePayloadFormattingOld(ctx context.Context, param *models.CommonSystemParams, payload map[string]interface{}) (map[string]interface{}, map[string]interface{}, error)

func (*GraphQLServer) LaunchPluginByLanguage

func (s *GraphQLServer) LaunchPluginByLanguage(pluginDetails *protobuff.PluginDetails, pluginDir string) (*exec.Cmd, error)

LaunchPluginByLanguage creates and returns the appropriate command based on plugin language TODO: This function needs a better way to handle:

  • Plugin launch process isolation
  • Resource management and cleanup
  • Health monitoring and auto-restart
  • Security sandboxing
  • Docker-based plugin execution for better isolation
  • Plugin lifecycle management (start, stop, restart, health checks)
  • Multi-platform support (Windows, Linux, macOS)
  • Plugin dependency management
  • Crash recovery and automatic restart
  • Resource limits (CPU, memory, file descriptors)
  • Network isolation and security policies For now, this provides basic language-aware launching

func (*GraphQLServer) ListAllProjectsResolverFn

func (s *GraphQLServer) ListAllProjectsResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListAuditLogsFn

func (s *GraphQLServer) ListAuditLogsFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListAvailableFunctionsResolverFn

func (s *GraphQLServer) ListAvailableFunctionsResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListDetailedModelsDataCountResolverFn

func (s *GraphQLServer) ListDetailedModelsDataCountResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListDetailedModelsDataInfoResolverFn

func (s *GraphQLServer) ListDetailedModelsDataInfoResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListDetailedModelsDataProxyResolverFn

func (s *GraphQLServer) ListDetailedModelsDataProxyResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListDocumentRevisionInfoResolverFn

func (s *GraphQLServer) ListDocumentRevisionInfoResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListExecutableFunctionsResolverFn

func (s *GraphQLServer) ListExecutableFunctionsResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListModelsInfoResolverFn

func (s *GraphQLServer) ListModelsInfoResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListProjectTeams

func (s *GraphQLServer) ListProjectTeams(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListProjectsResolverFn

func (s *GraphQLServer) ListProjectsResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListRoleScopesResolverFn

func (s *GraphQLServer) ListRoleScopesResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListSingleModelDataInfoResolverFn

func (s *GraphQLServer) ListSingleModelDataInfoResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListSingleModelHasManyResolverFn

func (s *GraphQLServer) ListSingleModelHasManyResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ListWebHooksResolverFn

func (s *GraphQLServer) ListWebHooksResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) LoadHashiCorpPlugin

func (s *GraphQLServer) LoadHashiCorpPlugin(ctx context.Context, _dir string, _pluginDetails *protobuff.PluginDetails) (*protobuff.PluginDetails, error)

func (*GraphQLServer) LoadHashiCorpPlugins

func (s *GraphQLServer) LoadHashiCorpPlugins(ctx context.Context) error

func (*GraphQLServer) LoadPlugins

func (s *GraphQLServer) LoadPlugins(ctx context.Context) error

func (*GraphQLServer) LoadProjectCache

func (s *GraphQLServer) LoadProjectCache(ctx context.Context, projectID string) (*models.Project, error)

func (*GraphQLServer) LoadProjectSpecificPlugins

func (s *GraphQLServer) LoadProjectSpecificPlugins(ctx context.Context, cache *models.ApplicationCache) error

LoadProjectSpecificPlugins loads HashiCorp plugins specific to a project into the ApplicationCache

func (*GraphQLServer) LoadedFunctionProviderResolverFn

func (s *GraphQLServer) LoadedFunctionProviderResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) LoginUserResolverFn added in v1.7.0

func (s *GraphQLServer) LoginUserResolverFn(p graphql.ResolveParams) (interface{}, error)

LoginUserResolverFn handles general (password) or Google OAuth code flow and returns a project-scoped API token.

func (*GraphQLServer) ModelChangedSubscribeFn added in v1.7.0

func (s *GraphQLServer) ModelChangedSubscribeFn(projectID, model string) graphql.FieldResolveFn

ModelChangedSubscribeFn builds the Subscribe function for a model's `<model>Changed` subscription field. It returns a channel of change-event maps filtered by the `events` and `id` arguments.

func (*GraphQLServer) ModelFieldOperationResolverFn

func (s *GraphQLServer) ModelFieldOperationResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) MultiResourceResolverFn

func (s *GraphQLServer) MultiResourceResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) MutationResolverFn

func (s *GraphQLServer) MutationResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) NewParam

func (*GraphQLServer) PrepareFileInfo

func (s *GraphQLServer) PrepareFileInfo(router echo.Context, projectID string) (*models.FileDetails, *bytes.Buffer, error)

func (*GraphQLServer) PrintAllPluginRoutes

func (s *GraphQLServer) PrintAllPluginRoutes()

PrintAllPluginRoutes prints only plugin routes from both main Echo instance and extension router Plugin routes are identified by paths that start with HashiCorp plugin IDs (hc-*)

func (*GraphQLServer) ProjectFunctionsInfoResolverFn

func (s *GraphQLServer) ProjectFunctionsInfoResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ProjectModelInfoResolverFn

func (s *GraphQLServer) ProjectModelInfoResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ProjectSchemaRelationGraphResolverFn added in v1.6.6

func (s *GraphQLServer) ProjectSchemaRelationGraphResolverFn(p graphql.ResolveParams) (interface{}, error)

ProjectSchemaRelationGraphResolverFn returns a JSON payload (edges, models, mermaid) for MCP / tooling. Schema is taken from the current application cache project (same scope as projectModelsInfo without model_name).

func (*GraphQLServer) ProjectSpecificInstalledPlugins added in v1.6.0

func (s *GraphQLServer) ProjectSpecificInstalledPlugins(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ProjectUserService added in v1.7.0

func (s *GraphQLServer) ProjectUserService(cache *models.ApplicationCache, ctx context.Context) (*ProjectUserService, error)

func (*GraphQLServer) PublicAuthQueryFields added in v1.7.0

func (s *GraphQLServer) PublicAuthQueryFields() graphql.Fields

PublicAuthQueryFields returns static auth query fields appended to the public GraphQL schema.

func (*GraphQLServer) PublicFunctionRouteAuthorize

func (s *GraphQLServer) PublicFunctionRouteAuthorize() echo.MiddlewareFunc

func (*GraphQLServer) PublishBroadcast added in v1.7.0

func (s *GraphQLServer) PublishBroadcast(ctx context.Context, projectID, channel, event string, payload interface{}) error

PublishBroadcast publishes a generic broadcast message to a channel.

func (*GraphQLServer) PublishConsoleNotify added in v1.7.0

func (s *GraphQLServer) PublishConsoleNotify(ctx context.Context, data *models.SubscriptionEvent) error

PublishConsoleNotify broadcasts an operator notification to all console subscribers.

func (*GraphQLServer) PublishSystemMessage

func (s *GraphQLServer) PublishSystemMessage(ctx context.Context, userID string, data *models.SubscriptionEvent) error

func (*GraphQLServer) RearrangeFieldOfModelResolverFn

func (s *GraphQLServer) RearrangeFieldOfModelResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) RefreshProjectAndReCache added in v1.7.0

func (s *GraphQLServer) RefreshProjectAndReCache(ctx context.Context, projectID string) (*models.Project, error)

RefreshProjectAndReCache reloads project from system DB into ProjectCache (exported for pro publish).

func (*GraphQLServer) RegisterUserSchema added in v1.7.0

func (s *GraphQLServer) RegisterUserSchema()

RegisterUserSchema registers project end-user operations on the system GraphQL schema.

func (*GraphQLServer) RemoveProjectSpecificPluginResolverFn added in v1.6.0

func (s *GraphQLServer) RemoveProjectSpecificPluginResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) ResetUserPasswordResolverFn added in v1.7.0

func (s *GraphQLServer) ResetUserPasswordResolverFn(p graphql.ResolveParams) (interface{}, error)

ResetUserPasswordResolverFn hard-resets a project end-user password (admin only).

func (*GraphQLServer) RetrySchemaOperationResolverFn added in v1.7.0

func (s *GraphQLServer) RetrySchemaOperationResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) RoleUserCountsResolverFn added in v1.7.0

func (s *GraphQLServer) RoleUserCountsResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) RunModelMigrationsResolverFn

func (s *GraphQLServer) RunModelMigrationsResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) RunSchemaChange added in v1.7.0

func (s *GraphQLServer) RunSchemaChange(ctx context.Context, in schemasvc.RunInput) error

RunSchemaChange executes the schema change orchestrator (exported for pro schema versioning publish).

func (*GraphQLServer) SearchSchemaOperationsResolverFn added in v1.7.0

func (s *GraphQLServer) SearchSchemaOperationsResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) SearchSystemUsersResolverFn added in v1.7.0

func (s *GraphQLServer) SearchSystemUsersResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) SearchUsersResolverFn added in v1.7.0

func (s *GraphQLServer) SearchUsersResolverFn(p graphql.ResolveParams) (interface{}, error)

SearchUsersResolverFn lists project end-users for the authenticated project.

func (*GraphQLServer) SendEvent

func (s *GraphQLServer) SendEvent(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) SetConnectionMonitor added in v1.4.0

func (s *GraphQLServer) SetConnectionMonitor(monitor *database.ConnectionMonitor)

SetConnectionMonitor sets the connection monitor

func (*GraphQLServer) SetPluginMonitor added in v1.1.7

func (s *GraphQLServer) SetPluginMonitor(monitor interface{})

SetPluginMonitor sets the plugin monitor

func (*GraphQLServer) SingleResourceResolverFn

func (s *GraphQLServer) SingleResourceResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) StoragePluginInitEnvs added in v1.7.0

func (s *GraphQLServer) StoragePluginInitEnvs(ctx context.Context, projectID string) ([]*protobuff.EnvVariable, error)

StoragePluginInitEnvs loads project storage settings and builds plugin Init env vars.

func (*GraphQLServer) SystemPlugins added in v1.5.0

func (s *GraphQLServer) SystemPlugins(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) SystemUserMetaLoader

func (s *GraphQLServer) SystemUserMetaLoader(ctx context.Context, keys dataloader.Keys) []*dataloader.Result

func (*GraphQLServer) TryGetPlugin added in v1.2.0

func (s *GraphQLServer) TryGetPlugin(pluginID string) *models.HashiCorpPluginCache

TryGetPlugin attempts to get a plugin from cache without blocking This provides public access to plugin cache for controllers

func (*GraphQLServer) UpdateApplicationCache

func (s *GraphQLServer) UpdateApplicationCache(ctx context.Context, projectID string)

func (*GraphQLServer) UpdateModelResolverFn

func (s *GraphQLServer) UpdateModelResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) UpdateProfileResolverFn

func (s *GraphQLServer) UpdateProfileResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) UpdateProjectAuthenticationSettingsResolverFn added in v1.7.0

func (s *GraphQLServer) UpdateProjectAuthenticationSettingsResolverFn(p graphql.ResolveParams) (interface{}, error)

UpdateProjectAuthenticationSettingsResolverFn persists authentication settings for the active project.

func (*GraphQLServer) UpdateProjectResolverFn

func (s *GraphQLServer) UpdateProjectResolverFn(p graphql.ResolveParams) (interface{}, error)

func (s *GraphQLServer) CreateProjectResolverFn(p graphql.ResolveParams) (interface{}, error) {

	userId := param.UserId

	user, err := s.SystemDriver.GetSystemUser(userId)
	if err != nil {
		return nil, err
	}

	if user.AccountUsage == nil {
		user.AccountUsage = &models.AccountUsage{
			XKey:            userId,
			Id:              userId,
			Type:            "usage",
			NumberOfProject: utility.AvailableProjectLimit["free"],
			Limits:          utility.DeveloperAccountPlan["free"],
		}
	}

	if user.AccountUsage != nil && (len(user.AccountUsage.Usages) >= int(user.AccountUsage.NumberOfProject)) {
		return nil, errors.New("You have reached the project limit creation. Please upgrade your plan")
	}

	projectName := p.Args["name"].(string)
	projectDescription := p.Args["description"].(string)

	project, err := s.SystemDriver.CreateProject( projectName, projectDescription, user.ID)
	if err != nil {
		return nil, err
	}

	// add the project info
	//user.Projects = append(user.Projects, projectId)

	err = s.SystemDriver.UpdateUser(user, false)
	if err != nil {
		return nil, err
	}

	return map[string]interface{}{
		"id":          project.ID,
		"name":        project.ProjectName,
		"description": project.ProjectDescription,
	}, nil
}

func (*GraphQLServer) UpdateProjectStorageSettingsResolverFn added in v1.7.0

func (s *GraphQLServer) UpdateProjectStorageSettingsResolverFn(p graphql.ResolveParams) (interface{}, error)

UpdateProjectStorageSettingsResolverFn persists storage settings for the active project.

func (*GraphQLServer) UpdateUserResolverFn added in v1.7.0

func (s *GraphQLServer) UpdateUserResolverFn(p graphql.ResolveParams) (interface{}, error)

UpdateUserResolverFn updates an existing project end-user.

func (*GraphQLServer) UpsertFieldToModelResolverFn

func (s *GraphQLServer) UpsertFieldToModelResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) UpsertFunctionToProjectResolverFn

func (s *GraphQLServer) UpsertFunctionToProjectResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) UpsertModelDataFnFn

func (s *GraphQLServer) UpsertModelDataFnFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) UpsertPluginResolverFn

func (s *GraphQLServer) UpsertPluginResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) UpsertRoleToProjectResolverFn

func (s *GraphQLServer) UpsertRoleToProjectResolverFn(p graphql.ResolveParams) (interface{}, error)

func (*GraphQLServer) WaitForPluginsToLoad

func (s *GraphQLServer) WaitForPluginsToLoad()

WaitForPluginsToLoad waits for all plugins to finish loading

type InputSerialPayload added in v1.1.3

type InputSerialPayload struct {
	Field     string               `json:"field"`
	Serial    int                  `json:"serial"`
	FieldType string               `json:"field_type"`
	Children  []InputSerialPayload `json:"children"`
}

type PluginHealthStatus

type PluginHealthStatus struct {
	PluginID            string
	IsHealthy           bool
	LastHealthCheck     time.Time
	RestartAttempts     int
	LastRestartTime     time.Time
	ConsecutiveFailures int
	Status              string
}

PluginHealthStatus represents the health status of a plugin

type PluginMonitor

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

PluginMonitor handles health monitoring and restart logic for plugins

func NewPluginMonitor

func NewPluginMonitor(server *GraphQLServer) *PluginMonitor

NewPluginMonitor creates a new plugin monitor

func (*PluginMonitor) GetPluginHealthStatus

func (pm *PluginMonitor) GetPluginHealthStatus() map[string]*PluginHealthStatus

GetPluginHealthStatus returns the health status of all monitored plugins

func (*PluginMonitor) RegisterPlugin

func (pm *PluginMonitor) RegisterPlugin(pluginID string)

RegisterPlugin registers a plugin for health monitoring

func (*PluginMonitor) RestartPlugin added in v1.2.0

func (pm *PluginMonitor) RestartPlugin(ctx context.Context, pluginID string) error

RestartPlugin provides a public interface to restart a specific plugin This method is intended for use by controllers and other external components

func (*PluginMonitor) StartMonitoring

func (pm *PluginMonitor) StartMonitoring(ctx context.Context)

StartMonitoring begins the plugin health monitoring process

func (*PluginMonitor) StopMonitoring

func (pm *PluginMonitor) StopMonitoring()

StopMonitoring stops the plugin health monitoring

func (*PluginMonitor) UnregisterPlugin

func (pm *PluginMonitor) UnregisterPlugin(pluginID string)

UnregisterPlugin removes a plugin from health monitoring

type ProjectUserGraphQLHook added in v1.7.0

type ProjectUserGraphQLHook func(s *GraphQLServer, p graphql.ResolveParams) (result interface{}, handled bool, err error)

ProjectUserGraphQLHook runs before the open-core default for a project end-user GraphQL operation. Return handled=true to skip the default implementation.

type ProjectUserGraphQLHooks added in v1.7.0

type ProjectUserGraphQLHooks struct {
	SearchUsers       ProjectUserGraphQLHook
	LoginUser         ProjectUserGraphQLHook
	CreateUser        ProjectUserGraphQLHook
	UpdateUser        ProjectUserGraphQLHook
	DeleteUser        ProjectUserGraphQLHook
	ResetUserPassword ProjectUserGraphQLHook
	GoogleOAuthState  ProjectUserGraphQLHook
}

ProjectUserGraphQLHooks groups optional host-provided overrides for project end-user GraphQL ops.

type ProjectUserGraphQLOperationFieldHook added in v1.7.0

type ProjectUserGraphQLOperationFieldHook func(operation string, field *graphql.Field)

ProjectUserGraphQLOperationFieldHook lets the host extend a named project end-user GraphQL operation field (e.g. add Args). operation is the root field name: createUser, searchUsers, etc. Open-core does not define or interpret host argument names.

type ProjectUserItemFieldsHook added in v1.7.0

type ProjectUserItemFieldsHook func(userItem *graphql.Object)

ProjectUserItemFieldsHook lets the host extend the project end-user GraphQL object. Open-core does not define or interpret host field names.

type ProjectUserService added in v1.7.0

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

func (*ProjectUserService) CountUsersByRole added in v1.7.0

func (svc *ProjectUserService) CountUsersByRole() (map[string]int, error)

CountUsersByRole returns app end-user counts grouped by role for the current project.

func (*ProjectUserService) CreateUserRecord added in v1.7.0

func (svc *ProjectUserService) CreateUserRecord(user *models.User, tenantID string) (*models.User, error)

func (*ProjectUserService) DeleteUserRecord added in v1.7.0

func (svc *ProjectUserService) DeleteUserRecord(userID string) error

func (*ProjectUserService) GetProjectAuthUserRow added in v1.7.0

func (svc *ProjectUserService) GetProjectAuthUserRow(userID string) (*models.ProjectAuthUser, error)

GetProjectAuthUserRow loads the raw project DB users row (includes tenant_id for SaaS shared DB).

func (*ProjectUserService) GetUserByUsernameWithFallback added in v1.7.0

func (svc *ProjectUserService) GetUserByUsernameWithFallback(username, tenantID string) (*models.User, error)

func (*ProjectUserService) GetUserWithFallback added in v1.7.0

func (svc *ProjectUserService) GetUserWithFallback(userID, tenantID string) (*models.User, error)

func (*ProjectUserService) ListByEmailWithFallback added in v1.7.0

func (svc *ProjectUserService) ListByEmailWithFallback(tenantID, email string) ([]*models.User, error)

func (*ProjectUserService) ListByGoogleSubWithFallback added in v1.7.0

func (svc *ProjectUserService) ListByGoogleSubWithFallback(tenantID, googleSub string) ([]*models.User, error)

func (*ProjectUserService) ListByPhoneWithFallback added in v1.7.0

func (svc *ProjectUserService) ListByPhoneWithFallback(tenantID, phone string) ([]*models.User, error)

func (*ProjectUserService) ResolveCreateUsername added in v1.7.0

func (svc *ProjectUserService) ResolveCreateUsername(uid, usernameArg, tenantID string) (string, error)

func (*ProjectUserService) SearchWithFallback added in v1.7.0

func (svc *ProjectUserService) SearchWithFallback(tenantID string, limit, offset int) ([]*models.User, int, error)

func (*ProjectUserService) UpdateUserRecord added in v1.7.0

func (svc *ProjectUserService) UpdateUserRecord(user *models.User, tenantID string) error

func (*ProjectUserService) UserFromProjectRow added in v1.7.0

func (svc *ProjectUserService) UserFromProjectRow(row *models.ProjectAuthUser) *models.User

func (*ProjectUserService) WriteThroughUser added in v1.7.0

func (svc *ProjectUserService) WriteThroughUser(u *models.User, tenantID string)

type QueryBuilderInformation

type QueryBuilderInformation = interfaces.QueryBuilderInformation

QueryBuilderInformation moved to interfaces package for compatibility Keeping this as alias for backward compatibility

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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