/** * Public request/response types — DERIVED from the generated OpenAPI * contract (src/generated/api.ts), never hand-authored. A change to the * API's OpenAPI document + `pnpm gen` updates these automatically; only a * genuinely new endpoint (new client method) is a manual change. * * These are thin, named aliases over `paths[...]` so call sites read * nicely (`ScoreRequest`, `ScoreResponse`) instead of deep index chains. */ import type { components, paths } from "./generated/api.ts"; import type { ActivitySlug } from "./generated/activitySlugs.ts"; /** The sole media body of a request/response, whatever the media type * (application/json, application/ld+json, or application/x-ndjson → string). */ type ContentOf = T extends { content: infer C; } ? C[keyof C] : never; /** Request body of an operation. */ type ReqOf = O extends { requestBody?: infer RB; } ? ContentOf> : never; /** Response body for a specific status code. */ type ResOf = O extends { responses: infer R; } ? C extends keyof R ? ContentOf : never : never; /** The 2xx success body — the first of 200 / 201 / 202 the operation declares. */ type OkOf = O extends { responses: infer R; } ? 200 extends keyof R ? ContentOf : 201 extends keyof R ? ContentOf : 202 extends keyof R ? ContentOf : never : never; /** The query-parameter object of an operation. */ type QueryOf = O extends { parameters: { query?: infer Q; }; } ? NonNullable : never; /** The path-parameter object of an operation. */ type PathOf = O extends { parameters: { path?: infer P; }; } ? NonNullable

: never; /** The `application/json` body for a specific response status — used when an * operation declares several media types (e.g. JSON + text/csv) and we want * only the JSON branch, not the `object | string` union `ResOf` would give. */ type JsonResOf = O extends { responses: infer R; } ? C extends keyof R ? R[C] extends { content: { "application/json": infer J; }; } ? J : never : never : never; type Get

= paths[P] extends { get: infer O; } ? O : never; type Post

= paths[P] extends { post: infer O; } ? O : never; type Put

= paths[P] extends { put: infer O; } ? O : never; type Patch

