forgepb

package
v0.1.46 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StoreAs_name = map[int32]string{
		0: "STORE_AS_UNSPECIFIED",
		1: "STORE_AS_JSONB",
		2: "STORE_AS_TEXT",
		3: "STORE_AS_BLOB",
		4: "STORE_AS_TABLE",
	}
	StoreAs_value = map[string]int32{
		"STORE_AS_UNSPECIFIED": 0,
		"STORE_AS_JSONB":       1,
		"STORE_AS_TEXT":        2,
		"STORE_AS_BLOB":        3,
		"STORE_AS_TABLE":       4,
	}
)

Enum value maps for StoreAs.

View Source
var (
	ServiceVisibility_name = map[int32]string{
		0: "SERVICE_VISIBILITY_UNSPECIFIED",
		1: "SERVICE_VISIBILITY_API",
		2: "SERVICE_VISIBILITY_INTERNAL",
	}
	ServiceVisibility_value = map[string]int32{
		"SERVICE_VISIBILITY_UNSPECIFIED": 0,
		"SERVICE_VISIBILITY_API":         1,
		"SERVICE_VISIBILITY_INTERNAL":    2,
	}
)

Enum value maps for ServiceVisibility.

View Source
var (
	ConfigFieldRole_name = map[int32]string{
		0: "CONFIG_FIELD_ROLE_UNSPECIFIED",
		1: "CONFIG_FIELD_ROLE_MODE",
		2: "CONFIG_FIELD_ROLE_TLS_CERT",
		3: "CONFIG_FIELD_ROLE_TLS_KEY",
		4: "CONFIG_FIELD_ROLE_CORS_ORIGINS",
		5: "CONFIG_FIELD_ROLE_CORS_ALLOW_CREDENTIALS",
	}
	ConfigFieldRole_value = map[string]int32{
		"CONFIG_FIELD_ROLE_UNSPECIFIED":            0,
		"CONFIG_FIELD_ROLE_MODE":                   1,
		"CONFIG_FIELD_ROLE_TLS_CERT":               2,
		"CONFIG_FIELD_ROLE_TLS_KEY":                3,
		"CONFIG_FIELD_ROLE_CORS_ORIGINS":           4,
		"CONFIG_FIELD_ROLE_CORS_ALLOW_CREDENTIALS": 5,
	}
)

Enum value maps for ConfigFieldRole.

View Source
var (
	// optional forge.v1.EntityOptions entity = 50200;
	E_Entity = &file_forge_v1_forge_proto_extTypes[0]
	// Binds a config message to the binary that loads it. See BinaryConfigOptions.
	//
	// optional forge.v1.BinaryConfigOptions binary_config = 50201;
	E_BinaryConfig = &file_forge_v1_forge_proto_extTypes[1]
	// Binds a config message to the frontend that loads it. See
	// FrontendConfigOptions.
	//
	// optional forge.v1.FrontendConfigOptions frontend_config = 50202;
	E_FrontendConfig = &file_forge_v1_forge_proto_extTypes[2]
)

Extension fields to descriptorpb.MessageOptions.

View Source
var (
	// Database column mapping and constraints.
	//
	// Retired: ignored by forge. SQL is the schema — db/migrations drive entity
	// projections. Kept only so legacy protos keep compiling.
	//
	// optional forge.v1.FieldOptions field = 50300;
	E_Field = &file_forge_v1_forge_proto_extTypes[3]
	// Configuration binding to environment variables and CLI flags.
	//
	// optional forge.v1.ConfigFieldOptions config = 50400;
	E_Config = &file_forge_v1_forge_proto_extTypes[4]
)

Extension fields to descriptorpb.FieldOptions.

View Source
var (
	// optional forge.v1.MethodOptions method = 50100;
	E_Method = &file_forge_v1_forge_proto_extTypes[6]
)

Extension fields to descriptorpb.MethodOptions.

View Source
var (
	// optional forge.v1.ServiceOptions service = 50000;
	E_Service = &file_forge_v1_forge_proto_extTypes[5]
)

Extension fields to descriptorpb.ServiceOptions.

View Source
var File_forge_v1_forge_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {

	// Whether authentication is required for this service by default.
	AuthRequired bool `protobuf:"varint,1,opt,name=auth_required,json=authRequired,proto3" json:"auth_required,omitempty"`
	// Authentication provider identifier (e.g., "jwt", "api_key", "oauth2").
	AuthProvider string `protobuf:"bytes,2,opt,name=auth_provider,json=authProvider,proto3" json:"auth_provider,omitempty"`
	// contains filtered or unexported fields
}

AuthConfig defines service-wide authentication defaults. Individual methods can override via MethodOptions.auth_required.

func (*AuthConfig) Descriptor deprecated

func (*AuthConfig) Descriptor() ([]byte, []int)

Deprecated: Use AuthConfig.ProtoReflect.Descriptor instead.

func (*AuthConfig) GetAuthProvider

func (x *AuthConfig) GetAuthProvider() string

func (*AuthConfig) GetAuthRequired

func (x *AuthConfig) GetAuthRequired() bool

func (*AuthConfig) ProtoMessage

func (*AuthConfig) ProtoMessage()

func (*AuthConfig) ProtoReflect

func (x *AuthConfig) ProtoReflect() protoreflect.Message

