diff --git a/frontend/src/lib/api/generated/client/types.gen.ts b/frontend/src/lib/api/generated/client/types.gen.ts index 80837e8..6039d52 100644 --- a/frontend/src/lib/api/generated/client/types.gen.ts +++ b/frontend/src/lib/api/generated/client/types.gen.ts @@ -152,7 +152,7 @@ type BuildUrlFn = < url: string; }, >( - options: Pick & Options, + options: TData & Options, ) => string; export type Client = CoreClient< @@ -195,7 +195,7 @@ export type Options< RequestOptions, 'body' | 'path' | 'query' | 'url' > & - Omit; + ([TData] extends [never] ? unknown : Omit); export type OptionsLegacyParser< TData = unknown, diff --git a/frontend/src/lib/api/generated/core/params.gen.ts b/frontend/src/lib/api/generated/core/params.gen.ts index 2e0c4ef..6f693b0 100644 --- a/frontend/src/lib/api/generated/core/params.gen.ts +++ b/frontend/src/lib/api/generated/core/params.gen.ts @@ -23,6 +23,17 @@ export type Field = */ key?: string; map?: string; + } + | { + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If `in` is omitted, `map` aliases `key` to the transport layer. + */ + map: Slot; }; export interface Fields { @@ -42,10 +53,14 @@ const extraPrefixes = Object.entries(extraPrefixesMap); type KeyMap = Map< string, - { - in: Slot; - map?: string; - } + | { + in: Slot; + map?: string; + } + | { + in?: never; + map: Slot; + } >; const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { @@ -61,6 +76,10 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { map: config.map, }); } + } else if ('key' in config) { + map.set(config.key, { + map: config.map, + }); } else if (config.args) { buildKeyMap(config.args, map); } @@ -112,7 +131,9 @@ export const buildClientParams = ( if (config.key) { const field = map.get(config.key)!; const name = field.map || config.key; - (params[field.in] as Record)[name] = arg; + if (field.in) { + (params[field.in] as Record)[name] = arg; + } } else { params.body = arg; } @@ -121,8 +142,12 @@ export const buildClientParams = ( const field = map.get(key); if (field) { - const name = field.map || key; - (params[field.in] as Record)[name] = value; + if (field.in) { + const name = field.map || key; + (params[field.in] as Record)[name] = value; + } else { + params[field.map] = value; + } } else { const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix), @@ -133,10 +158,8 @@ export const buildClientParams = ( (params[slot] as Record)[ key.slice(prefix.length) ] = value; - } else { - for (const [slot, allowed] of Object.entries( - config.allowExtra ?? {}, - )) { + } else if ('allowExtra' in config && config.allowExtra) { + for (const [slot, allowed] of Object.entries(config.allowExtra)) { if (allowed) { (params[slot as Slot] as Record)[key] = value; break; diff --git a/frontend/src/mocks/handlers/generated.ts b/frontend/src/mocks/handlers/generated.ts index 23e0bfa..9301aa8 100644 --- a/frontend/src/mocks/handlers/generated.ts +++ b/frontend/src/mocks/handlers/generated.ts @@ -8,7 +8,7 @@ * * For custom handler behavior, use src/mocks/handlers/overrides.ts * - * Generated: 2025-11-26T12:21:51.098Z + * Generated: 2026-03-01T17:00:19.178Z */ import { http, HttpResponse, delay } from 'msw';