/**
* vapor-chamber — Standard Schema validator plugin.
*
* Schema-library agnostic. Works with any schema lib implementing
* [Standard Schema v1](https://standardschema.dev/): Zod, Valibot,
* ArkType, Effect Schema, etc. The plugin only depends on the
* `~standard` interop shape — no schema lib is bundled.
*
* @example with Zod
* import { z } from 'zod';
* import { validateSchemas } from 'vapor-chamber';
*
* bus.use(validateSchemas({
* cartAdd: z.object({ id: z.number(), qty: z.number().min(1) }),
* orderCreate: z.object({ items: z.array(z.any()).min(1) }),
* }));
*
* @example with Valibot
* import * as v from 'valibot';
*
* bus.use(validateSchemas({
* cartAdd: v.object({ id: v.number(), qty: v.pipe(v.number(), v.minValue(1)) }),
* }));
*
* @example with ArkType
* import { type } from 'arktype';
*
* bus.use(validateSchemas({
* cartAdd: type({ id: 'number', 'qty?': 'number>0' }),
* }));
*
* Validation runs against `cmd.target` by default. Switch to `payload`,
* `both`, or a custom selector via the `field` option.
*/
import type { Command, CommandResult, Plugin, AsyncPlugin } from './command-bus';
import { BusError } from './command-bus';
// ---------------------------------------------------------------------------
// Standard Schema v1 — minimal interop types.
// We don't `import` from any schema lib; we duck-type via the `~standard`
// property that all conforming libs expose.
// ---------------------------------------------------------------------------
export interface StandardSchemaV1 {
readonly '~standard': {
readonly version: 1;
readonly vendor: string;
readonly validate: (
value: unknown,
) =>
| StandardSchemaV1Result