func (*AuthConfig) Reset

func (x *AuthConfig) Reset()

func (*AuthConfig) String

func (x *AuthConfig) String() string

type BinaryConfigOptions

type BinaryConfigOptions struct {

	// Binary is the cmd/<name> leaf whose process loads this config — the same
	// name `forge scaffold binary` creates and the deploy layer names its
	// workload after. A message annotated with a binary that has no cmd/<name>
	// directory is a generate-time error, not a silently unused config.
	Binary string `protobuf:"bytes,1,opt,name=binary,proto3" json:"binary,omitempty"`
	// Command is the cobra command path BELOW the binary whose process loads
	// this config, one command name per element: ["server", "api"] for
	// `reliant server api`. Empty binds the binary's root config. Two
	// messages may not bind the same (binary, command).
	//
	// forge validates the SHAPE at generate time (each element one command
	// name: non-empty, no whitespace, not a flag) but cannot prove the path
	// exists there: a cobra tree is assembled at runtime by AddCommand calls in
	// any package, from `Use` strings that may be computed, so a static scan
	// would be a guess that is wrong in both directions — and a wrong refusal
	// blocks generate. The exact check runs where the tree is real: the
	// generated Load<Msg>(cmd) refuses a command whose path is not this one.
	Command []string `protobuf:"bytes,2,rep,name=command,proto3" json:"command,omitempty"`
	// contains filtered or unexported fields
}

BinaryConfigOptions binds a config message to the BINARY that loads it, giving each binary its own config surface instead of one project-global AppConfig every process ships.

The problem it solves is ownership, not size: with one shared message, every binary links every field — including credentials it has no business reading — and removing a field for one binary removes it for all of them. Annotating a message with a binary makes that message THAT binary's config: forge generates a loader, a KCL schema and an env projection per binary, so a workload's Deployment carries only ITS binary's env vars and deleting a field from one binary's config cannot affect another's.

Ownership is disjoint; DEFINITIONS may still be shared. Every binary wanting a log level is not duplication — they are separate values on separate processes. Compose a shared message (conventionally BaseConfig) as a field on each binary's config and its leaves are registered once per binary, resolved independently at runtime.

This is an ANNOTATION rather than a naming convention for the same reason ConfigFieldRole is: behavior follows the annotation, never the identifier. Renaming AdminConfig does not re-point it at another binary, and naming a message GatewayConfig does not silently make it the gateway's config.

A project that annotates NOTHING is unchanged: its single AppConfig stays the one config every binary loads. Per-binary config is opt-in.

ONE BINARY, SEVERAL PROCESSES. A binary whose subcommands are different processes (`reliant server api`, `reliant server worker`, `reliant daemon`) scopes a config to a subcommand with `command`, so each process carries only what it reads — the api's credentials never reach the worker's Deployment. The binding is keyed on (binary, command):

  • The ROOT config (no `command`) is the binary-wide surface: every process of the binary loads it, and its flags register as PERSISTENT flags on the binary's root command, so every subcommand inherits them.
  • A COMMAND config is loaded by exactly the process running that subcommand. Its leaves — composed blocks included — register as LOCAL flags on that subcommand, and its loader refuses to load from any other command.

A process therefore reads the root config plus the ONE config declared for its exact command path; command configs do not nest (a config for ["server"] is not inherited by `server api`). The root config and a command config of the same binary may not declare the same env var or flag: one process would read the value twice, from two declarations that can drift.

func (*BinaryConfigOptions) Descriptor deprecated

func (*BinaryConfigOptions) Descriptor() ([]byte, []int)

Deprecated: Use BinaryConfigOptions.ProtoReflect.Descriptor instead.

func (*BinaryConfigOptions) GetBinary

func (x *BinaryConfigOptions) GetBinary() string

func (*BinaryConfigOptions) GetCommand

func (x *BinaryConfigOptions) GetCommand() []string

func (*BinaryConfigOptions) ProtoMessage

func (*BinaryConfigOptions) ProtoMessage()

func (*BinaryConfigOptions) ProtoReflect

func (x *BinaryConfigOptions) ProtoReflect() protoreflect.Message

func (*BinaryConfigOptions) Reset

func (x *BinaryConfigOptions) Reset()

func (*BinaryConfigOptions) String

func (x *BinaryConfigOptions) String() string

type ConfigFieldOptions

