node

package
v0.365.15 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FUNCTIONS_DIR   = "functions"
	JOBS_DIR        = "jobs"
	SUBSCRIBERS_DIR = "subscribers"
)

Variables

This section is empty.

Functions

func Bootstrap

func Bootstrap(dir string, opts ...BootstrapOption) (codegen.GeneratedFiles, error)

Bootstrap ensures that the target directory has a package.json file with the correct dependencies required by the Keel Custom Functions runtime, and additionally it ensures that a tsconfig.json file has been generated

func CheckNodeVersion

func CheckNodeVersion() error

func Generate

func Generate(ctx context.Context, schema *proto.Schema, opts ...func(o *generateOptions)) (codegen.GeneratedFiles, error)

Generate generates and returns a list of objects that represent files to be written to a project. Calling .Write() on the result will cause those files be written to disk. This function should not interact with the file system so it can be used in a backend context.

func GenerateClient

func GenerateClient(ctx context.Context, schema *proto.Schema, makePackage bool, apiName string) (codegen.GeneratedFiles, error)

func HasFunctions

func HasFunctions(sch *proto.Schema) bool

HasFunctions returns true if the schema contains any custom functions or jobs.

func HasTests

func HasTests(dir string) bool

HasTests returns true if there any TypeScript test files in dir or any of it's subdirectories.

func IsEnabled

func IsEnabled(dir string, s *proto.Schema) bool

IsEnabled returns true if the provided dir contains any tests or if the provided schema contains any functions.

func Scaffold

func Scaffold(dir string, schema *proto.Schema) (codegen.GeneratedFiles, error)

func WithDevelopmentServer

func WithDevelopmentServer(b bool) func(o *generateOptions)

WithDevelopmentServer enables or disables the generation of the development server entry point. By default this is disabled.

Types

type BootstrapOption

type BootstrapOption func(o *bootstrapOptions)

func WithPackagesPath

func WithPackagesPath(p string) BootstrapOption

WithPackagesPath causes any @teamkeel packages to be installed from this path. The path should point to the directory that contains all the different @teamkeel packages.

type DevelopmentServer

type DevelopmentServer struct {
	URL string
	// contains filtered or unexported fields
}

func RunDevelopmentServer

func RunDevelopmentServer(dir string, options *ServerOpts) (*DevelopmentServer, error)

RunDevelopmentServer will start a new node runtime server serving/handling custom function requests

func (*DevelopmentServer) Kill

func (ds *DevelopmentServer) Kill() error

func (*DevelopmentServer) Output

func (ds *DevelopmentServer) Output() string

type IncorrectNodeVersionError

type IncorrectNodeVersionError struct {
	Current string
	Minimum string
}

func (*IncorrectNodeVersionError) Error

func (n *IncorrectNodeVersionError) Error() string

type NodeNotFoundError

type NodeNotFoundError struct{}

func (*NodeNotFoundError) Error

func (n *NodeNotFoundError) Error() string

type NpmInstallError

type NpmInstallError struct {
	Output string
	// contains filtered or unexported fields
}

func (*NpmInstallError) Error

func (n *NpmInstallError) Error() string

type ServerOpts

type ServerOpts struct {
	Port    string
	EnvVars map[string]string
	Output  io.Writer
	Debug   bool
}

Jump to

Keyboard shortcuts

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