SAService Architect Open designer
SAService ArchitectDocumentation
Framework lifecycle business function: context + environment -> shared instance

Dependency Injection with Generated Maker Functions

The generated dependency-injection boundary for functions, endpoints, clients, servers, serializers, and infrastructure.

When to use

Use this page when implementing maker hooks, owning resources, or diagnosing startup and shutdown.

Behavior

  • Generated defaults map graph elements to concrete framework constructors.
  • The custom maker hook runs before invocation and may replace selected defaults.
  • Independent makers run concurrently with shared cancellation after the first failure.
  • Each business-function result is stored once per service and shared by all referencing streams for the service lifetime. Infrastructure makers retain their typed configuration. Endpoint-handler makers receive context and environment only.

Maker and instance lifetime

Maker responsibilities

  • Create dependency clients and immutable collaborators.
  • Business-function makers receive context and environment, not a stream or stream configuration. Endpoint-handler makers also receive no endpoint configuration. Infrastructure makers validate their own typed configuration.
  • Return a function object whose hooks create per-request state.
  • Leave activation and shutdown to runtime lifecycle methods.

Hooks and boundaries properties

Generated extension points and runtime-owned lifecycle boundaries.

PropertyTypeDescription
contextcancellation/deadline

Cancels sibling initialization after a failure.

environmentServiceEnvironment

Logging, metrics, serde, callers, and runtime configuration.

configtyped graph config

Only infrastructure makers receive typed configuration. Business-function and endpoint-handler makers receive context and environment only.

resultowned instance

Long-lived function or infrastructure object.

Lifecycle outline

customMakersInit(ctx) {
  makers.<function_name> = async (ctx, env) => new CustomFunction(...);
}