diff --git a/packages/auth/src/di/bind-production.ts b/packages/auth/src/di/bind-production.ts index 2af12a1..94d5868 100644 --- a/packages/auth/src/di/bind-production.ts +++ b/packages/auth/src/di/bind-production.ts @@ -6,6 +6,12 @@ import { type ILogger, } from "@repo/core-shared/instrumentation"; 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 { AUTH_SYMBOLS } from "./symbols"; import { UsersRepository } from "../infrastructure/repositories/users.repository"; @@ -53,7 +59,11 @@ export function bindProductionAuth(ctx: BindProductionContext): void { .toConstantValue(authService); // Use cases — wrapped with span + capture at bind time - const wrappedSignIn = withSpan( + const wrappedSignIn: ProductionUseCase< + SignInInput, + SignInOutput, + AuthManifest["useCases"]["signIn"] + > = withSpan( tracer, { name: "auth.signIn", op: "use-case" }, withCapture( diff --git a/packages/core-shared/src/instrumentation/with-span.ts b/packages/core-shared/src/instrumentation/with-span.ts index eeb6b09..0685b0c 100644 --- a/packages/core-shared/src/instrumentation/with-span.ts +++ b/packages/core-shared/src/instrumentation/with-span.ts @@ -1,6 +1,16 @@ import type { ITracer, SpanOpts } from "./tracer.interface"; import type { Instrumented } from "../conformance/brands"; +export function withSpan( + tracer: ITracer, + opts: SpanOpts | ((args: Args) => SpanOpts), + fn: ((...args: Args) => Promise) & Extra, +): Instrumented<((...args: Args) => Promise) & Extra>; +export function withSpan( + tracer: ITracer, + opts: SpanOpts | ((args: Args) => SpanOpts), + fn: (...args: Args) => Promise, +): Instrumented<(...args: Args) => Promise>; export function withSpan( tracer: ITracer, opts: SpanOpts | ((args: Args) => SpanOpts),