= paths[P] extends { patch: infer O; } ? O : never; /** Narrow a request body's `activity: string` field to the typed (open) * `ActivitySlug` union for autocomplete, leaving bodies without a top-level * `activity` untouched. Open union ⇒ assignment-compatible with `string`, * so this is purely additive/non-breaking. */ type WithActivity = T extends { activity: string; } ? Omit & { activity: ActivitySlug; } : T; export type GeoPoint = components["schemas"]["GeoPoint"]; export type TimeWindowInput = components["schemas"]["TimeWindow"]; export type Verdict = components["schemas"]["Verdict"]; export type ScoreRequest = WithActivity>>; export type ScoreResponse = ResOf, 200>; /** Whether a score came from a real forecast, a gate no-go, or absent data. */ export type ScoreBasis = NonNullable; export type ScoreSeriesRequest = WithActivity>>; export type ScoreSeriesResponse = ResOf, 200>; export type ScoreMultiRequest = ReqOf>; export type ScoreMultiResponse = ResOf, 200>; export type ScoreHistoricalRequest = WithActivity>>; export type ScoreHistoricalResponse = ResOf, 200>; export type ScorePortfolioRequest = ReqOf>; export type ScorePortfolioResponse = ResOf, 200>; export type CounterfactualRequest = WithActivity>>; export type CounterfactualResponse = ResOf, 200>; export type DecisionRequest = WithActivity>>; export type DecisionResponse = ResOf, 200>; export type ExplainRequest = ReqOf>; export type ExplainResponse = ResOf, 200>; export type BriefingRequest = WithActivity>>; export type BriefingResponse = ResOf, 200>; export type ProjectionsRequest = ReqOf>; export type ProjectionsResponse = ResOf, 200>; export type QuoteRequest = ReqOf>; export type QuoteResponse = ResOf, 200>; export type RecommendSpotRequest = WithActivity>>; export type RecommendSpotResponse = ResOf, 200>; export type ScoreDifficultyRequest = WithActivity>>; export type ScoreDifficultyResponse = OkOf>; export type ReportOutcomeRequest = ReqOf>; export type ReportOutcomeResponse = OkOf>; /** Standalone activity outcome, not tied to a scored session (`POST /v1/outcomes`). */ export type SubmitOutcomeRequest = ReqOf>; export type SubmitOutcomeResponse = OkOf>; /** Recall ("lot recall") a batch of previously-reported outcomes * (`POST /v1/outcomes/void`). */ export type VoidOutcomesRequest = ReqOf>; export type VoidOutcomesResponse = OkOf>; export type EdgeCaseRequest = ReqOf>; export type EdgeCaseResponse = OkOf>; export type ProjectionsPortfolioRequest = ReqOf>; export type ProjectionsPortfolioResponse = OkOf>; export type AdaptationReportRequest = ReqOf>; export type AdaptationReportResponse = OkOf>; export type QuoteByIdResponse = OkOf>; export type BindPolicyRequest = ReqOf>; export type BindPolicyResponse = OkOf>; export type ListPoliciesQuery = QueryOf>; export type ListPoliciesResponse = OkOf>; export type PolicyResponse = OkOf>; export type EvaluatePolicyResponse = OkOf>; export type SettlePolicyRequest = ReqOf>; export type SettlePolicyResponse = OkOf>; /** Serialised parametric policy record + payout event, reused across the lifecycle. */ export type SerialisedPolicy = components["schemas"]["SerialisedPolicy"]; export type SerialisedPayoutEvent = components["schemas"]["SerialisedPayoutEvent"]; export type CreateStationRequest = ReqOf>; export type CreateStationResponse = OkOf>; export type ListStationsResponse = OkOf>; export type UpdateStationRequest = ReqOf>; export type UpdateStationResponse = OkOf>; export type SubmitObservationsRequest = ReqOf>; export type SubmitObservationsResponse = OkOf>; export type RecentObservationsQuery = QueryOf>; export type RecentObservationsResponse = OkOf>; /** Catalog-derived base activity list (`slug` / `display_name` / `family`) — * the canonical set a caller can pass as `activity`. `GET /v1/profiles` is a * server-side alias for the same response. */ export type ActivitiesResponse = OkOf>; export type SustainabilityIndexQuery = QueryOf>; export type SustainabilityIndexResponse = OkOf>; export type VerificationExportQuery = QueryOf>; export type PublicSignupRequest = ReqOf>; export type PublicSignupResponse = OkOf>; export type CatalogStatsResponse = OkOf>; /** Legal document kinds (from the OpenAPI path-param enum). */ export type LegalDocumentKind = PathOf>["kind"]; export type LegalDocumentResponse = OkOf>; export type HealthReadyResponse = OkOf>; export type AuditExportQuery = QueryOf>; /** The JSON body of an audit export (`format=json`, the default). The `csv` * variant is returned as a raw `string` by the client, not this type. */ export type AuditExportResponse = JsonResOf, 200>; export type SetLlmKeyRequest = ReqOf>; export type LlmKeyStatus = OkOf>; /** Per-call options for endpoints that accept an `Idempotency-Key` header * (`bindPolicy`, `reportOutcome`) — a client-generated key so a retry after a * network timeout can't double-apply the write. */ export interface IdempotencyOptions { idempotencyKey?: string; } /** Every webhook event the platform can deliver (from the OpenAPI enum). */ export type WebhookEventType = components["schemas"]["WebhookEvent"]; /** * A webhook delivery body, POSTed to a tenant's registered endpoint. The * envelope shape is stable; `data` is per-event and best-effort — narrow it * with `if (delivery.type === "underwriting.policy.bound") { ... }`. Field * names mirror the deliverer exactly (`id` / `type` / `created`). */ export interface WebhookDelivery> { id: string; type: WebhookEventType; created: string; data: T; } export type HealthResponse = ResOf; /** GDPR erasure surfaces receipt headers from the 204 response. */ export interface DeleteUserDataResult { status: number; /** Total rows anonymised across audit-log / behavioural model / * decision_runs / recommendation_runs (the X-Anonymized-Rows * header). The kind-specific counts below let callers attribute * the deletion to each store for their own DSAR audit file. */ anonymizedRows: number | null; anonymizedDecisionRuns: number | null; /** L10 — count of recommendation_runs rows anonymised. Wired with * migration 0030; older API deploys may return null. */ anonymizedRecommendationRuns: number | null; receipt: string | null; } export type { components, paths } from "./generated/api.ts"; export type { ActivitySlug, KnownActivitySlug } from "./generated/activitySlugs.ts"; //# sourceMappingURL=types.d.ts.map