ZapBuilder import type {ZapBuilder} from '@fuzdev/zap/zap.js'; The builder a config declares against. Every method returns the builder for
chaining; the resource methods take ResourceIdentity intersected with the
kind-specific payload (the shim adds type).
target
Declare the zap.target({...}) machine descriptor (local or remote SSH).
type (config: TargetInput): ZapBuilder
config
deploy
Declare the zap.deploy({...}) release-management block zap deploy ships with.
type (config: DeploySpec): ZapBuilder
config
env
A reference to the operator environment variable name: the value is read
from the environment of the machine zap runs on, when the field holding the
reference is used — never while the config is evaluated, which has no
environment.
The result is a string to place in a field that takes a reference — whole
(host: zap.env('DEPLOY_HOST')), interpolated into a template literal, or
concatenated (path: '/srv/' + zap.env('APP') + '/data'). It is opaque:
it holds a marker, not the value, so slicing, splitting, case-changing, or
encoding it leaves something that is no longer a reference: the config fails
to evaluate when part of the marker survives, and otherwise the result is
ordinary text. A field that takes no reference rejects one, naming the
field. A recipe, which has no builder, calls env_ref from
@fuzdev/zap/env_ref.ts for the same string.
type (name: string): string
name
the variable's name: a letter or _, then letters, digits, or _
stringstringa marked string standing for the variable's value
throws
Error- if `name` is not an environment variable's name
mask
Declare env-var names secret: ones zap doesn't recognize by where they are
used, their name, or the form of their value. Each is a variable's name —
'LICENSE_CODE', not zap.env('LICENSE_CODE') — and POSIX
([A-Za-z_][A-Za-z0-9_]*); anything else throws when called.
type (...vars: string[]): ZapBuilder
vars
string[]unmask
Declare env-var names not secret, where zap reads one as a secret by its
name or the form of its value and it isn't. Each is a variable's name, POSIX
([A-Za-z_][A-Za-z0-9_]*); anything else throws when called. Unmasking a
variable the config uses as a fetch credential (auth) is rejected when the
config is read.
type (...vars: string[]): ZapBuilder
vars
string[]pkg
Declare a package resource — a system package via a package manager.
type (config: ResourceIdentity & PackageResource): ZapBuilder
config
ResourceIdentity & PackageResourceapt_repo
Declare an apt_repo resource — a GPG key + sources list.
type (config: ResourceIdentity & AptRepoResource): ZapBuilder
config
ResourceIdentity & AptRepoResourcescript
Declare a script resource — an idempotent command (check / run).
type (config: ResourceIdentity & ScriptResource): ZapBuilder
config
ResourceIdentity & ScriptResourceinstaller
Declare an installer resource — software via a curl-piped script.
type (config: ResourceIdentity & InstallerResource): ZapBuilder
config
user
Declare a user resource — a Unix user (shell, home mode, SSH keys, sudoers).
type (config: ResourceIdentity & UserResource): ZapBuilder
config
ResourceIdentity & UserResourcedirectory
Declare a directory resource — a directory with managed permissions.
type (config: ResourceIdentity & DirectoryResource): ZapBuilder
config
file
Declare a file resource — a file with managed content.
type (config: ResourceIdentity & FileResource): ZapBuilder
config
ResourceIdentity & FileResourcelink
Declare a link resource — a symbolic link.
type (config: ResourceIdentity & LinkResource): ZapBuilder
config
ResourceIdentity & LinkResourceservice
Declare a service resource — service lifecycle management.
type (config: ResourceIdentity & ServiceResource): ZapBuilder
config
ResourceIdentity & ServiceResourcedatabase
Declare a database resource (PostgreSQL only).
type (config: ResourceIdentity & DatabaseResource): ZapBuilder
config
ResourceIdentity & DatabaseResourceswap
Declare a swap resource — a swap file.
type (config: ResourceIdentity & SwapResource): ZapBuilder
config
ResourceIdentity & SwapResourcefirewall
Declare a firewall resource — firewall rules (ufw or nftables).
type (config: ResourceIdentity & FirewallResource): ZapBuilder
config
ResourceIdentity & FirewallResourceverify
Declare a verify resource — assertions checked at detection and again at its place
in dependency order on a wetrun; one still failing there fails the run.
type (config: ResourceIdentity & VerifyResource): ZapBuilder
config
ResourceIdentity & VerifyResourcepipeline
Declare a pipeline resource — imperative multi-step execution.
type (config: ResourceIdentity & PipelineResource): ZapBuilder
config
ResourceIdentity & PipelineResourcebuild
Declare a build resource — fetch a verified source, build it, install to output.
type (config: ResourceIdentity & BuildResource): ZapBuilder
config
ResourceIdentity & BuildResource