apptype

package
v0.15.20 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_MODULE        = "ace"
	DOC_MODULE            = "doc"
	TABLE_MODULE          = "table"
	PARAM_MODULE          = "param"
	APP                   = "app"
	HTML                  = "html"
	API                   = "api"
	PROXY                 = "proxy"
	FRAGMENT              = "fragment"
	STYLE                 = "style"
	REDIRECT              = "redirect"
	PERMISSION            = "permission"
	RESPONSE              = "response"
	CONFIG                = "config"
	LIBRARY               = "library"
	ACTION                = "action"
	RESULT                = "result"
	AUDIT                 = "audit"
	OUTPUT                = "output"
	CONTAINER_URL         = "<CONTAINER_URL>" // special url to use for proxying to the container
	DEFAULT_REDIRECT_CODE = 303
)
View Source
const (
	DEFAULT_DAISYUI_LIGHT_THEME = "emerald"
	DEFAULT_DAISYUI_DARK_THEME  = "night"
)
View Source
const (
	// Constants included in the ace builtin module
	GET       = "GET"
	POST      = "POST"
	PUT       = "PUT"
	DELETE    = "DELETE"
	HTML_TYPE = "HTML"
	JSON      = "JSON"
	TEXT      = "TEXT"
	READ      = "READ"
	WRITE     = "WRITE"

	AUTO     = "AUTO"
	TABLE    = "TABLE"
	DOWNLOAD = "DOWNLOAD"
	IMAGE    = "IMAGE"
)
View Source
const (
	APP_FILE_NAME         = "app.star"
	APP_CONFIG_KEY        = "app"
	DEFAULT_HANDLER       = "handler"
	ERROR_HANDLER         = "error_handler"
	METHODS_DELIMITER     = ","
	CONFIG_LOCK_FILE_NAME = "config_gen.lock"
	SCHEMA_FILE_NAME      = "schema.star"
	PARAMS_FILE_NAME      = "params.star"
	BUILTIN_PLUGIN_SUFFIX = "in"
	STARLARK_FILE_SUFFIX  = ".star"
	INDEX_FILE            = "index.go.html"
	INDEX_GEN_FILE        = "index_gen.go.html"
	CLACE_GEN_FILE        = "openrun_gen.go.html"
	ACCOUNT_SEPARATOR     = "#"
)
View Source
const (
	TYPE  = "type"
	FIELD = "field"
	INDEX = "index"
)
View Source
const (
	PARAM = "param"
)

Variables

This section is empty.

Functions

func CreateBuiltin

func CreateBuiltin(nodeConfig types.NodeConfig, allowedEnv []string) starlark.StringDict

func CreateConfigBuiltin

func CreateConfigBuiltin(nodeConfig types.NodeConfig, allowedEnv []string) func(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func GetBoolAttr

func GetBoolAttr(s starlark.HasAttrs, key string) (bool, error)

func GetCallableAttr

func GetCallableAttr(s starlark.HasAttrs, key string) (starlark.Callable, error)

func GetDictAttr

func GetDictAttr(s starlark.HasAttrs, key string, optional bool) (map[string]any, error)

func GetIntAttr

func GetIntAttr(s starlark.HasAttrs, key string) (int64, error)

func GetListListStringAttr

func GetListListStringAttr(s starlark.HasAttrs, key string, optional bool) ([][]string, error)

func GetListMapAttr

func GetListMapAttr(s starlark.HasAttrs, key string, optional bool) ([]map[string]any, error)

func GetListStringAttr

func GetListStringAttr(s starlark.HasAttrs, key string, optional bool) ([]string, error)

func GetOptionalBoolAttr

func GetOptionalBoolAttr(s starlark.HasAttrs, key string) (bool, error)

func GetOptionalStringAttr

func GetOptionalStringAttr(s starlark.HasAttrs, key string) (string, error)

func GetStringAttr

func GetStringAttr(s starlark.HasAttrs, key string) (string, error)

func GetStringList

func GetStringList(list *starlark.List) ([]string, error)

func LoadParamInfo

func LoadParamInfo(fileName string, data []byte, serverConfig *types.ServerConfig) (map[string]AppParam, error)

func LoadStoreInfo

func LoadStoreInfo(fileName string, data []byte) (*starlark_type.StoreInfo, error)

func ParamStringToType

func ParamStringToType(name string, typeName starlark_type.TypeName, valueStr string) (starlark.Value, error)

func ReadParamInfo

func ReadParamInfo(fileName string, inp []byte, serverConfig *types.ServerConfig) (map[string]AppParam, error)

func ReadStoreInfo

func ReadStoreInfo(fileName string, inp []byte) (*starlark_type.StoreInfo, error)

Types

type AppParam

type AppParam struct {
	Index              int
	Name               string
	Description        string
	Required           bool
	Type               starlark_type.TypeName
	DefaultValue       starlark.Value
	DisplayType        DisplayType
	DisplayTypeOptions string
}

AppParam represents a parameter in an app.

type CodeConfig

type CodeConfig struct {
	Routing RouteConfig `json:"routing"`
	Htmx    HtmxConfig  `json:"htmx"`
}

func NewCodeConfig

func NewCodeConfig() *CodeConfig

NewCodeConfig creates an CodeConfig with default values. This config is used when lock file is not present. The config file load order is

DefaultCodeConfig -> StarlarkCodeConfig

func NewCompatibleCodeConfig

func NewCompatibleCodeConfig() *CodeConfig

NewCompatibleCodeConfig creates an CodeConfig focused on maintaining backward compatibility. This is used when the app is created from a source url where the source has the config lock file present. The configs are read in the order

CompatibleCodeConfig -> LockFile -> StarlarkCodeConfig

The goal is that if the application has a lock file, then all settings will attempt to be locked such that there should not be any change in behavior when the OpenRun version is updated. Removing the lock file will result in new config defaults getting applied, which can be done when the app developer wants to do an application refresh. Refresh will require additional testing to ensure that UI functionality is not changed..

type DeferEntry

type DeferEntry struct {
	Func   DeferFunc
	Strict bool
}

type DeferFunc

type DeferFunc func() error

type DisplayType

type DisplayType string
const (
	DisplayTypePassword   DisplayType = "password"
	DisplayTypeTextArea   DisplayType = "textarea"
	DisplayTypeFileUpload DisplayType = "file"
)

type HtmxConfig

type HtmxConfig struct {
	Version string `json:"version"`
}

type RouteConfig

type RouteConfig struct {
	TemplateLocations []string `json:"template_locations"`
	BaseTemplates     string   `json:"base_templates"`
	PushEvents        bool     `json:"push_events"`
	EarlyHints        bool     `json:"early_hints"`

	// glob patterns for files which are excluded from container content change check
	ContainerExclude []string `json:"container_exclude"`
}

Jump to

Keyboard shortcuts

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