modules

package
v0.0.0-...-732ec5d Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationContext

type ApplicationContext interface {
	ApplicationID() string
	ApplicationVersion() types.ApplicationVersion
	ApplicationStartTime() time.Time
	RuntimeVersion() int
	ApplicationUser() auth.User

	Logger() ApplicationLogger
	LifecycleManager() LifecycleManager

	Schedule(func(*goja.Runtime) error)
	ScheduleNoError(func(*goja.Runtime))

	ExecutionContext() context.Context

	OutOfLoopWaitGroupAdd(int)
	OutOfLoopWaitGroupDone()
}

ApplicationContext is the context of an application as passed to a module instance

type ApplicationLogger

type ApplicationLogger interface {
	RuntimeAuditLog(s string)
}

ApplicationLogger logs application actions

type Collection

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

Collection is a set of NativeModules that belongs to a single application instance

func NewCollection

func NewCollection() *Collection

func (*Collection) BuildRegistry

func (c *Collection) BuildRegistry(sourceLoader SourceLoader) *require.Registry

func (*Collection) EnableModules

func (c *Collection) EnableModules(runtime *goja.Runtime)

func (*Collection) ExecutionResumed

func (c *Collection) ExecutionResumed(ctx context.Context)

func (*Collection) RegisterNativeModule

func (c *Collection) RegisterNativeModule(m NativeModule)

type Dependencies

type Dependencies struct {
	ModLogWebhook                api.WebhookClient
	ChatManager                  *chatmanager.Manager
	PointsManager                *pointsmanager.Manager
	MediaQueue                   *mediaqueue.MediaQueue
	MediaProviders               map[types.MediaType]media.Provider
	Pricer                       *pricer.Pricer
	SkipManager                  *skipmanager.Manager
	OtherMediaQueueMethods       OtherMediaQueueMethods
	PaymentAccountPool           *payment.PaymentAccountPool
	DefaultAccountRepresentative string
	UserCache                    usercache.UserCache
	RewardsHandler               *rewards.Handler
	StatsRegistry                *stats.Registry
}

Dependencies is a "everything and the kitchen sink" struct used for injection of singleton dependencies in modules

type LifecycleManager

type LifecycleManager interface {
	AbortProcess()
	ExitProcess(exitCode int)
}

LifecycleManager can manage the application's execution lifecycle

type NativeModule

type NativeModule interface {
	ModuleLoader() require.ModuleLoader
	ModuleName() string
	IsNodeBuiltin() bool
	AutoRequire() (bool, string)
	ExecutionResumed(context.Context)
}

NativeModule is a module that can be imported into a single application instance

type OtherMediaQueueMethods

type OtherMediaQueueMethods interface {
	MediaEnqueuingPermission() proto.AllowedMediaEnqueuingType
	SetMediaEnqueuingPermission(permission proto.AllowedMediaEnqueuingType, password string)
	NewQueueEntriesAllUnskippable() bool
	SetNewQueueEntriesAllUnskippable(bool)
	MoveQueueEntryWithCost(ctx context.Context, entryID string, up bool, user auth.User) error
}

type SourceLoader

type SourceLoader func(*goja.Runtime, string) ([]byte, error)

SourceLoader is a function responsible for loading sources

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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