type ConfigFieldOptions struct {

	// Environment variable name to read this field from (e.g., "DATABASE_URL").
	// A variable set to "" counts as unset, whatever the field's type: the file
	// or default value stands. An explicitly empty value is a flag's to set.
	EnvVar string `protobuf:"bytes,1,opt,name=env_var,json=envVar,proto3" json:"env_var,omitempty"`
	// CLI flag name, without leading dashes (e.g., "database-url").
	Flag string `protobuf:"bytes,2,opt,name=flag,proto3" json:"flag,omitempty"`
	// Default value as a string. Applied when neither env var nor flag is set.
	DefaultValue string `protobuf:"bytes,3,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"`
	// Whether this field must be provided. Startup fails if missing.
	Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"`
	// Human-readable description shown in --help output and documentation.
	Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
	// Sensitive marks this field as secret — its value MUST come from a
	// Kubernetes Secret (or equivalent) rather than a literal env-var, and
	// it is never written to forge.yaml inline. The deploy generator emits
	// a `secretKeyRef`-shaped EnvVar referencing a project-level Secret
	// (default name: <project>-secrets, key: <env_var>).
	Sensitive bool `protobuf:"varint,6,opt,name=sensitive,proto3" json:"sensitive,omitempty"`
	// Category groups related fields for KCL emission. Fields with the same
	// category are rendered together as a single env-var group (e.g.
	// category: "stripe" → STRIPE_ENV bundle). Empty category lands the
	// field in the default APP_ENV bundle.
	Category string `protobuf:"bytes,7,opt,name=category,proto3" json:"category,omitempty"`
	// Role tags a field with a SEMANTIC meaning that drives behavior, so
	// forge/pkg/config can offer annotation-driven helpers without matching
	// on the field's NAME. Renaming a field never changes behavior — the
	// behavior follows the annotation. Naming a field "environment" without
	// the annotation does NOT make it the mode field.
	Role ConfigFieldRole `protobuf:"varint,8,opt,name=role,proto3,enum=forge.v1.ConfigFieldRole" json:"role,omitempty"`
	// AllowedValues constrains a STRING field to a closed set of valid
	// values, validated at startup by config.Validate. It is the
	// type/annotation-driven replacement for the old name-matched log-format
	// check ("json"/"text"): a string field carrying allowed_values is a
	// string ENUM, rejected when its resolved value is outside the set. The
	// empty value is always permitted (an unset, non-required field). True
	// proto enum fields don't need this — protoreflect already enforces their
	// domain. Renaming the field changes nothing; the set follows the
	// annotation.
	AllowedValues []string `protobuf:"bytes,9,rep,name=allowed_values,json=allowedValues,proto3" json:"allowed_values,omitempty"`
	// Optional marks a field the application TOLERATES being unset, and it is
	// the only way a `sensitive` field is allowed to have no value.
	//
	// WHY sensitive IMPLIES REQUIRED BY DEFAULT. A sensitive field projects to
	// a secret_ref, and forge validates every declared ref against the env's
	// store before anything starts (secrets.ValidateDeclaredRefs). That check
	// exists because the alternative — discovering a missing production
	// credential at runtime — is the failure it was built to prevent, so
	// "declared but absent" must be an error by default.
	//
	// But an OPTIONAL-BY-DESIGN credential is a real thing, and forge had no
	// way to say so. The case that forced this: a config block whose
	// admin_user + admin_password are documented as the tier's ON SWITCH —
	// with either unset the reconciler is deliberately not registered. Every
	// non-sensitive field in that block projects as `str = ""` and unset is
	// fine; only the sensitive one became a hard startup requirement, so an
	// environment that had deliberately not enabled the tier could not start
	// at all. The operator's only recourse was to invent a fake value, which
	// puts a real-looking credential in the store and defeats the check for
	// everyone.
	//
	// So: `optional: true` says the absence is intended. The secret-store
	// validation skips the field, and the runtime required-check skips it too.
	// It is deliberately an OPT-IN — the safe default stays "a declared secret
	// must have a value", and an author has to state the exception.
	//
	// It is an ERROR to set both `required: true` and `optional: true`; they
	// are direct contradictions and forge rejects the pair rather than
	// silently picking one.
	Optional bool `protobuf:"varint,10,opt,name=optional,proto3" json:"optional,omitempty"`
	// EnvVarAliases are further environment variables the field is read from,
	// in order, when env_var is unset: the first one set wins, and a variable
	// set to "" counts as unset, exactly as for env_var. A flag still beats
	// all of them.
	//
	//   string environment = 1 [(forge.v1.config) = {
	//     env_var: "RELIANT_ENV"
	//     env_var_aliases: [{name: "NODE_ENV"}]
	//   }];
	//   int32 port = 2 [(forge.v1.config) = {
	//     env_var: "DAEMON_LISTEN_PORT"
	//     env_var_aliases: [{name: "TOOLS_DAEMON_PORT", deprecated: true}]
	//   }];
	//
	// An alias is for a SETTER forge does not control: a convention another
	// tool owns (NODE_ENV), or an older name a deployment elsewhere still
	// exports. forge's own setters use env_var alone — the KCL env map and the
	// secret store key name only the primary — so every manifest forge renders
	// converges on one name. A flag's --help lists env_var and the permanent
	// aliases; a deprecated alias is never advertised.
	//
	// Aliases need env_var, are read only from the environment, and must not
	// repeat any env var or alias another field of the same process reads;
	// `forge generate` refuses each of those. A frontend config field takes
	// no aliases: its values come from the rendered config document, not
	// from an environment.
	EnvVarAliases []*EnvVarAlias `protobuf:"bytes,11,rep,name=env_var_aliases,json=envVarAliases,proto3" json:"env_var_aliases,omitempty"`
	// contains filtered or unexported fields
}

ConfigFieldOptions defines how a config protobuf field maps to runtime configuration sources (environment variables and CLI flags).

Example usage:

message MyServiceConfig {
  string database_url = 1 [(forge.v1.config) = {
    env_var: "DATABASE_URL",
    flag: "database-url",
    required: true,
    description: "PostgreSQL connection string"
  }];
}

func (*ConfigFieldOptions) Descriptor deprecated

func (*ConfigFieldOptions) Descriptor() ([]byte, []int)

