feat(auth): bind signIn through ProductionUseCase<I, O, M> branded slot
Adds explicit ProductionUseCase<SignInInput, SignInOutput, AuthManifest["useCases"]["signIn"]> type annotation to wrappedSignIn in bind-production.ts. To satisfy the Instrumented & Captured intersection requirement, withSpan gains a brand-preserving overload so composing withSpan ∘ withCapture returns Instrumented<F> & Captured<F>. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,12 @@ import {
|
|||||||
type ILogger,
|
type ILogger,
|
||||||
} from "@repo/core-shared/instrumentation";
|
} from "@repo/core-shared/instrumentation";
|
||||||
import type { BindProductionContext } from "@repo/core-shared/di";
|
import type { BindProductionContext } from "@repo/core-shared/di";
|
||||||
|
import type { ProductionUseCase } from "@repo/core-shared/conformance";
|
||||||
|
import type { AuthManifest } from "../feature.manifest";
|
||||||
|
import type {
|
||||||
|
SignInInput,
|
||||||
|
SignInOutput,
|
||||||
|
} from "../application/use-cases/sign-in.use-case";
|
||||||
import { authContainer } from "./container";
|
import { authContainer } from "./container";
|
||||||
import { AUTH_SYMBOLS } from "./symbols";
|
import { AUTH_SYMBOLS } from "./symbols";
|
||||||
import { UsersRepository } from "../infrastructure/repositories/users.repository";
|
import { UsersRepository } from "../infrastructure/repositories/users.repository";
|
||||||
@@ -53,7 +59,11 @@ export function bindProductionAuth(ctx: BindProductionContext): void {
|
|||||||
.toConstantValue(authService);
|
.toConstantValue(authService);
|
||||||
|
|
||||||
// Use cases — wrapped with span + capture at bind time
|
// Use cases — wrapped with span + capture at bind time
|
||||||
const wrappedSignIn = withSpan(
|
const wrappedSignIn: ProductionUseCase<
|
||||||
|
SignInInput,
|
||||||
|
SignInOutput,
|
||||||
|
AuthManifest["useCases"]["signIn"]
|
||||||
|
> = withSpan(
|
||||||
tracer,
|
tracer,
|
||||||
{ name: "auth.signIn", op: "use-case" },
|
{ name: "auth.signIn", op: "use-case" },
|
||||||
withCapture(
|
withCapture(
|
||||||
|
|||||||
@@ -1,6 +1,16 @@
|
|||||||
import type { ITracer, SpanOpts } from "./tracer.interface";
|
import type { ITracer, SpanOpts } from "./tracer.interface";
|
||||||
import type { Instrumented } from "../conformance/brands";
|
import type { Instrumented } from "../conformance/brands";
|
||||||
|
|
||||||
|
export function withSpan<Args extends unknown[], R, Extra extends object>(
|
||||||
|
tracer: ITracer,
|
||||||
|
opts: SpanOpts | ((args: Args) => SpanOpts),
|
||||||
|
fn: ((...args: Args) => Promise<R>) & Extra,
|
||||||
|
): Instrumented<((...args: Args) => Promise<R>) & Extra>;
|
||||||
|
export function withSpan<Args extends unknown[], R>(
|
||||||
|
tracer: ITracer,
|
||||||
|
opts: SpanOpts | ((args: Args) => SpanOpts),
|
||||||
|
fn: (...args: Args) => Promise<R>,
|
||||||
|
): Instrumented<(...args: Args) => Promise<R>>;
|
||||||
export function withSpan<Args extends unknown[], R>(
|
export function withSpan<Args extends unknown[], R>(
|
||||||
tracer: ITracer,
|
tracer: ITracer,
|
||||||
opts: SpanOpts | ((args: Args) => SpanOpts),
|
opts: SpanOpts | ((args: Args) => SpanOpts),
|
||||||
|
|||||||
Reference in New Issue
Block a user