puerto 0.23.0

Puerto — Rust full-stack DDD framework CLI. Scaffolds Clean Architecture projects with auto-wired DI, SQLx support, and zero manual wiring. Formerly puerto-framework.
// GENERADO por puerto. Edita puerto.toml y después ejecuta `puerto generar bootstrap`.
//
// La raíz de composición: el único módulo que construye el cliente de la API. Las pantallas llegan
// a él con `useDependencias()`, así un test les da un falso.
{% if entities or auth %}
{% if entities -%}
import { type ClienteApi, crearClienteApi } from "../api/cliente";
{% endif -%}
{% if auth -%}
{% if local -%}
import type { Cuentas } from "../auth/cuentas";
{% endif -%}
{% if entities -%}
import { middlewareBearer } from "../auth/middleware-bearer";
{% endif -%}
{% if local -%}
import { pasarelaLocal } from "../auth/pasarela-local";
{% else -%}
import { ajustesOidcDeEntorno, pasarelaOidc } from "../auth/pasarela-oidc";
{% endif -%}
import type { PasarelaAuth } from "../auth/sesion";
{% endif %}
export interface Dependencias {
{%- if entities %}
  api: ClienteApi;
{%- endif %}
{%- if auth %}
  auth: PasarelaAuth;
{%- endif %}
{%- if local %}
  cuentas: Cuentas;
{%- endif %}
}

export function crearDependencias(): Dependencias {
{%- if auth %}
  const auth = {% if local %}pasarelaLocal(){% else %}pasarelaOidc(ajustesOidcDeEntorno()){% endif %};
{%- endif %}
{%- if entities %}
  const api = crearClienteApi();
{%- if auth %}
  api.use(middlewareBearer(auth));
{%- endif %}
{%- endif %}
{%- if local and not entities %}
  return { auth, cuentas: auth };
{%- elif local %}
  return { api, auth, cuentas: auth };
{%- elif auth and entities %}
  return { api, auth };
{%- elif auth %}
  return { auth };
{%- else %}
  return { api };
{%- endif %}
}
{%- else %}
export type Dependencias = Record<string, never>;

export function crearDependencias(): Dependencias {
  return {};
}
{%- endif %}