Deprecated: Use ConfigFieldOptions.ProtoReflect.Descriptor instead.

func (*ConfigFieldOptions) GetAllowedValues

func (x *ConfigFieldOptions) GetAllowedValues() []string

func (*ConfigFieldOptions) GetCategory

func (x *ConfigFieldOptions) GetCategory() string

func (*ConfigFieldOptions) GetDefaultValue

func (x *ConfigFieldOptions) GetDefaultValue() string

func (*ConfigFieldOptions) GetDescription

func (x *ConfigFieldOptions) GetDescription() string

func (*ConfigFieldOptions) GetEnvVar

func (x *ConfigFieldOptions) GetEnvVar() string

func (*ConfigFieldOptions) GetEnvVarAliases

func (x *ConfigFieldOptions) GetEnvVarAliases() []*EnvVarAlias

func (*ConfigFieldOptions) GetFlag

func (x *ConfigFieldOptions) GetFlag() string

func (*ConfigFieldOptions) GetOptional

func (x *ConfigFieldOptions) GetOptional() bool

func (*ConfigFieldOptions) GetRequired

func (x *ConfigFieldOptions) GetRequired() bool

func (*ConfigFieldOptions) GetRole

func (x *ConfigFieldOptions) GetRole() ConfigFieldRole

func (*ConfigFieldOptions) GetSensitive

func (x *ConfigFieldOptions) GetSensitive() bool

func (*ConfigFieldOptions) ProtoMessage

func (*ConfigFieldOptions) ProtoMessage()

func (*ConfigFieldOptions) ProtoReflect

func (x *ConfigFieldOptions) ProtoReflect() protoreflect.Message

func (*ConfigFieldOptions) Reset

func (x *ConfigFieldOptions) Reset()

func (*ConfigFieldOptions) String

func (x *ConfigFieldOptions) String() string

type ConfigFieldRole

type ConfigFieldRole int32

ConfigFieldRole enumerates the semantic roles a config field can carry. Today the only role is MODE (the runtime production/development switch that gates dev ergonomics and the explicit auth bypass). Additional roles can be added here as new annotation-driven semantics appear.

const (
	// CONFIG_FIELD_ROLE_UNSPECIFIED is the default: an ordinary config
	// field with no special semantics.
	ConfigFieldRole_CONFIG_FIELD_ROLE_UNSPECIFIED ConfigFieldRole = 0
	// CONFIG_FIELD_ROLE_MODE marks the field whose string value selects the
	// runtime mode: "development"/"dev" → development, anything else →
	// production. config.Mode(msg) keys off THIS field, regardless of its
	// name.
	ConfigFieldRole_CONFIG_FIELD_ROLE_MODE ConfigFieldRole = 1
	// CONFIG_FIELD_ROLE_TLS_CERT and CONFIG_FIELD_ROLE_TLS_KEY mark the two
	// halves of a TLS keypair. config.Validate enforces both-or-neither:
	// setting exactly one is a configuration error (the server would silently
	// fall back to plaintext). Selected by annotation, not by the names
	// "tls_cert_path"/"tls_key_path".
	ConfigFieldRole_CONFIG_FIELD_ROLE_TLS_CERT ConfigFieldRole = 2
	ConfigFieldRole_CONFIG_FIELD_ROLE_TLS_KEY  ConfigFieldRole = 3
	// CONFIG_FIELD_ROLE_CORS_ORIGINS marks the comma-separated CORS allow-list
	// and CONFIG_FIELD_ROLE_CORS_ALLOW_CREDENTIALS marks the credentials bool.
	// config.Validate rejects the spec-invalid combination of a wildcard
	// origin ("*") with credentials=true. Selected by annotation, not by the
	// field names.
	ConfigFieldRole_CONFIG_FIELD_ROLE_CORS_ORIGINS           ConfigFieldRole = 4
	ConfigFieldRole_CONFIG_FIELD_ROLE_CORS_ALLOW_CREDENTIALS ConfigFieldRole = 5
)

func (ConfigFieldRole) Descriptor

func (ConfigFieldRole) Enum

func (x ConfigFieldRole) Enum() *ConfigFieldRole

func (ConfigFieldRole) EnumDescriptor deprecated

func (ConfigFieldRole) EnumDescriptor() ([]byte, []int)

Deprecated: Use ConfigFieldRole.Descriptor instead.

func (ConfigFieldRole) Number

func (ConfigFieldRole) String

func (x ConfigFieldRole) String() string

func (ConfigFieldRole) Type

type EntityOptions

type EntityOptions struct {

	// Database table name. Inferred from the message name (snake_case, pluralized)
	// when left empty.
	Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"`
	// Enable soft-delete semantics (adds a deleted_at column).
	SoftDelete bool `protobuf:"varint,2,opt,name=soft_delete,json=softDelete,proto3" json:"soft_delete,omitempty"`
	// Automatically manage created_at and updated_at timestamp columns.
	Timestamps bool `protobuf:"varint,3,opt,name=timestamps,proto3" json:"timestamps,omitempty"`
	// Composite or single-column indexes to create on this table.
	Indexes []*IndexDef `protobuf:"bytes,4,rep,name=indexes,proto3" json:"indexes,omitempty"`
	// Contract middleware to wire around generated repository methods.
	// Supported values: "tracing", "metrics", "logging".
	Middleware []string `protobuf:"bytes,5,rep,name=middleware,proto3" json:"middleware,omitempty"`
	// contains filtered or unexported fields
}

