Documentation
¶
Index ¶
- type Engine
- func (e *Engine) GetProcessResolver() port.ProcessResolver
- func (e *Engine) GetPublicDocumentAccessAuthenticator() port.PublicDocumentAccessAuthenticator
- func (e *Engine) GetSigningSessionAuthenticator() port.SigningSessionAuthenticator
- func (e *Engine) GetTemplateResolver() port.TemplateResolver
- func (e *Engine) OnDocumentCompleted(fn port.DocumentCompletedHandler) *Engine
- func (e *Engine) OnShutdown(fn func(ctx context.Context) error) *Engine
- func (e *Engine) OnStart(fn func(ctx context.Context) error) *Engine
- func (e *Engine) RegisterInjector(inj port.Injector) *Engine
- func (e *Engine) Run() error
- func (e *Engine) RunMigrations() error
- func (e *Engine) SetDesignTokens(tokens pdfrenderer.TypstDesignTokens) *Engine
- func (e *Engine) SetFrontendFS(fsys fs.FS) *Engine
- func (e *Engine) SetI18nFilePath(path string) *Engine
- func (e *Engine) SetInitFunc(fn port.InitFunc) *Engine
- func (e *Engine) SetMapper(m port.RequestMapper) *Engine
- func (e *Engine) SetNotificationProvider(np port.NotificationProvider) *Engine
- func (e *Engine) SetProcessResolver(r port.ProcessResolver) *Engine
- func (e *Engine) SetPublicDocumentAccessAuthenticator(auth port.PublicDocumentAccessAuthenticator) *Engine
- func (e *Engine) SetSigningProvider(sp port.SigningProvider) *Engine
- func (e *Engine) SetSigningSessionAuthMode(mode string) *Engine
- func (e *Engine) SetSigningSessionAuthenticator(auth port.SigningSessionAuthenticator) *Engine
- func (e *Engine) SetStorageAdapter(sa port.StorageAdapter) *Engine
- func (e *Engine) SetTemplateResolver(r port.TemplateResolver) *Engine
- func (e *Engine) SetWebhookHandlers(handlers map[string]port.WebhookHandler) *Engine
- func (e *Engine) SetWorkspaceInjectableProvider(p port.WorkspaceInjectableProvider) *Engine
- func (e *Engine) UseAPIMiddleware(mw gin.HandlerFunc) *Engine
- func (e *Engine) UseMiddleware(mw gin.HandlerFunc) *Engine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the main entry point for doc-assembly. Create with New(), register extensions, then call Run().
func NewWithConfig ¶
NewWithConfig creates a new Engine that loads config from the given file path.
func (*Engine) GetProcessResolver ¶
func (e *Engine) GetProcessResolver() port.ProcessResolver
GetProcessResolver returns the registered process resolver.
func (*Engine) GetPublicDocumentAccessAuthenticator ¶
func (e *Engine) GetPublicDocumentAccessAuthenticator() port.PublicDocumentAccessAuthenticator
GetPublicDocumentAccessAuthenticator returns the registered public access authenticator, or nil if not set.
func (*Engine) GetSigningSessionAuthenticator ¶
func (e *Engine) GetSigningSessionAuthenticator() port.SigningSessionAuthenticator
GetSigningSessionAuthenticator returns the registered signing session authenticator, or nil if not set.
func (*Engine) GetTemplateResolver ¶
func (e *Engine) GetTemplateResolver() port.TemplateResolver
GetTemplateResolver returns the registered custom template resolver.
func (*Engine) OnDocumentCompleted ¶
func (e *Engine) OnDocumentCompleted(fn port.DocumentCompletedHandler) *Engine
OnDocumentCompleted registers a handler that is called when a document reaches COMPLETED status. The handler runs inside a River job worker, so returning an error causes automatic retry with backoff.
func (*Engine) OnShutdown ¶
OnShutdown registers a hook that runs AFTER HTTP server stops, BEFORE exit. Hooks run synchronously in REVERSE registration order (LIFO).
func (*Engine) OnStart ¶
OnStart registers a hook that runs AFTER config/preflight, BEFORE HTTP server starts. Hooks run synchronously in registration order.
func (*Engine) RegisterInjector ¶
RegisterInjector adds a custom injector to the engine. Multiple injectors can be registered.
func (*Engine) Run ¶
Run starts the engine: loads config, runs preflight checks, initializes all components, and starts the HTTP server. Blocks until shutdown signal (SIGINT/SIGTERM).
func (*Engine) RunMigrations ¶
RunMigrations loads config and applies all pending database migrations.
func (*Engine) SetDesignTokens ¶
func (e *Engine) SetDesignTokens(tokens pdfrenderer.TypstDesignTokens) *Engine
SetDesignTokens sets custom design tokens for PDF rendering. Controls fonts, colors, spacing, and heading styles in Typst output. If not set, DefaultDesignTokens() is used.
func (*Engine) SetFrontendFS ¶
SetFrontendFS overrides the embedded frontend filesystem. By default, the engine loads the embedded SPA from internal/frontend/dist. Pass a custom fs.FS to serve a different frontend, or nil to disable frontend serving.
func (*Engine) SetI18nFilePath ¶
SetI18nFilePath sets the path to user-provided i18n translations file.
func (*Engine) SetInitFunc ¶
SetInitFunc sets the global initialization function. Runs once before all injectors on each render request.
func (*Engine) SetMapper ¶
func (e *Engine) SetMapper(m port.RequestMapper) *Engine
SetMapper sets the request mapper for render requests. Only ONE mapper is supported.
func (*Engine) SetNotificationProvider ¶
func (e *Engine) SetNotificationProvider(np port.NotificationProvider) *Engine
SetNotificationProvider overrides the notification provider. Default: auto-selected from config (noop/smtp/gmail).
func (*Engine) SetProcessResolver ¶
func (e *Engine) SetProcessResolver(r port.ProcessResolver) *Engine
SetProcessResolver sets an optional process resolver for process validation and discovery.
func (*Engine) SetPublicDocumentAccessAuthenticator ¶
func (e *Engine) SetPublicDocumentAccessAuthenticator(auth port.PublicDocumentAccessAuthenticator) *Engine
SetPublicDocumentAccessAuthenticator sets custom authentication for /public/doc/:documentId. When auth succeeds, the request can bypass the email gate and be redirected directly to a tokenized /public/sign/:token URL.
func (*Engine) SetSigningProvider ¶
func (e *Engine) SetSigningProvider(sp port.SigningProvider) *Engine
SetSigningProvider overrides the signing provider. Default: auto-selected from config (mock/documenso).
func (*Engine) SetSigningSessionAuthMode ¶
SetSigningSessionAuthMode overrides signing session auth mode configured via settings/app.yaml (signing_session_auth.mode).
func (*Engine) SetSigningSessionAuthenticator ¶
func (e *Engine) SetSigningSessionAuthenticator(auth port.SigningSessionAuthenticator) *Engine
SetSigningSessionAuthenticator sets custom authentication for /api/v1/signing-sessions/:documentId when mode is "custom".
func (*Engine) SetStorageAdapter ¶
func (e *Engine) SetStorageAdapter(sa port.StorageAdapter) *Engine
SetStorageAdapter overrides the storage adapter. Default: auto-selected from config (local/s3).
func (*Engine) SetTemplateResolver ¶
func (e *Engine) SetTemplateResolver(r port.TemplateResolver) *Engine
SetTemplateResolver sets an optional custom template resolver for internal create flow.
func (*Engine) SetWebhookHandlers ¶
func (e *Engine) SetWebhookHandlers(handlers map[string]port.WebhookHandler) *Engine
SetWebhookHandlers overrides the webhook handlers by provider name. Default: auto-selected from signing config.
func (*Engine) SetWorkspaceInjectableProvider ¶
func (e *Engine) SetWorkspaceInjectableProvider(p port.WorkspaceInjectableProvider) *Engine
SetWorkspaceInjectableProvider sets the provider for workspace-specific injectables.
func (*Engine) UseAPIMiddleware ¶
func (e *Engine) UseAPIMiddleware(mw gin.HandlerFunc) *Engine
UseAPIMiddleware adds middleware to /api/v1/* routes only. Execution order: Operation -> Auth -> Identity -> Roles -> [User API Middleware] -> Controller
func (*Engine) UseMiddleware ¶
func (e *Engine) UseMiddleware(mw gin.HandlerFunc) *Engine
UseMiddleware adds middleware to be applied globally to all routes. Execution order: Recovery -> Logger -> CORS -> [User Global Middleware] -> Routes