import type { Fields } from '@fougere/schema'; import type { HttpMethod } from '@fougere/http'; import { type Cardinality, type FougereFrondProtocols, type HandlerEntry as CoreHandlerEntry, type ProtocolConfig } from '@fougere/core'; import type { OperationMeta } from './OperationMeta.js'; import type { GenerateRoutesOptions } from './GenerateRoutesOptions.js'; import { type RestRoute } from '../RestProtocol.js'; export interface RouteDefinition { method: HttpMethod; path: string; operationName: string; /** Where the operation answers — `checkout` in `checkout.pay`. */ address: string; /** Handler facade method to call (receives InvocationContext). */ handler: (invocation: unknown) => Promise; /** Input schema (for validation / JSON schema generation). */ inputFields?: Fields; /** Output schema (for JSON schema generation). */ outputFields?: Fields; /** Explicit success status, from `protocols.rest.status` — it wins over what the contract reads as. */ successStatus?: number; /** How much the op answers — a page goes out as `{ items, total, hasMore, endCursor }`, a missing row as 404. */ cardinality?: Cardinality; /** A POST on the collection answering one row: what it answers did not exist before, so 201. */ creates?: boolean; /** * What the op may answer besides its own — a door middleware's redirect — as OpenAPI's `responses` * will publish it: stated in `operations:`, or read by the scan off a `RestResponse<…>`. */ responses?: RestRoute['responses']; /** The operation in words — the method's own doc sentence, carried by the contract. */ description?: string; } /** Only what this projection reads of a scanned handler. */ type HandlerEntry = Pick; interface PresenterEntry { entityName: string; fields: string[]; } interface FrondLike { name: string; handlers: HandlerEntry[]; presenters: PresenterEntry[]; surfaces?: Record; protocols?: FougereFrondProtocols; } export interface AppLike { fronds: FrondLike[]; /** What `fougere.config.ts` says to each protocol — where REST is mounted, a third party's routes. */ protocols?: ProtocolConfig; /** The façade an address serves to one audience — `undefined` when none. */ facadeFor(address: string, surface?: string): Record | undefined; /** Canonical operation table produced by core. */ operationsFor(address: string, surface?: string): Map | undefined; } /** Generate REST route definitions from a fougere App — one route per operation, per address served. */ export declare function generateRoutes(app: AppLike, options?: GenerateRoutesOptions): RouteDefinition[]; export {}; //# sourceMappingURL=RouteDefinition.d.ts.map