Beignet API reference
    Preparing search index...

    Interface UseCaseDef<Ctx, Name, Kind, InputSchema, OutputSchema, Emits>

    Finalized use case definition.

    Use cases validate their input before run(...) executes and validate their output before returning, unless validation is disabled on the builder.

    interface UseCaseDef<
        Ctx,
        Name extends string,
        Kind extends UseCaseKind,
        InputSchema extends StandardSchemaV1,
        OutputSchema extends StandardSchemaV1,
        Emits extends readonly DomainEventLike[] = readonly [],
    > {
        emits: Emits;
        inputSchema: InputSchema;
        kind: Kind;
        name: Name;
        outputSchema: OutputSchema;
        run: (
            args: { ctx: Ctx; input: InferInput<InputSchema> },
        ) => Promise<InferOutput<OutputSchema>>;
    }

    Type Parameters

    Index

    Properties

    emits: Emits

    Domain events this use case is allowed to record or publish through the scoped events helper.

    inputSchema: InputSchema

    Input schema, suitable for reuse in HTTP contracts and forms.

    kind: Kind

    Whether this use case is a command or query.

    name: Name

    Stable use-case name, usually namespaced by feature.

    outputSchema: OutputSchema

    Output schema, suitable for reuse in HTTP contracts and clients.

    run: (
        args: { ctx: Ctx; input: InferInput<InputSchema> },
    ) => Promise<InferOutput<OutputSchema>>

    Execute the use case with application context and typed input.