program

package
v0.396.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: AGPL-3.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusGeneratingClient = iota
	StatusNotGenerated
	StatusGenerated
)
View Source
const (
	StatusInitializing = iota
	StatusInitialized
)
View Source
const (
	StatusCheckingDependencies = iota
	StatusParsePrivateKey
	StatusSetupDatabase
	StatusSetupFunctions
	StatusLoadSchema
	StatusRunMigrations
	StatusUpdateFunctions
	StatusStartingFunctions
	StatusRunning
	StatusQuitting
)
View Source
const (
	ModeRun = iota
)

Variables

This section is empty.

Functions

func CheckDependencies

func CheckDependencies() tea.Cmd

func FetchLatestVersion added in v0.380.0

func FetchLatestVersion() tea.Cmd

func GenerateClient

func GenerateClient(dir string, schema *proto.Schema, apiName string, outputDir string, makePackage bool, output chan tea.Msg) tea.Cmd

func Init

func Init(dir string) tea.Cmd

func LoadSchema

func LoadSchema(dir, environment string) tea.Cmd

func LoadSecrets

func LoadSecrets(path, environment string) (map[string]string, error)

LoadSecrets lists secrets from the given file and returns a command

func NextMsgCommand

func NextMsgCommand(ch chan tea.Msg) tea.Cmd

func ParsePrivateKey

func ParsePrivateKey(path string) tea.Cmd

func RemoveSecret

func RemoveSecret(path, environment, key string) error

func RenderError

func RenderError(message error) error

func RenderSecrets

func RenderSecrets(secrets map[string]string) string

func RenderSuccess

func RenderSuccess(message string)

func Run

func Run(model *Model)

func RunMigrations

func RunMigrations(schema *proto.Schema, database db.Database) tea.Cmd

func SetSecret

func SetSecret(path, environment, key, value string) error

func SetupFunctions

func SetupFunctions(dir string, nodePackagesPath string, packageManager string) tea.Cmd

func StartDatabase

func StartDatabase(reset bool, mode int, projectDirectory string) tea.Cmd

func StartFunctions

func StartFunctions(m *Model) tea.Cmd

func StartRpcServer added in v0.376.0

func StartRpcServer(port string, ch chan tea.Msg) tea.Cmd

func StartRuntimeServer

func StartRuntimeServer(port string, customHostname string, ch chan tea.Msg) tea.Cmd

func StartTraceServer added in v0.377.0

func StartTraceServer(port string) tea.Cmd

func StartWatcher

func StartWatcher(dir string, ch chan tea.Msg, filter []string) tea.Cmd

func UpdateFunctions

func UpdateFunctions(schema *proto.Schema, cfg *config.ProjectConfig, dir string) tea.Cmd

Types

type ApplyMigrationsError

type ApplyMigrationsError struct {
	Err error
}

func (*ApplyMigrationsError) Error

func (a *ApplyMigrationsError) Error() string

func (*ApplyMigrationsError) Unwrap added in v0.369.1

func (e *ApplyMigrationsError) Unwrap() error

type CheckDependenciesMsg

type CheckDependenciesMsg struct {
	Err error
}

type FetchLatestVersionMsg added in v0.380.0

type FetchLatestVersionMsg struct {
	LatestVersion *semver.Version
}

type FunctionLog

type FunctionLog struct {
	Time  time.Time
	Value string
}

type FunctionsOutputMsg

type FunctionsOutputMsg struct {
	Output string
}

type FunctionsOutputWriter

type FunctionsOutputWriter struct {
	Output []string
	Buffer bool
	// contains filtered or unexported fields
}

func (*FunctionsOutputWriter) Write

func (f *FunctionsOutputWriter) Write(p []byte) (n int, err error)

type GenerateClientModel

type GenerateClientModel struct {
	// The directory of the Keel project
	ProjectDir string
	Package    bool
	Watch      bool
	OutputDir  string
	ApiName    string

	Status int

	Err         error
	Schema      *proto.Schema
	SchemaFiles []*reader.SchemaFile
	Secrets     map[string]string
	Config      *config.ProjectConfig

	GeneratedFiles codegen.GeneratedFiles
	// contains filtered or unexported fields
}

func (*GenerateClientModel) Init

func (m *GenerateClientModel) Init() tea.Cmd

func (*GenerateClientModel) Update

func (m *GenerateClientModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*GenerateClientModel) View

func (m *GenerateClientModel) View() string

type GenerateClientMsg

type GenerateClientMsg struct {
	Err            error
	Status         int
	GeneratedFiles codegen.GeneratedFiles
	Log            string
}

type GenerateMsg