EntityOptions defines how a protobuf message maps to a database table.

DEPRECATED — Retired: ignored by forge. SQL is the schema — db/migrations drive entity projections. Kept for one release so legacy projects' protos keep compiling; remove the annotations from your protos.

func (*EntityOptions) Descriptor deprecated

func (*EntityOptions) Descriptor() ([]byte, []int)

Deprecated: Use EntityOptions.ProtoReflect.Descriptor instead.

func (*EntityOptions) GetIndexes

func (x *EntityOptions) GetIndexes() []*IndexDef

func (*EntityOptions) GetMiddleware

func (x *EntityOptions) GetMiddleware() []string

func (*EntityOptions) GetSoftDelete

func (x *EntityOptions) GetSoftDelete() bool

func (*EntityOptions) GetTable

func (x *EntityOptions) GetTable() string

func (*EntityOptions) GetTimestamps

func (x *EntityOptions) GetTimestamps() bool

func (*EntityOptions) ProtoMessage

func (*EntityOptions) ProtoMessage()

func (*EntityOptions) ProtoReflect

func (x *EntityOptions) ProtoReflect() protoreflect.Message

func (*EntityOptions) Reset

func (x *EntityOptions) Reset()

func (*EntityOptions) String

func (x *EntityOptions) String() string

type EnvVarAlias

type EnvVarAlias struct {

	// Name is the environment variable, e.g. "NODE_ENV".
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Deprecated marks a name kept only so existing setters keep working
	// while they move to env_var. A process that finds it set prints one
	// line to stderr at load naming env_var, whether the alias supplied the
	// value or was shadowed by an earlier name. A permanent alias (the
	// default) is read silently: NODE_ENV is somebody else's convention, not
	// a migration in flight, and a notice at every start would be noise.
	Deprecated bool `protobuf:"varint,2,opt,name=deprecated,proto3" json:"deprecated,omitempty"`
	// contains filtered or unexported fields
}

EnvVarAlias is one fallback environment variable of a config field. See ConfigFieldOptions.env_var_aliases.

func (*EnvVarAlias) Descriptor deprecated

func (*EnvVarAlias) Descriptor() ([]byte, []int)

Deprecated: Use EnvVarAlias.ProtoReflect.Descriptor instead.

func (*EnvVarAlias) GetDeprecated

func (x *EnvVarAlias) GetDeprecated() bool

func (*EnvVarAlias) GetName

func (x *EnvVarAlias) GetName() string

func (*EnvVarAlias) ProtoMessage

func (*EnvVarAlias) ProtoMessage()

func (*EnvVarAlias) ProtoReflect

func (x *EnvVarAlias) ProtoReflect() protoreflect.Message

func (*EnvVarAlias) Reset

func (x *EnvVarAlias) Reset()

func (*EnvVarAlias) String

func (x *EnvVarAlias) String() string

type FieldOptions

type FieldOptions struct {

	// Mark this field as the primary key.
	Pk bool `protobuf:"varint,1,opt,name=pk,proto3" json:"pk,omitempty"`
	// How to store complex or non-scalar types in the database.
	Store StoreAs `protobuf:"varint,3,opt,name=store,proto3,enum=forge.v1.StoreAs" json:"store,omitempty"`
	// Foreign key reference in "table.column" format (e.g., "users.id").
	Ref string `protobuf:"bytes,4,opt,name=ref,proto3" json:"ref,omitempty"`
	// Column has a UNIQUE constraint.
	Unique bool `protobuf:"varint,5,opt,name=unique,proto3" json:"unique,omitempty"`
	// Create a single-column index on this field.
	Index bool `protobuf:"varint,6,opt,name=index,proto3" json:"index,omitempty"`
	// SQL default expression (e.g., "0", "'active'", "NOW()").
	DefaultValue string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"`
	// Skip this field in code generation entirely.
	Skip bool `protobuf:"varint,8,opt,name=skip,proto3" json:"skip,omitempty"`
	// Application-layer validation rules for this field.
	Validate *ValidationRules `protobuf:"bytes,9,opt,name=validate,proto3" json:"validate,omitempty"`
	// Field cannot be updated after initial creation.
	Immutable bool `protobuf:"varint,10,opt,name=immutable,proto3" json:"immutable,omitempty"`
	// contains filtered or unexported fields
}

FieldOptions defines how a protobuf field maps to a database column.

DEPRECATED — Retired: ignored by forge. SQL is the schema — db/migrations drive entity projections. Kept for one release so legacy projects' protos keep compiling; remove the annotations from your protos.

func (*FieldOptions) Descriptor deprecated

func (*FieldOptions) Descriptor() ([]byte, []int)

Deprecated: Use FieldOptions.ProtoReflect.Descriptor instead.

func (*FieldOptions) GetDefaultValue

func (x *FieldOptions) GetDefaultValue() string

func (*FieldOptions) GetImmutable

func (x *FieldOptions) GetImmutable() bool

func (*FieldOptions) GetIndex

func (x *FieldOptions) GetIndex() bool

func (*FieldOptions) GetPk

func (x *FieldOptions) GetPk() bool

func (*FieldOptions) GetRef

