Documentation
¶
Overview ¶
Package appgen emits a generated Go app that embeds build output.
Index ¶
- func BuildBinary(appDir, binaryPath string) (string, error)
- func BuildWASM(appDir, wasmPath string) (string, error)
- func GeneratedAuditTestSource(options Options) ([]byte, error)
- func StandaloneAuditTestSource(config gowdk.Config, manifest securitymanifest.SecurityManifest, ...) ([]byte, error)
- func StandaloneAuditTestSourceWithPackage(packageName string, config gowdk.Config, ...) ([]byte, error)
- type APIEndpoint
- type ActionEndpoint
- type ActionFragment
- type ActionUploadField
- type ActionValidationRule
- type BackendAPIAdapter
- type BackendActionAdapter
- type BackendAdapterIR
- func (ir BackendAdapterIR) BackendImports() map[string]string
- func (ir BackendAdapterIR) GuardNames() []string
- func (ir BackendAdapterIR) HasCORSRoutes() bool
- func (ir BackendAdapterIR) HasCSRFSensitiveAPI() bool
- func (ir BackendAdapterIR) HasDynamicRoutes() bool
- func (ir BackendAdapterIR) HasEndpointKind(kind BackendEndpointKind) bool
- func (ir BackendAdapterIR) HasRegistrations() bool
- type BackendContractExposure
- type BackendDecoder
- type BackendEndpointKind
- type BackendEndpointRegistration
- type BackendFallback
- type BackendFragmentAdapter
- type BackendHandlerCall
- type BackendResponse
- type FragmentEndpoint
- type LayoutErrorPage
- type Options
- type Result
- type SSRCondSpec
- type SSRListField
- type SSRListSpec
- type SSRLoadReplacement
- type SSRQueryRegion
- type SSRReplacement
- type SSRRoute
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildBinary ¶
BuildBinary compiles the generated app into binaryPath.
func GeneratedAuditTestSource ¶ added in v0.5.0
GeneratedAuditTestSource returns the generated-app audit test file source for options. It returns nil when there is no IR-backed posture to exercise.
func StandaloneAuditTestSource ¶ added in v0.5.0
func StandaloneAuditTestSource(config gowdk.Config, manifest securitymanifest.SecurityManifest, specs []gwdkir.AuditSpec) ([]byte, error)
StandaloneAuditTestSource returns a committable audit test file that drives runtime/app directly from the derived posture. The CLI uses this for `gowdk audit --emit-tests`; `gowdk audit --run` generates a temporary app and runs the generated-app audit test instead.
func StandaloneAuditTestSourceWithPackage ¶ added in v0.5.0
func StandaloneAuditTestSourceWithPackage(packageName string, config gowdk.Config, manifest securitymanifest.SecurityManifest, specs []gwdkir.AuditSpec) ([]byte, error)
StandaloneAuditTestSourceWithPackage returns standalone audit test source using packageName. It exists so the CLI can emit into a directory that already has Go files without creating a mixed-package test setup.
Types ¶
type APIEndpoint ¶ added in v0.1.5
type APIEndpoint struct {
PageID string
APIName string
Method string
Route string
Guards []string
ErrorPage string
Binding source.BackendBinding
BackendAlias string
Source string
SourceSpan source.SourceSpan
}
APIEndpoint describes a generated API handler.
type ActionEndpoint ¶ added in v0.1.5
type ActionEndpoint struct {
PageID string
ActionName string
Method string
Route string
Guards []string
InputName string
InputType string
InputFields []string
UploadFields []ActionUploadField
RequiredFields []string
RequiredMessages map[string]string
ValidationRules []ActionValidationRule
ValidatesInput bool
Redirect string
Fragments []ActionFragment
ErrorPage string
Binding source.BackendBinding
BackendAlias string
Source string
SourceSpan source.SourceSpan
}
ActionEndpoint describes a generated action handler.
type ActionFragment ¶
ActionFragment describes a generated partial response fragment.
type ActionUploadField ¶ added in v0.8.0
type ActionUploadField struct {
Field string
MaxFiles int
MaxBytes int64
AllowedContentTypes []string
}
ActionUploadField describes one generated multipart upload field policy.
type ActionValidationRule ¶ added in v0.1.5
type ActionValidationRule struct {
Field string
MinLength int
MinLengthMessage string
MaxLength int
MaxLengthMessage string
Pattern string
PatternMessage string
}
ActionValidationRule describes one generated server-side form constraint.
type BackendAPIAdapter ¶ added in v0.5.0
type BackendAPIAdapter struct {
Endpoint BackendEndpointRegistration
PageID string
APIName string
Method string
Route string
Guards []string
ErrorPage string
Binding source.BackendBinding
BackendAlias string
}
type BackendActionAdapter ¶ added in v0.5.0
type BackendActionAdapter struct {
Endpoint BackendEndpointRegistration
PageID string
ActionName string
Method string
Route string
Guards []string
InputName string
InputType string
InputFields []string
UploadFields []ActionUploadField
RequiredFields []string
RequiredMessages map[string]string
ValidationRules []ActionValidationRule
ValidatesInput bool
Redirect string
Fragments []ActionFragment
ErrorPage string
Binding source.BackendBinding
BackendAlias string
}
type BackendAdapterIR ¶ added in v0.1.5
type BackendAdapterIR struct {
Registrations []BackendEndpointRegistration
Actions []BackendActionAdapter
APIs []BackendAPIAdapter
Fragments []BackendFragmentAdapter
ContractExposures []BackendContractExposure
Decoders []BackendDecoder
Calls []BackendHandlerCall
Responses []BackendResponse
Fallbacks []BackendFallback
}
func (BackendAdapterIR) BackendImports ¶ added in v0.5.0
func (ir BackendAdapterIR) BackendImports() map[string]string
func (BackendAdapterIR) GuardNames ¶ added in v0.5.0
func (ir BackendAdapterIR) GuardNames() []string
func (BackendAdapterIR) HasCORSRoutes ¶ added in v0.8.0
func (ir BackendAdapterIR) HasCORSRoutes() bool
func (BackendAdapterIR) HasCSRFSensitiveAPI ¶ added in v0.5.0
func (ir BackendAdapterIR) HasCSRFSensitiveAPI() bool
func (BackendAdapterIR) HasDynamicRoutes ¶ added in v0.5.0
func (ir BackendAdapterIR) HasDynamicRoutes() bool
func (BackendAdapterIR) HasEndpointKind ¶ added in v0.5.0
func (ir BackendAdapterIR) HasEndpointKind(kind BackendEndpointKind) bool
func (BackendAdapterIR) HasRegistrations ¶ added in v0.1.5
func (ir BackendAdapterIR) HasRegistrations() bool
type BackendContractExposure ¶ added in v0.1.5
type BackendContractExposure struct {
Endpoint BackendEndpointRegistration
Contract string
ImportAlias string
ImportPath string
Type string
Result string
Roles []string
Guards []string
InputFields []source.BackendInputField
Status gwdkir.ContractBindingStatus
Handler string
Register string
Message string
OwnerKind gwdkir.SourceKind
OwnerID string
Package string
Source string
Span source.SourceSpan
}
type BackendDecoder ¶ added in v0.1.5
type BackendDecoder struct {
Endpoint BackendEndpointRegistration
Function string
Input string
Fields []string
}
type BackendEndpointKind ¶ added in v0.1.5
type BackendEndpointKind string
const ( BackendEndpointAction BackendEndpointKind = "action" BackendEndpointAPI BackendEndpointKind = "api" BackendEndpointFragment BackendEndpointKind = "fragment" BackendEndpointCommand BackendEndpointKind = "command" BackendEndpointQuery BackendEndpointKind = "query" )
type BackendEndpointRegistration ¶ added in v0.1.5
type BackendFallback ¶ added in v0.1.5
type BackendFallback struct {
Endpoint BackendEndpointRegistration
Status source.BackendBindingStatus
Message string
}
type BackendFragmentAdapter ¶ added in v0.5.0
type BackendHandlerCall ¶ added in v0.1.5
type BackendHandlerCall struct {
Endpoint BackendEndpointRegistration
Alias string
ImportPath string
Function string
Signature source.BackendSignatureKind
InputType string
}
type BackendResponse ¶ added in v0.1.5
type BackendResponse struct {
Endpoint BackendEndpointRegistration
NoStore bool
Partial bool
Redirect string
}
type FragmentEndpoint ¶ added in v0.1.5
type FragmentEndpoint struct {
PageID string
FragmentName string
Method string
Route string
RouteParams []source.RouteParam
Target string
HTML string
Package string
Uses map[string]string
Guards []string
Binding source.BackendBinding
BackendAlias string
Source string
SourceSpan source.SourceSpan
}
FragmentEndpoint describes a generated server fragment handler.
type LayoutErrorPage ¶ added in v0.8.0
type Options ¶
type Options struct {
Actions []ActionEndpoint
APIs []APIEndpoint
Fragments []FragmentEndpoint
SSR []SSRRoute
AutoRoutes bool
ProxyBackend bool
Config gowdk.Config
IR *gwdkir.Program
Sitemap buildgen.RuntimeSitemapPlan
}
Options configures generated app output.
type Result ¶
type Result struct {
AppDir string
MainPath string
PackagePath string
ModulePath string
OutputDir string
Files []string
BinaryPath string
}
Result describes generated app artifacts.
func GenerateBackendWithOptions ¶ added in v0.1.5
GenerateBackendWithOptions writes a generated Go app that serves only request-time backend routes for feature-bound actions and APIs.
type SSRCondSpec ¶ added in v0.6.0
type SSRCondSpec = source.SSRCondSpec
type SSRListField ¶ added in v0.6.0
type SSRListField = source.SSRListField
type SSRListSpec ¶ added in v0.6.0
type SSRListSpec = source.SSRListSpec
type SSRLoadReplacement ¶ added in v0.1.5
type SSRLoadReplacement = source.SSRLoadReplacement
type SSRQueryRegion ¶ added in v0.7.0
type SSRQueryRegion = source.SSRQueryRegion
type SSRReplacement ¶
type SSRReplacement = source.SSRReplacement
type SSRRoute ¶
type SSRRoute struct {
PageID string
Route string
Render gowdk.RenderMode
Cache string
ErrorPage string
LayoutErrorPages []LayoutErrorPage
Locale string
DynamicParams []string
RouteParams []source.RouteParam
Layouts []string
Guards []string
HasLoad bool
LoadBinding source.BackendBinding
LoadBackendAlias string
Source string
SourceSpan source.SourceSpan
HTML string
Replacements []SSRReplacement
LoadReplacements []SSRLoadReplacement
ListSpecs []SSRListSpec
CondSpecs []SSRCondSpec
QueryRegions []SSRQueryRegion
}
SSRRoute describes a generated request-time page handler.
Source Files
¶
- adapter_ir.go
- appgen.go
- audit_tests.go
- auto_routes.go
- build.go
- files.go
- identifier_errors.go
- ir.go
- module.go
- routes.go
- scripts.go
- source.go
- source_actions.go
- source_api.go
- source_auth.go
- source_backend.go
- source_backend_app.go
- source_contracts.go
- source_env.go
- source_fragments.go
- source_guards.go
- source_lifecycle.go
- source_middleware.go
- source_observability.go
- source_rate_limit.go
- source_realtime.go
- source_ssr.go
- source_ssr_regions.go
- template.go
- types.go
- validate_actions.go
- validate_ssr.go