deploy

package
v0.2.37 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package deploy pushes a function to a hosted altengine functions instance.

The server does no build and resolves no imports: it stores exactly the one ES module it is given. So bundling happens HERE — esbuild flattens the entry file and everything it imports into a single module before upload. That keeps the runtime free of a package resolver, and means what you tested locally is byte-for-byte what runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bundle

func Bundle(entry string, minify bool) (string, error)

Bundle flattens entry and its imports into one ES module.

Targeted at the same runtime the hosted service pins, so a syntax level the sandbox cannot parse fails here — on your machine, with a filename and line number — rather than as an opaque 500 on the first request after deploy.

Types

type Config

type Config struct {
	BaseURL  string // e.g. https://api.altengine.net
	APIKey   string
	Instance string // the functions instance name, as shown in the console
}

Config is everything needed to reach an instance. Flags win over environment.

func (Config) Activate

func (c Config) Activate(fnName string, version int) error

Activate points traffic at an already-deployed version. No upload — a rollback moves a pointer, so it is fast and cannot fail halfway.

func (Config) Delete

func (c Config) Delete(fnName string) error

Delete removes a function: it stops serving, its schedules stop, and every stored version goes.

func (Config) DeleteVersion

func (c Config) DeleteVersion(fnName string, version int) error

DeleteVersion removes one stored version that is not being served.

func (Config) Deploy

func (c Config) Deploy(fnName, code string, grants map[string]string, schedules *[]string, activate bool) (*Result, error)

Deploy uploads code as a new version of the named function.

grants is only sent when non-empty: an omitted grants map INHERITS what the function already has, so a plain redeploy of source never silently drops a function's access to its datastore.

func (Config) List

func (c Config) List() (*Listing, error)

List reports what is currently deployed.

func (Config) Pull

func (c Config) Pull(fnName string, version int) (string, error)

Pull reads a deployed version's source back.

func (Config) Versions

func (c Config) Versions(fnName string) ([]Version, int, error)

Versions lists deploy history for one function, newest first.

type Listing

type Listing struct {
	Instance  string `json:"instance"`
	Host      string `json:"host"`
	Functions []struct {
		Name          string            `json:"name"`
		ActiveVersion int               `json:"active_version"`
		Grants        map[string]string `json:"grants"`
		Schedules     []string          `json:"schedules"`
		CPUMs         int               `json:"cpu_ms"`
		URL           string            `json:"url"`
	} `json:"functions"`
}

Listing is what /v1/functions/:instance returns.

type Result

type Result struct {
	Name      string `json:"name"`
	Version   int    `json:"version"`
	SizeBytes int    `json:"size_bytes"`
	Active    bool   `json:"active"`
}

Result is the server's answer to a successful deploy.

type Version

type Version struct {
	Version   int    `json:"version"`
	SizeBytes int    `json:"size_bytes"`
	SHA256    string `json:"sha256"`
	CreatedAt int64  `json:"created_at"`
	// The address that runs this version, `{slug}--v{n}-fn`. Empty when the server has no
	// tenant host configured.
	URL string `json:"url"`
}

Version is one row of deploy history.

Jump to

Keyboard shortcuts

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