func (x *FieldOptions) GetRef() string

func (*FieldOptions) GetSkip

func (x *FieldOptions) GetSkip() bool

func (*FieldOptions) GetStore

func (x *FieldOptions) GetStore() StoreAs

func (*FieldOptions) GetUnique

func (x *FieldOptions) GetUnique() bool

func (*FieldOptions) GetValidate

func (x *FieldOptions) GetValidate() *ValidationRules

func (*FieldOptions) ProtoMessage

func (*FieldOptions) ProtoMessage()

func (*FieldOptions) ProtoReflect

func (x *FieldOptions) ProtoReflect() protoreflect.Message

func (*FieldOptions) Reset

func (x *FieldOptions) Reset()

func (*FieldOptions) String

func (x *FieldOptions) String() string

type FrontendConfigOptions

type FrontendConfigOptions struct {

	// Frontend is the forge.yaml `frontends[].name` whose bundle loads this
	// config — the same name `forge scaffold frontend` creates. A message
	// annotated with a frontend that no forge.yaml declares is a
	// generate-time error, not a silently unused config.
	Frontend string `protobuf:"bytes,1,opt,name=frontend,proto3" json:"frontend,omitempty"`
	// contains filtered or unexported fields
}

FrontendConfigOptions binds a config message to the FRONTEND that loads it, making a frontend a first-class consumer of the same declared, typed, defaulted config surface a binary gets.

It is the browser twin of BinaryConfigOptions and shares its reasoning: ownership is disjoint (a frontend's generated TypeScript module, KCL schema and per-env projection are built from the message carrying its name, so deleting a field from one frontend cannot reach another's), while DEFINITIONS may still be shared. The OIDC issuer both halves of an authenticated app need is ONE fact: compose a shared message onto both the binary's config and the frontend's, and the two cannot drift.

It differs from BinaryConfigOptions in exactly one way, and the difference is the point:

A BINARY's config may hold secrets. A FRONTEND's may not.

Everything a browser reads is public. A frontend's config is delivered to the client and is readable by anyone who opens devtools — there is no browser analogue of a Kubernetes Secret, and no amount of care at the deploy layer changes that. So `sensitive: true` — which on a binary means "this value comes from a Secret, never a literal env var" — has no safe meaning here at all.

forge therefore treats a sensitive field reaching a frontend config as a GENERATE-TIME ERROR rather than a warning or a runtime check. A warning would be discovered after the value had already shipped in a bundle, and a leaked credential cannot be un-shipped: the only useful moment to refuse is before the value is ever written down. Split the secret out into a binary-bound message and let the backend hold it; if the browser genuinely needs the capability, it needs a token minted by the backend, not the credential itself.

A project that annotates NOTHING is unchanged. Frontend config is opt-in.

func (*FrontendConfigOptions) Descriptor deprecated

func (*FrontendConfigOptions) Descriptor() ([]byte, []int)

Deprecated: Use FrontendConfigOptions.ProtoReflect.Descriptor instead.

func (*FrontendConfigOptions) GetFrontend

func (x *FrontendConfigOptions) GetFrontend() string

func (*FrontendConfigOptions) ProtoMessage

func (*FrontendConfigOptions) ProtoMessage()

func (*FrontendConfigOptions) ProtoReflect

func (x *FrontendConfigOptions) ProtoReflect() protoreflect.Message

func (*FrontendConfigOptions) Reset

func (x *FrontendConfigOptions) Reset()

func (*FrontendConfigOptions) String

func (x *FrontendConfigOptions) String() string

type IndexDef

type IndexDef struct {

	// Index name. Auto-generated from field names when left empty.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Column names included in this index, in order.
	Fields []string `protobuf:"bytes,2,rep,name=fields,proto3" json:"fields,omitempty"`
	// Whether this index enforces a uniqueness constraint.
	Unique bool `protobuf:"varint,3,opt,name=unique,proto3" json:"unique,omitempty"`
	// contains filtered or unexported fields
}

IndexDef defines a database index on one or more columns.

DEPRECATED — Retired: ignored by forge. SQL is the schema — db/migrations drive entity projections. Declare indexes in migration SQL instead.

func (*IndexDef) Descriptor deprecated

func (*IndexDef) Descriptor() ([]byte, []int)

Deprecated: Use IndexDef.ProtoReflect.Descriptor instead.

func (*IndexDef) GetFields

func (x *IndexDef) GetFields() []string

func (*IndexDef) GetName

func (x *IndexDef) GetName() string

func (*IndexDef) GetUnique

func (x *IndexDef) GetUnique() bool

func (*IndexDef) ProtoMessage

func (*IndexDef) ProtoMessage()

func (*IndexDef) ProtoReflect

func (x *IndexDef) ProtoReflect() protoreflect.Message

func (*IndexDef) Reset

func (x *IndexDef) Reset()

func (*IndexDef) String

func (x *IndexDef) String() string

type MethodOptions