type GenerateMsg struct {
	Err            error
	Status         int
	GeneratedFiles codegen.GeneratedFiles
	Log            string
}

type InitModel

type InitModel struct {
	// The directory of the Keel project
	ProjectDir string

	Err    error
	Status int

	GeneratedFiles codegen.GeneratedFiles
	SkippedFiles   codegen.GeneratedFiles
	// contains filtered or unexported fields
}

func (*InitModel) Init

func (m *InitModel) Init() tea.Cmd

func (*InitModel) Update

func (m *InitModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*InitModel) View

func (m *InitModel) View() string

type InitialisedMsg

type InitialisedMsg struct {
	GeneratedFiles codegen.GeneratedFiles
	SkippedFiles   codegen.GeneratedFiles
	Err            error
}

type LoadSchemaMsg

type LoadSchemaMsg struct {
	Schema      *proto.Schema
	Config      *config.ProjectConfig
	SchemaFiles []*reader.SchemaFile
	Secrets     map[string]string
	Err         error
}

type Model

type Model struct {
	// The directory of the Keel project
	ProjectDir string

	// The mode the Model is running in
	Mode int

	// Port to run the runtime servers on in ModeRun
	Port      string
	RpcPort   string
	TracePort string

	// If true then the database will be reset. Only
	// applies to ModeRun.
	ResetDatabase bool

	// If set then @teamkeel/* npm packages will be installed
	// from this path, rather than NPM.
	NodePackagesPath string

	// Either 'npm' or 'pnpm'
	PackageManager string

	// If set then runtime will be configured with private key
	// located at this path in pem format.
	PrivateKeyPath string

	// The private key to configure on runtime, or nil.
	PrivateKey *rsa.PrivateKey

	// Pattern to pass to vitest to isolate specific tests
	TestPattern string

	// If true then traces will be sent to localhost:4318 instead of the default exporter
	// This does mean that the Console Monitoring page will not reflect any traces.
	CustomTracing bool

	// If true, do not filter events in the local trace exporter.
	// This will then show all system events in the local console.
	VerboseTracing bool

	// A custom configured hostname, which may be necessary to change for SSO callback.
	CustomHostname string

	// Model state - used in View()
	Status            int
	Err               error
	Schema            *proto.Schema
	Config            *config.ProjectConfig
	SchemaFiles       []*reader.SchemaFile
	Database          db.Database
	DatabaseConnInfo  *db.ConnectionInfo
	GeneratedFiles    codegen.GeneratedFiles
	MigrationChanges  []*migrations.DatabaseChange
	FunctionsServer   *node.DevelopmentServer
	RuntimeHandler    http.Handler
	JobHandler        runtime.JobHandler
	SubscriberHandler runtime.SubscriberHandler
	RpcHandler        http.Handler
	RuntimeRequests   []*RuntimeRequest
	FunctionsLog      []*FunctionLog
	Storage           storage.Storer
	TestOutput        string
	Secrets           map[string]string
	Environment       string

	// The current latest version of Keel in NPM
	LatestVersion *semver.Version
	// contains filtered or unexported fields
}

func (*Model) Init

func (m *Model) Init() tea.Cmd

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Model) View

func (m *Model) View() string

type ParsePrivateKeyMsg

type ParsePrivateKeyMsg struct {
	PrivateKey *rsa.PrivateKey
	Err        error
}

type RpcRequestMsg added in v0.376.0

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

type RunMigrationsMsg

type RunMigrationsMsg struct {
	Err     error
	Changes []*migrations.DatabaseChange
}

type RuntimeRequest

type RuntimeRequest struct {
	Time   time.Time
	Method string
	Path   string
}

type RuntimeRequestMsg

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

type SetupFunctionsMsg

type SetupFunctionsMsg struct {
	Err error
}

type StartDatabaseMsg

type StartDatabaseMsg struct {
	ConnInfo *db.ConnectionInfo
	Err      error
}

type StartFunctionsError

type StartFunctionsError struct {
	Err    error
	Output string
}

func (*StartFunctionsError) Error

func (s *StartFunctionsError) Error() string

type StartFunctionsMsg

type StartFunctionsMsg struct {
	Err    error
	Server *node.DevelopmentServer
}

type TypeScriptError

type TypeScriptError struct {
	Output string
	Err    error
}

func (*TypeScriptError) Error

func (t *TypeScriptError) Error() string

type UpdateFunctionsMsg

type UpdateFunctionsMsg struct {
	Err error
}

type WatcherMsg

type WatcherMsg struct {
	Err   error
	Path  string
	Event string
}

Jump to

Keyboard shortcuts

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