functions

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package functions builds server-side functions: `backd functions build` bundles each function of a database's Deno project into one file with `deno bundle`, and records the bundles in a manifest that startup checks.

Index

Constants

View Source
const ModuleName = "@backd/functions"

ModuleName is what functions import defineFunction from.

Variables

This section is empty.

Functions

func Build

func Build(ctx context.Context, reg *registry.Registry, opts Options) error

Build bundles every function of every database in reg that has any.

func DenoVersion

func DenoVersion(ctx context.Context, deno string) (string, error)

DenoVersion returns the version of the deno binary.

func JSDocTypes

func JSDocTypes(reg *registry.Registry) string

JSDocTypes generates JSDoc typedefs from every function's input and output JSON Schemas (`backd functions types`), for editor autocomplete on ctx.input and the return value. A function without a schema, or whose schema can't be read or parsed, is skipped (with a comment explaining why for the latter): this never fails outright, so the command always produces something to paste into an editor.

func WriteTypes added in v0.8.2

func WriteTypes(reg *registry.Registry, realm, config string, dryRun bool) (changed, warnings []string, err error)

WriteTypes writes backd.d.ts (and the runtime module it goes with) into the functions project of every database of the realm that has functions; realm "" means every realm. It returns the files it changed, and what the generator couldn't express. With dryRun it writes nothing and returns the files that would change.

Types

type Options

type Options struct {
	Deno  string // the deno binary; default "deno" on the PATH
	Check bool   // type-check TypeScript while bundling
	// Log receives one line per bundled function.
	Log func(format string, args ...any)
}

Options configure a build.

Jump to

Keyboard shortcuts

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