type MethodOptions struct {

	// Whether this method requires authentication. Optional so the default
	// (fail-closed: auth required) is distinguishable from an explicit
	// `auth_required = false` opt-out at the proto level.
	// Overrides the service-level AuthConfig.auth_required default.
	AuthRequired *bool `protobuf:"varint,1,opt,name=auth_required,json=authRequired,proto3,oneof" json:"auth_required,omitempty"`
	// Whether this method is idempotent (safe to retry without side effects).
	Idempotent bool `protobuf:"varint,3,opt,name=idempotent,proto3" json:"idempotent,omitempty"`
	// Server-side timeout for this method. Zero means use the service default.
	Timeout *durationpb.Duration `protobuf:"bytes,4,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// Whether callers should supply an idempotency key for this method.
	// This is a convention marker — Forge does not enforce or inspect the key.
	// When set, tooling, docs, and generated clients advise callers to pass a
	// unique key (e.g., an Idempotency-Key header) so the server can safely
	// deduplicate retried mutations.
	IdempotencyKey bool `protobuf:"varint,5,opt,name=idempotency_key,json=idempotencyKey,proto3" json:"idempotency_key,omitempty"`
	// Declared Connect/gRPC error codes this method can return. Codegen
	// surfaces these so handler authors (and LLMs implementing handlers)
	// can see the typed error contract at a glance. Values match
	// connect.Code names — e.g. "NotFound", "PermissionDenied",
	// "InvalidArgument". Empty (or unset) means "no declared errors" — the
	// method either succeeds or returns an undeclared Connect.Code.
	//
	// The list is informational at runtime today; future work may enforce
	// that handlers can only return declared codes.
	Errors []string `protobuf:"bytes,6,rep,name=errors,proto3" json:"errors,omitempty"`
	// contains filtered or unexported fields
}

MethodOptions defines per-method behavior annotations for Connect RPC methods. Apply via [(forge.v1.method) = { ... }] on any rpc definition.

func (*MethodOptions) Descriptor deprecated

func (*MethodOptions) Descriptor() ([]byte, []int)

Deprecated: Use MethodOptions.ProtoReflect.Descriptor instead.

func (*MethodOptions) GetAuthRequired

func (x *MethodOptions) GetAuthRequired() bool

func (*MethodOptions) GetErrors

func (x *MethodOptions) GetErrors() []string

func (*MethodOptions) GetIdempotencyKey

func (x *MethodOptions) GetIdempotencyKey() bool

func (*MethodOptions) GetIdempotent

func (x *MethodOptions) GetIdempotent() bool

func (*MethodOptions) GetTimeout

func (x *MethodOptions) GetTimeout() *durationpb.Duration

func (*MethodOptions) ProtoMessage

func (*MethodOptions) ProtoMessage()

func (*MethodOptions) ProtoReflect

func (x *MethodOptions) ProtoReflect() protoreflect.Message

func (*MethodOptions) Reset

func (x *MethodOptions) Reset()

func (*MethodOptions) String

func (x *MethodOptions) String() string

type ServiceOptions

type ServiceOptions struct {

	// Human-readable service name used in code generation and logging.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// API version string (e.g., "v1", "v2beta1").
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	// Brief description of the service's purpose.
	Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	// Controls how the service is exposed.
	Visibility ServiceVisibility `protobuf:"varint,4,opt,name=visibility,proto3,enum=forge.v1.ServiceVisibility" json:"visibility,omitempty"`
	// Other services this service depends on (for dependency injection).
	Dependencies []string `protobuf:"bytes,5,rep,name=dependencies,proto3" json:"dependencies,omitempty"`
	// Authentication configuration for the service.
	Auth *AuthConfig `protobuf:"bytes,6,opt,name=auth,proto3" json:"auth,omitempty"`
	// The trust domain whose callers this service serves: "user" (the
	// default, when empty) for the product's own signed-in users, or a name
	// the project chooses for another kind of caller ("daemon", "operator").
	// A serverkit.Listener refuses to start when it mounts a service whose
	// audience differs from its chain's Authenticator.Audience(), so a
	// listener authenticating one kind of caller can never serve another
	// kind's RPCs.
	Audience string `protobuf:"bytes,7,opt,name=audience,proto3" json:"audience,omitempty"`
	// contains filtered or unexported fields
}

ServiceOptions defines metadata and behavior for a Connect RPC service. Apply via [(forge.v1.service) = { ... }] on any service definition.

func (*ServiceOptions) Descriptor deprecated

func (*ServiceOptions) Descriptor() ([]byte, []int)

Deprecated: Use ServiceOptions.ProtoReflect.Descriptor instead.

func (*ServiceOptions) GetAudience added in v0.1.46

func (x *ServiceOptions) GetAudience() string

func (*ServiceOptions) GetAuth

func (x *ServiceOptions) GetAuth() *AuthConfig

func (*ServiceOptions) GetDependencies

func (x *ServiceOptions) GetDependencies() []string

func (*ServiceOptions) GetDescription

func (x *ServiceOptions) GetDescription() string

func (*ServiceOptions) GetName

func (x *ServiceOptions) GetName() string

func (*ServiceOptions) GetVersion

func (x *ServiceOptions) GetVersion() string

func (*ServiceOptions) GetVisibility

func (x *ServiceOptions) GetVisibility() ServiceVisibility

func (*ServiceOptions) ProtoMessage

func (*ServiceOptions) ProtoMessage()

func (*ServiceOptions) ProtoReflect

func (x *ServiceOptions) ProtoReflect() protoreflect.Message

func (*ServiceOptions) Reset

func (x *ServiceOptions) Reset()

func (*ServiceOptions) String

func (x *ServiceOptions) String() string

type ServiceVisibility

type ServiceVisibility int32

ServiceVisibility determines how a service is exposed.

const (
	// Unspecified; defaults to API visibility.
	ServiceVisibility_SERVICE_VISIBILITY_UNSPECIFIED ServiceVisibility = 0
	// Exposed via HTTP/Connect gateway.
	ServiceVisibility_SERVICE_VISIBILITY_API ServiceVisibility = 1
	// Only accessible for inter-service communication.
	ServiceVisibility_SERVICE_VISIBILITY_INTERNAL ServiceVisibility = 2
)

func (ServiceVisibility) Descriptor

func (ServiceVisibility) Enum

func (ServiceVisibility) EnumDescriptor deprecated

func (ServiceVisibility) EnumDescriptor() ([]byte, []int)

Deprecated: Use ServiceVisibility.Descriptor instead.

func (ServiceVisibility) Number

func (ServiceVisibility) String

func (x ServiceVisibility) String() string

func (ServiceVisibility) Type

type StoreAs

type StoreAs int32

StoreAs controls how complex or non-scalar protobuf types are persisted in the database.

DEPRECATED — Retired: ignored by forge. SQL is the schema — db/migrations drive entity projections. Column storage types live in migration SQL.

const (
	// Inferred from the protobuf type (default behavior).
	StoreAs_STORE_AS_UNSPECIFIED StoreAs = 0
	// Store as a JSONB column (PostgreSQL) or JSON text (SQLite).
	StoreAs_STORE_AS_JSONB StoreAs = 1
	// Store as a TEXT column.
	StoreAs_STORE_AS_TEXT StoreAs = 2
	// Store as a BLOB / BYTEA column.
	StoreAs_STORE_AS_BLOB StoreAs = 3
	// Store in a separate table with a foreign key relationship.
	StoreAs_STORE_AS_TABLE StoreAs = 4
)

func (StoreAs) Descriptor

func (StoreAs) Descriptor() protoreflect.EnumDescriptor

func (StoreAs) Enum

func (x StoreAs) Enum() *StoreAs

func (StoreAs) EnumDescriptor deprecated

func (StoreAs) EnumDescriptor() ([]byte, []int)

Deprecated: Use StoreAs.Descriptor instead.

func (StoreAs) Number

func (x StoreAs) Number() protoreflect.EnumNumber

func (StoreAs) String

func (x StoreAs) String() string

func (StoreAs) Type

func (StoreAs) Type() protoreflect.EnumType

type ValidationRules

type ValidationRules struct {

	// Field value is required (must be non-zero-value).
	Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"`
	// Minimum length for string fields.
	MinLength int32 `protobuf:"varint,2,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
	// Maximum length for string fields.
	MaxLength int32 `protobuf:"varint,3,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
	// Regex pattern the value must match.
	Pattern string `protobuf:"bytes,4,opt,name=pattern,proto3" json:"pattern,omitempty"`
	// Semantic format constraint (e.g., "email", "url", "uuid", "ip").
	Format string `protobuf:"bytes,5,opt,name=format,proto3" json:"format,omitempty"`
	// Minimum value for numeric fields.
	Min float64 `protobuf:"fixed64,6,opt,name=min,proto3" json:"min,omitempty"`
	// Maximum value for numeric fields.
	Max float64 `protobuf:"fixed64,7,opt,name=max,proto3" json:"max,omitempty"`
	// Allowed values (for enum-like string fields).
	AllowedValues []string `protobuf:"bytes,8,rep,name=allowed_values,json=allowedValues,proto3" json:"allowed_values,omitempty"`
	// Custom validation function name to call during validation.
	Custom string `protobuf:"bytes,9,opt,name=custom,proto3" json:"custom,omitempty"`
	// contains filtered or unexported fields
}

ValidationRules defines application-layer constraints enforced during code generation. These do not affect the database schema directly.

func (*ValidationRules) Descriptor deprecated

func (*ValidationRules) Descriptor() ([]byte, []int)

Deprecated: Use ValidationRules.ProtoReflect.Descriptor instead.

func (*ValidationRules) GetAllowedValues

func (x *ValidationRules) GetAllowedValues() []string

func (*ValidationRules) GetCustom

func (x *ValidationRules) GetCustom() string

func (*ValidationRules) GetFormat

func (x *ValidationRules) GetFormat() string

func (*ValidationRules) GetMax

func (x *ValidationRules) GetMax() float64

func (*ValidationRules) GetMaxLength

func (x *ValidationRules) GetMaxLength() int32

func (*ValidationRules) GetMin

func (x *ValidationRules) GetMin() float64

func (*ValidationRules) GetMinLength

func (x *ValidationRules) GetMinLength() int32

func (*ValidationRules) GetPattern

func (x *ValidationRules) GetPattern() string

func (*ValidationRules) GetRequired

func (x *ValidationRules) GetRequired() bool

func (*ValidationRules) ProtoMessage

func (*ValidationRules) ProtoMessage()

func (*ValidationRules) ProtoReflect

func (x *ValidationRules) ProtoReflect() protoreflect.Message

func (*ValidationRules) Reset

func (x *ValidationRules) Reset()

func (*ValidationRules) String

func (x *ValidationRules) String() string

Jump to

Keyboard shortcuts

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